September 2011
1 post
4 tags
How to correctly debounce a JavaScript function.
This function correctly debounces a function that is anticipated to be called many times with identical input in a short amount of time:
July 2011
1 post
3 tags
Singleton Pattern with RequireJS
Here’s a quick Gist on how to create a singleton with RequireJS.
April 2011
1 post
3 tags
Natural Log in JavaScript
If you need to take the natural log (a.k.a. “ln”) of a value in JavaScript, you might at first be disheartened to learn there is no such thing as Math.ln() - only Math.log(). However, if you remember way back to high school mathematics, you can use the following identity to calculate logarithms of any base via any other base:
Logb(x) = Loga(x) / Loga(b)
Since the natural log has a...
September 2010
2 posts
6 tags
New Gist: How to use Dojo to keep your footer at... →
It’s not easy, at least as far as I can tell, to have a footer on a page which does all of the following:
Sticks to the bottom of the window when the window is larger than the body contents,
attaches to the bottom of the body contents when the window is shorter, and
will move to the bottom of floated body contents (acknowledge their height when figuring out where it should go).
What this...
6 tags
How to kick off a TestSwarm job from jQuery...
Towards the end of last week I set up an instance of John Resig’s TestSwarm server here at TransLoc. In case you’re not familiar with it, here’s an excerpt of the description from the TestSwarm wiki at GitHub:
TestSwarm provides distributed continuous integration testing for JavaScript. It was initially created by John Resig as a tool to support the jQuery project and has since...
August 2010
1 post
6 tags
July 2010
2 posts
5 tags
Anonymous Classes with JavaScript and Self-Calling...
I was messing around with Firebug today, trying to test out a concept for event handling and I didn’t want to have to go through all the pomp and circumstance of creating a legitimate class in the firebug console so I dreamed up a way to make an anonymous class. Here’s what I came up with: (I left out the event handling stuff)
var a = new (function(name){
this.sayHello =...
3 tags
Badass JavaScript: Brain.js →
A neural network is “a mathematical model or computational model that tries to simulate the structure and/or functional aspects of biological neural networks” according to Wikipedia. Basically, a neural network carries out pattern recognition, very much like the human brain would. The user…
Wow, what a great idea… It’d be interesting to integrate machine learning stuff like...
June 2010
3 posts
2 tags
Badass JavaScript: jQSlickWrap: Wrap Text Around... →
Flattered to be featured by badassjs!
Jason Feinstein has written a plugin for jQuery called jQSlickWrap, which allows text to flow around the actual contents of the image instead of the bounding box. This is useful if your images have a transparent background, in which case jQSlickWrap enables text to flow within the…
You should always have a side project, too. Side projects give you an outlet,...
– defunkt (via dhotson)
May 2010
3 posts
JSConf 2010 Slides →
dhotson:
“For those of us who didn’t make it, I’ve compiled a list of slides + blog posts from the JSConf 2010 Track A speakers”
.. will check these out a bit later.
.. me too!
3 tags
April 2010
3 posts
4 tags
Firefox Heads-up Display for Developers →
Looks like we might have a potential competitor to Firebug coming out soon… This is exciting!
… an interactive Console to help web developers understand everything that happens during the creation of a web-page. Console entries will be time-stamped objects representing errors, network traffic, javascript events, DOM/HTML mutation and logging output. The Console will also have an...
March 2010
1 post
3 tags
February 2010
3 posts
6 tags
5 tags
My latest GitHub project: willow →
Willow is a JavaScript logging tool which uses the “magic” of JavaScript’s arguments object to introduce valuable information to logging and trace messages sent to Firebug’s console.
It’s not ready to be officially released yet, which is why I’m not really going to describe it too much here (yet). I’m curious to see what kind of additional features...
1 tag
5 tags
December 2009
8 posts
1 tag
4 tags
Make alert() behave like console.log(), when...
The other day, @mrspeaker tweeted this:
c’mon alert() - just magically be a _bit_ more like console.log and you’d save me a lot of time
This got the creative juices flowing a little and I coded up a small script to overwrite how alert() operates and, if available, it will choose to behave exactly like console.log() by writing to the console instead of popping up the dialog (if...
3 tags
The WebGL draft has been published!
A few days ago, the Khronos Group published their draft for the WebGL Specification. If you’re not familiar with WebGL, it’s a spec that describes how browsers should expose OpenGL’s powerful 3D APIs to web developers through HTML 5’s <canvas> element and JavaScript.
This is huge news for rich-client and open-web advocates alike: there is so much potential for...
3 tags
jQuery Anti-Patterns for Performance & Compression
View more presentations from Paul Irish.
2 tags
Google releases Chrome for Mac, finally... (beta) →
Finally! It’s about time…
2 tags
4 tags
Use jQuery to Make Your DOM Editable!
I was playing around with jQuery a bit last night on my flight from Raleigh to Tampa and put together a pretty cool little piece of code that will let you click any paragraph on the page and edit it in place. I’d say it needs some more work before it could be a plugin (for example, adding functionality to support updates to the server), but it’s not too bad:
<script...
3 tags
Are There Non-East Asian Language Reasons to Use...
HTML 5 is introducing a new element: <ruby>; here’s the W3C’s description:
The ruby element allows one or more spans of phrasing content to be marked with ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily used in East Asian typography as a guide for pronunciation or to include other annotations. In Japanese, this form of typography...
November 2009
26 posts
3 tags
My Design/Development Blogroll
On an [almost] daily basis, I try to read the following blogs to keep up on the latest design/dev news:
Ajaxian
Design Newz
ReadWriteWeb
TechCrunch
Designing Web Interfaces
Smashing Magazine
UX Booth - Disclaimer: I did win a book from one of their contests, but that had nothing to do with my liking the site; they have great articles.
I’m looking for more to add to this list,...
8 tags
Introducing jQSlickWrap - The Pixel-Perfect Prose...
I’ve been working on a new project over the past four nights after mulling the idea around in my head for a while.
Have you ever needed or wanted to wrap text around an image in HTML but were disappointed that your text was forced to wrap to the rectangular shape of the image’s bounding box - as opposed to the actual contents of the image?
Have you heard of the method of Sliced and...
4 tags
IBM Song Book: #6 "To Thomas J. Watson, President,...
Note: Yes, this stuff is for real… A co-worker of mine brought in this piece of memorabilia from when his grandfather worked for IBM in the ’40s and ’50s. It’s a twenty page book of 47 songs by IBM titled “Song Book”. It’s so cheesy!
To Thomas J. Watson, President, IBM
Tune: “Auld Lang Syne”
T. J. Watson — you’re our leader...
5 tags
Dynamically Instantiate a Dojo Class At Runtime
Need to create an instance of a class in Dojo without knowing what that class is ahead of time? Will you only have the name of the class that you want to instantiate? Check this out:
/**
* Create a new instance of a Dojo class.
*
* @param className
* (String) A fully-qualified name for class, such as
* "my.pack.age.Class"
* @param constructorSettings
* (object) An object that...
4 tags
Pop Docs: Aqua Teen Hunger Force in dojo.mixin()
This isn’t the first time I’ve seen fun references to pop culture/nerdcore in software documentation, but it is the first time (of hopefully, many) I’ve blogged about it. While looking up the details about dojo’s mixin utility method, dojo.mixin(target, source), I noticed one of their examples had a reference to Adult Swim’s Aqua Teen Hunger Force cartoon:
Example 3
...
3 tags
3 tags
Make a POSH Search Field With Semantic HTML and...
In the tutorial today, we’re going to be building the following search field while sticking to POSH (Plain Old Semantic HTML) principles:
Search
If you’re using a decent browser the our final version above looks great; it’s got a text field with a magnifying glass icon and a button all “contained” within a rounded rectangle border. If you’re unfortunate enough...
2 tags
Will outsourcing make freelancing the future for...
A “Job” vs “A Job”
Driving home from my job on Friday, I was listening to Marketplace on NPR. They had been talking about the bad unemployment numbers that were just released that morning until they cut to a segment by Charles Handy about our perceptions of what constitutes a “job”. Here’s a clip of the transcript:
The other day, I was having lunch...
2 tags
3 tags
"Closure Tools", Google's New JavaScript Toolkit
Yesterday, Google open-sourced three major JavaScript utilities/libraries as a group called “Closure Tools”:
Closure Compiler
Closure Library
Closure Templates
Closure Compiler
From Google:
The Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles...
2 tags
3 tags
IBM Song Book: #5 "March On With I B M"
March On With I B M
Verse
The fame of I B M
Spreads across the seven seas,
Our standards fly aloft,
Proudly waving in the breeze,
With T. J. Watson guiding us we lead throughout the world,
For peace and trade our banners are unfurled - unfurled.
Chorus
March on with I B M
We lead the way,
Onward we’ll ever go,
In a strong array;
Our thousands to the fore,...
Answer by JasonWyatt for Is there a data storage... →
In a sense, I think you kind of answered your own question here when you explained how Mip Mapping works (by interpolation/extrapolation). At different levels of “zoom”, you’d just choose a lower…