JavaScript

Hashcash Anti-Spam

A ten second calculation to deter comment spam. It's an old technique called "hash cash" and has nothing to do with drugs.

Comparison Shopping for Toilet Paper, in multiple computer languages.

It's hard to concentrate when you're tired and cranky, so I wasted some time writing a simple calculator in several different languages.

Making the Tumblr "Well" Layouts with CSS

So I was puzzling over how to make the "Well" style layout in Tumblr without Javascript.

Javascript Delayed Hiding of an Element, Delayed Function Calls in Different Contexts

So I'm working on a small "speech bubble" library, and needed to delay hiding of the bubble. It's not that it was required, but it was a pain in the butt figuring out how to arrange the event handlers on the different elements so that you don't end up with a situation where you get a flickering bubble because you hide the bubble, and that fires a mouseover event that, in turn, displays the bubble again. That fires a mouseout event that causes the bubble to be hidden.

Learning the Facebook API

For the past few months I've been working on web apps. The first was a mobile site based on jQuery Mobile. While it was "cool", it quickly dawned on me that it wouldn't get any significant usership. For one, it was like a clone of 4square and Scvngr - and who really uses that? I'd peer into the lists of checkins, and it wasn't looking too encouraging. People use it when they're bored and alone, and my scenario didn't involve either of those situations.

Javascript Module Pattern

Javascript Module Pattern In Depth at Adequately Good is a very good article about how to make JS modules that don't pollute the global namespace.

Function-Generating Functions in Javascript

I wrote this before I practiced with the module pattern and with adding methods to prototypes. So this article doesn't explain a best practice. Still, it's a pretty good pattern. See also the Javascript Patterns book.

OMFG - the future of software, in Javascript, Xopus

Xopus is an XML editor, written in Javascript and HTML5. It's not just JS, but it's licensed software for your desktop. I'm blown away. This is Google Docs, Angry Birds, Yahoo Pipes level blown away. Check it out.

Javascript and Lisp (erm Scheme or Guile)

I was reading up on Guile, figuring I should revisit Scheme annually. Found some examples, and translated them into Javascript.

(lambda (x) (+ x x))

(define add4 (let ((x 4)) (lambda (y) (+ x y))))

(define factorial (x) (if (zerop x) 1 (* x (factorial (- x 1)))))

function(x) { return add(x,x); }

function _defunmaker() { var x=4; return function(y) { return x + y; } }
var add4 = _defunmaker();
_defunmaker = null;

var factorial = function(x) { if (x==0) { return 1; } else { return x * factorial(x-1); }; };

A Demo of Transmitting Passwords Encrypted

This is a demo of a technique to transmit password encrypted. It's not a perfect solution yet, but it's getting there.

Interstitial Ad in jQuery

Normally, you should use canned Javascript or canned PHP modules to implement web features, but sometimes, that can suck. Typically, these products, if they're popular, start to suffer from feature bloat. Such was the case with some code for "interstitials", which are those ads that pop up on some web pages, interrupting your reading. Popups have been around a long time, and the drop-in code is just really huge.

Loop Faster

nzakas has a great presentation about speeding up Javascript loops but it applies to any language that uses C-like loop structures.

Caching Data for AJAX with Javascript

Here's a way to cache data on the client side, via javascript. This was tested on Firefox 3.6.3 on Ubuntu.

The idea is to convert your data into Javascript, and then load it with the SCRIPT tag. You then use the Expires HTTP header to tell the client how long to cache the data. Finally, you use some Javascript code to display the data.

Strip Non-Numeric Characters from Data

This Javascript widget strips non-numeric characters from the input. The result will be a space-separated list of numbers.

Nutty Hack - Dojo Javascript Front End to OpenOffice.org through Servlets

This is weird. The authors turn OpenOffice.org into a spreadsheet server -- and then create a front end in Dojo with Javascript, and tunnel events from the front end to the OOo spreadsheet via a Tomcat servlet.

Syndicate content