Attention Deficit Disorder by Ricardo (via gamesdaypodcast)
Arjan van der Gaag's tumblelog
Arjan van der Gaag's semi-regularly updated swipe file
-
2010-03-10
-
→
Test apache configuration syntax
Recently my Mac OS X stock install of Apache failed to launch properly. The regular system preferences interface stopped and started Web Sharing without complaining, but I could not find
httpdactually running usingps -ax | grep httpdin the terminal.I was at a loss to explain why, until I found this little gem that you can use to syntax-test your configuration files with:
apachectl -twill report on any errors in httpd.conf or any of your other included files.It appeared that some time ago when I was attempting a manual upgrade of my Subversion install to 1.6.9 some Apache modules were corrupted. As I have no use for them I disabled them.
That did the trick, and now I’ve got my local development environment up and running again.
-
2010-02-05
Javascript: typeof NodeList
Beware of Javascript’s quirky
typeof:typeof document.getElementsByTagName('p')This will return
'function', which I did not expect. What is returned is aNodeList, which behaves like an array, identifies itself as a function, but really is neither.If you want to detect a
NodeListyou’re better off with feature detection:var isNodelist = (typeof myvar.length != 'undefined && typeof myvar.item != 'undefined')Do note that this makes it probable you’re dealing with a
NodeList— but you can’t be sure. -
2009-12-16
Getting Things Done with Rituals
In order to achieve real productivity you need to get into the zone. Context switches take you out of the zone and should therefore be managed carefully. Get rid of multitasking.
I’ve found the mental overhead of context switches can be reduced with a clear start and end for a tiny break from work. A ritual provides such clear boundaries. I use several rituals throughout my day: reviewing my to do’s, drinking a cup of coffee while skimming through the news, getting a cup of water, and so forth. Even the daily commute between home and work helps ‘switching off’ at the end of the day.
I’ve grown used to them over time. I think I now get why people are so resistant to change…
-
2009-12-08
In retrospect, all revolutions seem inevitable. Beforehand, all revolutions seem impossible.
— Michael McFaul
-
2009-11-03
-
2009-10-14
jQuery custom selectors
I like writing jQuery plugins, so I can separate functionality into distinct units. But applying the plugin sometimes requires some logic I’d rather have in my plugin itself.
Example code
Say I want to create a plugin that creates a lightbox-style image zooming effect. I want to apply it to all links pointing at an image:
<a href="/images/photo1.jpg"><img src="/images/photo1.jpg"></a>Here’s how I might call my awesome plugin in my main javascript file:
$(function() { // One option: create complex inline selectors: $('a[href$="jpg"], a[href$="png"]).awesome_plugin(); // Second option: filtering $('a').filter(function() { $(this).attr('href').match(/\.(png|gif|jpe?g)$/); }).awesome_plugin(); });These both might work, but they move typical plugin logic to my javascript initializer. That’s not what I want.
Custom selector
The solution is so obvious I wonder why I did not think of it before: write a custom jQuery selector:
$(function() { $('a:to_image').awesome_plugin(); });Awesome: concise and with clear intent. Here’s one way to implement it:
// Somewhere in my plugin $.expr[':'].to_image = function(obj, index, meta, stack) { return $(obj).attr('href').match(/\.(png|gif|jpe?g)$/); };Now all the logic is nicely tucked away in my plugin.
-
2009-09-22
GTD with OWA
Relying on Microsoft Outlook Web Access without Internet Explorer can be tiresome — being served a static web application that would have annoyed even in 1996 — but it is kind of relaxing too: the effort of constantly logging in and taming the horrible interface to get to your mail is a real motivator to get some actual work done.
-
2009-09-20
-
2009-09-16
Your request to not receive promotional emails about your subscription has been received and will be processed within the next 10 working days.
— FT.com customer service: 10 working days to unsubscribe from your mailing list? That’s crazy fast! They must be using some kind of “computer”. Amazing…


