Posts

Showing posts with the label codepen

Claude Code Delivers Tina Chen's Awesome++ Inc

Image
On a 2560-pixel monitor, the text column of my blog was 867 pixels wide. Not 33%. Not the result of a media query. Eight hundred and sixty-seven pixels, at every window size, forever. Here is how I found the number, and what a fourteen-year-old Blogger template teaches about how layouts get stuck. The template is Awesome Inc. , designed by Tina Chen and shipped with Blogger since around 2011. If your blog is more than a few years old there is a decent chance you are running it, or one of its siblings, and a decent chance you have already tried to widen it from the Template Designer and failed. The reason you failed is interesting, so let's do the archaeology properly. Finding the number Start by not opening dev tools. Open the template XML and search it for every declaration that sets a width. You are looking for one specific thing: a length that is not a percentage. A fluid layout that feels cramped is a padding problem. A layout that is exactly as wide on a ...

Practising What I Preach (TO DO List Exercise)

I'd said one should do the Duke University To-Do-List exercise every so often to maintain confidence. I stand by it. It takes about 45 minutes the very first time - following the tutorial. Took me almost 90 minutes today starting from a blank codepen. Try it again with no recourse to a walk-through doc, and you learn so much more - so many new questions come up. In the old implementation, now I realize I have a bug - a task could be "done" or "important", but not both. So, if I had a task that was "done", and now I clicked the "important" button, it's class would change and I would no longer be able to delete it :) Another feature added : return focus to the text field for task-name after adding the task - that's a cool one - probably more useful for testing than anything :) item.classList.contains(name), .add(name), .remove(name) - your best friends. When you call a function, use onclick="funcName(this)" or "funcName...

When Stackoverflow Sends You in the Wrong Direction (processing file input)

https://stackoverflow.com/questions/2805977/how-do-i-call-a-javascript-function-after-selecting-a-file-from-the-select-file I have a file input element < input type = "file" id = "fileid" > How do I call a JavaScript function after selecting a file from the dialog window and closing it? Yikes! No answer marked right and the most upvoted says : jQuery ("input#fileid") .change (function () { alert (jQuery(this) .val ()) }); I say : OMG All you need to do is  <input type="file" onchange="calledFunction()"> FYI, to use the Duke Javascript Library , in your HTML (say in Codepen) : <script src="http://www.dukelearntoprogram.com/course1/common/js/image/SimpleImage.js"> </script> What they didn't do a terrific job of covering in the course (or their documentation) : whether SimpleImage objects can be passed to/from functions? Ans : Yes, just do var name_of_var = function_that_returns_SimpleImage(args...