Simon Willison’s Weblog

Subscribe
Atom feed for javascript

689 items tagged “javascript”

2010

premasagar’s sandie. “Sandie is a simple method for loading external JavaScript files into a page without affecting the global scope, to avoid collisions between conflicting scripts”—works by loading the script in an invisible iframe (hence a new global scope) and then passing a reference to a callback function in the parent page.

# 6th May 2010, 8:37 pm / javascript, premasagar-rose, sandie, recovered, iframes, sandboxing

Pure CSS3 Spiderman Cartoon w/ jQuery and HTML5. Great demo, though calling -webkit-animation HTML5 (or even CSS3) is a bit of a stretch...

# 4th May 2010, 7:27 pm / animation, css, css3, html5, javascript, jquery, webkitanimation, recovered

A HTTP Proxy Server in 20 Lines of node.js. Proxying is definitely a sweet spot for Node.js. Peteris Krummins takes it a step further, adding host blacklists and an IP whitelist as configuration files and using Node’s watchFile method to automatically reload changes to them.

# 28th April 2010, 1:24 pm / nodejs, proxy, http, node, javascript, peteris-krummins

Lazy Load Plugin for jQuery. I’m using this jQuery plugin to save some bandwidth when people first view my Redis tutorial slides. It unobtrusively replaces images on a page with a placeholder graphic, then sets them to load automatically as the user scrolls down the page.

# 26th April 2010, 12:02 am / lazyload, jquery, javascript, performance, plugins

tempalias.com development diary (via) tempalias.com is a e-mail forwarding service that lets you create an address that will only work for a few days (or a limited number of messages) and will forward messages on to your real account. It’s implemented using Node.js and Redis and the code is released under an MIT license. Philip Hofstetter, the developer, maintained a detailed development diary throughout which is worth reading if you’re interested in Node.js.

# 23rd April 2010, 7:36 pm / node, javascript, tempalias, redis, email

jQuery special events. Ben Alman’s comprehensive guide to jQuery’s special events API, which allows you to register new kinds of events that can then be attached and detached using jQuery’s bind and unbind methods. Ben’s clickoutside event is a particularly useful example.

# 17th April 2010, 9:08 pm / jquery, events, ben-alman, javascript

Step for Node.js. A further iteration on the attempts to make callback-based programming in Node.js easier to manage, this time making clever use of the ’this’ keyword to represent the next callback in the chain.

# 13th April 2010, 11:02 am / step, nodejs, callbacks, javascript

What’s wrong with extending the DOM. Detailed explanation of the problems that crop up from extending built-in DOM objects using JavaScript, from Prototype developer kangax. Prototype 2.0 will be dropping this technique entirely—will MooTools follow suit?

# 11th April 2010, 10:03 pm / javascript, monkeypatching, prototype, mootools, kangax

jQuery UI: Trying to manipulate the position of a draggable mid-drag doesn’t seem to work. This has bitten me on two separate projects now—it’s the only problem I’ve had with jQuery UI’s draggables, which have otherwise been fantastic.

# 11th April 2010, 9:59 pm / jqueryui, jquery, draggables, dragndrop, javascript

Preview: Freebase Gridworks (via) If my experience with government datasets has taught me anything, it’s that most datasets are collected by human beings (probably using Excel) and human beings are inconsistent. The first step in any data related project inevitably involves cleaning up the data. The Freebase team must run up against this all the time, and it looks like they’re tackling the problem head-on. Freebase Gridworks is just a screencast preview at the moment but an open source release is promised “within a month”—and the tool looks absolutely fantastic. DabbleDB-style data refactoring of spreadsheet data, running on your desktop but with the UI served in a browser. Full undo, a JavaScript-based expression language, powerful faceting and the ability to “reconcile” data against Freebase types (matching up country names, for example). I can’t wait to get my hands on this.

# 27th March 2010, 6:43 pm / freebase, gridworks, cleanup, data, open-data, dabbledb, javascript

webhook-relay. Another of my experiments with Node.js: webhook-relay is a self-contained queue and webhook request sending agent. Your application can POST to it specifying a webhook alert to be sent off, and webhook-relay will place that request in an in-memory queue and send it on its own time, avoiding the need for your main application server to block until the outgoing request has been processed.

# 19th March 2010, 10:17 am / nodejs, node, javascript, webhooks, experiments, projects, webhookrelay

jsbeautifier.org. Simple online tool for unpacking and beautifying JavaScript.

# 17th March 2010, 10:39 pm / javascript, obfuscation

If HTML is just another bytecode container and rendering runtime, we’ll have lost part of what made the web special, and I’m afraid HTML will lose to other formats by willingly giving up its differentiators and playing on their turf.

Alex Russell

# 17th March 2010, 10:37 pm / html, viewsource, javascript, alex-russell

flashblockdetector. Mark Pilgrim’s JavaScript library for detecting if the user has a Flash blocker enabled, such as FlashBlock for Firefox and Chrome or ClickToFlash for Safari. One good use of this would be to inform users that they need to opt-in to Flash for unobtrusive Flash enhancements (such as invisible audio players) to work on that page.

# 13th March 2010, 10:44 am / mark-pilgrim, flash, javascript, flashblock, clicktoflash

grammar.coffee (via) The annotated grammar for CoffeeScript, a new language that compiles to JavaScript developed by DocumentCloud’s Jeremy Ashkenas. The linked page is generated using Jeremy’s Docco tool for literate programming, also written in CoffeeScript. CoffeeScript itself is implemented in CoffeeScript, using a bootstrap compiler originally written in Ruby.

