Skip to content

Instantly share code, notes, and snippets.

@hvergara
hvergara / getscript.js
Created September 27, 2012 04:16
getScript() - load scripts asynchronously w/375 bytes of code - e.g. `getScript(src, cb)`
// # getScript()
// more or less stolen from jquery core and adapted by paul irish
function getScript(url,success) {
var head = document.getElementsByTagName("head")[0], done = false;
var script = document.createElement("script");
script.src = url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) {
@hvergara
hvergara / gist:1404796
Created November 29, 2011 13:23 — forked from KristianLyng/gist:1404599
VCL state diagram
.-----------------.
.----------| receive request |
v '-----------------'
.--------------.
| vcl_recv | Varnish 3.0 state diagram
.-----------|--------------|-------------. Not entierly complete.
| | req | | Misses error/restart and
v '--------------' v some internals
pass lookup pipe
| | |