Monthly Archives: November 2011

Ruby instance_eval gotcha

I don’t know how much of a “gotcha” this is since it’s just a defined behavior and feature of the language, but I still found it a little counterintuitive when I encountered it, and I had to actually read the … Continue reading

Posted in ruby | Tagged , , , , | 1 Comment

JavaScript Strings: instanceof vs. typeof

I’ve discovered some really interesting (read as “horrible”) behavior in Safari 5 and Internet Explorer 9. I was using this with great success in Chrome and Firefox. if (typeof this === ‘string’) {     doStuffWith(this); } Then I test … Continue reading

Posted in javascript | Tagged , , , , , , , , , , , , | Leave a comment

Run Sinatra App in a Subdirectory with Rack::Builder.map

Thank god I found Tanner Burson’s blog. I was about to explode. I recommend reading Tanner’s original post, but the short answer is that you want Rack to do some routing for you via Rack::Bundler.map. Here is a super simple … Continue reading

Posted in Sinatra | Tagged , , , , , , , , , , , , , , , | Leave a comment

That’s Profiling!

I want to see if one string exists in another, case-insensitive. What’s faster? Making the strings both lower case then comparing them with String.match? Comparing the first string to a case-insensitive regular expression of the other? Making them both lower … Continue reading

Posted in javascript | Tagged , , | Leave a comment