Posts in the ‘Code’ category

setInterval(): the sneaky basterd child of JavaScript

Released April 7, 2011 24

So I’ve mentioned at some point or another that a lot of my work at RY has been developing jquery plugins and the like to make our lives easier during the busy reporting season. Overall they’ve worked out pretty well, but every once in a while someone finds a bug with one (or all) that needs addressing. Since they’re my creations, It’s usually put to me to correct these things.

Most of the time, these bugs are a small oversight on my part, or just straight-up stupidity. I’m not perfect, and I’ll gladly fix these things as they come up. I don’t consider bugs in my code that people find to be an affront to my skill; in reality I find them an opportunity to get better at what I do.

Then you run into something like a bug using setInterval, and things just stop making sense.

Continue reading

Font-replacement and the PC: fixing jagged edges

Released March 31, 2011 0

Font-replacement is a thing now on the internet. Gone are the days of Helvetica, Arial, and like, three other fonts. Now designers, coders, and hacks can add fonts to any web project. Heck, sometimes even for free!

But of course there are always drawbacks. The number of font-files you need is staggering, and the CSS you need to set up borders on the insane. Here’s the best CSS code I’ve seen for that. Then there’s the licensing issues: font’s ain’t free (mostly). If you want to use a good collection of the fonts out there, you have to pay. There are loads of services out there at this point that can serve up almost every possible font you could ever want. Some you pay for, some (like what I use for my own website) are free.

Getting past the pay barrier and the CSS file drudgery, you are left with another issue: rendering. Some fonts, while applicable for the web, have not beenĀ optimized. There’s a big difference between a web-optimized font, and a print font that has been released to the web. That is to say the latter look like shit most of the time. This is a major difference between a mac and a PC.

Let me explain further.

Continue reading

My jQuery plugin template is open season!

Released March 3, 2011 0

So I’ve been doing a lot of javascript development at work recently. I’ve basically created a lot of our reusable javascript ‘plugins’ to cover the common requirements of the work that we do. In many cases, this resides mostly (but not entirely) in online annual-report creation.

Anyone that’s in the business will know that there are some common functional elements that you end up having to build with javascript: accordions, tabs, faders, sliders, lightboxes, filters, etc. Many of these items can bleed over into non-report sites, such as intranets or even public-facing sites.

Continue reading