# 8th March 2010, 7:27 pm / compilers, javascript, coffeescript, documentcloud, jeremy-ashkenas, docco, literateprogramming, programming, selfhosting, ruby

Internet Explorer: Global Variables, and Stack Overflows. An extremely subtle IE bug—if your recursive JavaScript function is attached directly to the window (global) object, IE won’t let you call it recursively more than 12 times.

# 2nd March 2010, 9:21 am / bugs, javascript, recursion, internet-explorer, ie

Node.js, redis, and resque (via) Paul Gross has been experimenting with Node.js proxies for allowing web applications to be upgraded without missing any requests. Here he places all incoming HTTP requests in a redis queue, then has his backend Rails servers consume requests from the queue and push the responses back on to a queue for Node to deliver. When the backend application is upgraded, requests remain in the queue and users see a few seconds of delay before their request is handled. It’s not production ready yet (POST requests aren’t handled, for example) but it’s a very interesting approach.

# 28th February 2010, 11:02 pm / node, nodejs, javascript, highavailability, http, rails, redis

kriszyp’s node-promise. Another elegant approach to managing asynchronous flows in Node, including running things both in parallel and serial.

# 28th February 2010, 3:50 pm / node, javascript, callbacks, nodejs, promise

“Do” it fast! Tim Caswell’s Do library has been upgraded for compatibility with Node v0.1.30, and now has a clever Do.convert() method which wraps Node’s low-level APIs with the Do libraries “continuable” abstraction.

# 22nd February 2010, 7:02 pm / do, tim-caswell, node, nodejs, javascript

node-v0.1.30 (via) A very significant new release of Node.js: the Twisted/Dojo-style Promise abstraction has been removed entirely, causing backwards incompatible changes to a bunch of core APIs. This means the pseudo-blocking Promise.wait() method is gone too, making it even harder to accidentally block your event loop. Instead, user-level libraries are encouraged to add Promise-style abstractions. I’m pleased to see Node sticking to the low-level stuff.

# 22nd February 2010, 7 pm / node, nodejs, javascript, promise, twisted, dojo, async

do. A library for Node that adds a higher level abstraction for dealing with chained and parallel callbacks.

# 17th February 2010, 5:43 pm / do, node, nodejs, javascript

How To Node. New blog about Node.js, with a superb series of tutorials aimed at both experienced and new JavaScript developers. The stuff on managing callbacks (including running them in both series and parallel) is pretty eye-opening.

# 17th February 2010, 5:42 pm / node, javascript, callbacks, nodejs

Plupload (via) Fantastic new open source project from the team behind TinyMCE. Plupload offers a cross-browser JavaScript File uploading API that handles multiple file uploads, client-side progress meters, type filtering and even client-side image resizing and drag-and-drop from the desktop. It achieves all of this by providing backends for Flash, Silverlight, Google Gears, HTML5 and Browserplus and picking the most capable available option.

# 10th February 2010, 12:53 pm / plupload, tinymce, uploads, flash, silverlight, html5, gears, browserplus, javascript

Glitch is built in an entirely new and different way for a game. The back end (java at the lowest level, with game logic scripted in Javascript) is designed for maximum flexibility and ease of deployment. That means we'll be able to push new content — new items, new places, new characters — on a daily basis. It also means that we'll have lots of APIs with which the game can be expanded and extended.

Glitch

# 10th February 2010, 11:40 am / glitch, java, javascript, rhino

Lou’s Pseudo 3d Page. Spectacularly detailed exploration of the road graphics used in racing games prior to true 3D. This is a potential gold mine for anyone looking for a fun project to try out with canvas. Bonus points for comet integration—I’m still looking forward to the first real-time multiplayer game in the browser using comet and canvas.

# 8th February 2010, 11:21 am / graphics, comet, 3d, canvas, javascript, html5

dogproxy. Another of my experiments with Node.js—this is a very simple HTTP proxy which addresses the dog pile effect (also known as the thundering herd) by watching out for multiple requests for a URL that is currently “in flight” and bundling them together.

# 3rd February 2010, 1:05 pm / scaling, node, nodejs, projects, javascript, dogproxy, dogpile, thunderingherd

Comet (long polling) for all browsers using ScriptCommunicator. More Comet from the Plurk team: 80 lines of dependency free JavaScript implementing long polling using script tags (hence working cross-domain) across IE6+, Firefox, WebKit and Opera. The clever bit is the code to detect loading errors. It doesn’t try to fix the infinite loading indicator problem—is that still a cromulent usability concern?

# 3rd February 2010, 12:37 am / comet, longpolling, javascript, plurk, usability

Plurk: Instant conversations using Comet (via) Plurk’s comet implementation sounds pretty amazing. They’re using a single quad-core server with 32GB of RAM running 8 Node.js instances to serve long-polled comet to 100,000+ simultaneous users. They switched to Node from Java JBoss/Netty and found the new solution used 10 times less memory.

# 1st February 2010, 10:13 am / plurk, comet, javascript, node, netty, java, jboss

jQuery source viewer. A neat way of browsing the source code of jQuery itself, complete with hyperlinks to other jQuery methods. Kind of a single-purpose IDE. I can see myself using this a lot.

# 1st February 2010, 10:01 am / james-padolsey, jquery, javascript

HTML 5 audio player demo. Scott Andrew’s experiments with the HTML5 audio element (and jQuery)—straight forward and works a treat in Safari, but Firefox doesn’t support MP3. Presumably it’s not too hard to set up a fallback for Ogg.

# 1st February 2010, 9:58 am / mp3, ogg, firefox, safari, html5, audio, scott-andrew, javascript, jquery