Erik A. Hanson's Weblog

Archive for the 'Javascript' Category

Running Jasmine Tests Through Jaxer

Posted: Thursday, June 4th, 2009    Tags: Jasmine, Javascript, Jaxer, Unit Testing, Web development

Jasmine? Jaxer? Jasmine is a new Javascript testing framework from my pals at Pivotal Labs. Jaxer is an Apache module that wraps Firefox’s Javascript and rendering engine, providing a server-side Javascript environment that’s fast and compatible with any JS that works in Firefox (including all kinds of DOM manipulation and libraries like Prototype, jQuery, etc.). [...]

A Bookmarklet To Reload A Page’s CSS

Posted: Saturday, February 28th, 2009    Tags: Javascript, Web development

Sometimes when I’m developing, I want to change some stylesheets and reload them without reloading the whole page. Often, I use Firebug or the Safari Web Inspector to play with individual attributes, but sometimes I have to edit the CSS files. So I wrote a bookmarklet to reload the files. Here it is: reload CSS [...]

Introducing JS Dev Tools

Posted: Saturday, February 28th, 2009    Tags: Javascript, My Software, Web development, jsdevtools.com

I created a site called JS Dev Tools (jsdevtools.com) to keep track of useful Javascript development tools and libraries. Check out the site, subscribe to the feed, and suggest your favorite tools and libraries.

Relative dates in Javascript

Posted: Thursday, December 4th, 2008    Tags: Javascript

A while ago, I posted some Javascript code that produces a nice relative date string (e.g., “4 days ago” or “18 minutes ago”) given two dates. I looked at the code again and noticed that it was pretty long and needlessly required Prototype. So I cleaned it up a bit: /** * Simple relative date. [...]

New Test Runner for JsUnit

Posted: Sunday, May 18th, 2008    Tags: Javascript, JsUnit

Christian Williams created a new test runner for JsUnit. More info here.

A Rake Task to Concatenate and Compress Javascript Files

Posted: Sunday, March 2nd, 2008    Tags: Javascript, Ruby on Rails, Web development, wshlst.com

A while ago, I wrote about a Ruby script to concatenate and compress Javascript files for my wshlst application. I’ve changed things around a bit since that article, so I thought it was time for an update. Background wshlst uses a lot of Javascript. When developing, I want to have all of my JS files [...]

Firing mouse events in tests

Posted: Tuesday, January 1st, 2008    Tags: Javascript, JsUnit, Unit Testing, Web development

The Bad News Sending mouse events such as click and mouseover in JsUnit tests can be really hard. More Bad News Prototype doesn’t make it any easier. Sam Stephenson says: We would very much like to support it in the future. It’s fairly complicated to implement native event firing across all supported browsers, so in [...]

My time zone solution: RelativeDate.js and ServerTime.js

Posted: Wednesday, October 31st, 2007    Tags: Javascript, My Software, Ruby on Rails, Web development, wshlst.com

For my wshlst.com project, I needed to show when each item or comment was created or edited. My initial implementation was to just show the time and date of the change, but people who aren’t in the same time zone as my server didn’t like the fact that it showed a different time zone. I [...]

wshlst.com: A Webapp With A Pure-Javascript UI

Posted: Thursday, October 25th, 2007    Tags: Javascript, My Software, Web development, wshlst.com

I created a little wish list website called wshlst.com for my family to use. (Read more about it here.) I worked on it a little bit before Christmas last year, and a little bit again this year. It’s been a lot of fun to write, and one reason is that the entire UI is written [...]

A Ruby Script to Concatenate and Compress Javascript Files

Posted: Tuesday, October 16th, 2007    Tags: Javascript, Web development

I’ve got an HTML page that includes a bunch of Javascript files, which makes development easy but which hurts performance in production. The standard solution is to concatenate all the Javascript files into one big file and then compress it. I wanted it to be automated of course, and I wanted to do it at [...]