Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Download Drush v3 from D.O and make it work on `drush` (OS X / Linux / *nix)
# Written by stemount, adapted by KarenS
# Last updated by Drupalise IT (http://drupalise.it) on 13 Sep 2010
# Update user
echo "Drush is now downloading via HTTP"
# move to home dir
@guybedford
guybedford / jquery.ajaxqueue.js
Created April 23, 2012 12:12
jQuery AJAX queues
/*
Allows for ajax requests to be run synchronously in a queue
Usage::
var queue = new $.AjaxQueue();
queue.add({
url: 'url',
@guybedford
guybedford / gist:4604409
Last active December 11, 2015 12:58 — forked from lightjs/gist:4604334
var GETSET = {
_extend: {
properties: 'IGNORE'
},
addProperty: function(p, startVal) {
var curVal = startVal;
this[p] = function(val) {
if (arguments.length)
curVal = val;
else
@guybedford
guybedford / trace.js
Last active August 30, 2017 11:49
RequireJS tracer
/*
* requireJS trace
*
* Given a configuration object, as would be passed to the optimizer,
* runs a raw build trace on the configuration, returning the traced
* dependency trees.
*
* Loaded as a requirejs module on the server.
*
* eg:
(function() {
window.Loader = function(parent, options) {
this.global = options.global || {};
this.baseURL = options.baseURL || parent.baseUrl;
this._parent = parent || null;
this._strict = options.strict || false;
this.normalize = options.normalize || parent.normalize;
this.resolve = options.resolve || parent.resolve;
@guybedford
guybedford / server.js
Last active December 26, 2015 21:09
SPDY asset server API
var spdy = require('spdy'); // node-spdy
var spdyAssetServer = require('spdy-asset-server'); // the proposed spdy-asset-server library
// given a url, provide the asset response stream
// custom serving function allows dynamic + static assets
var assetServer = new spdyAssetServer(function(url, stream) {
if (url == 'style/style.css')
stream.pipe(fs.createReadStream('/local/file/system/style.css'));
else if (url == 'style/style.less')
stream.pipe(less.createEncodingStream(fs.createReadStream('/local/file/system/style.less')));
@guybedford
guybedford / system-steal-plugin.js
Last active January 1, 2016 22:39
Steal Modularity Example for SystemJS
// add the steal format as the first priority check
System.formats.unshift('steal');
// create the steal format detection
var stealRegEx = /(?:^\s*|[}{\(\);,\n\?\&]\s*)steal\s*\(\s*((?:"[^"]+"\s*,|'[^']+'\s*,\s*)*)/;
System.format.steal = {
detect: function(source, load) {
var match = source.match(stealRegEx);
if (match)
return match[1] ? eval(match[1].substr(0, match[1].lastIndexOf(','))) : [];
@guybedford
guybedford / build-tool-concept.md
Last active August 29, 2015 13:58
Build Tool

Goals

  1. Support source maps
  2. Plugin-based compilation
  3. Perform compilation in memory, not file system.

Key Innovation: Use source map information to determine which changed files result in which files having to be rebuilt.

Source Maps and this innovation concept is why I'm even considering polluting this noisy space even further!

@guybedford
guybedford / proposal.md
Last active November 21, 2017 06:41
ES6 Module Spec Proposal - Deferred Execution and Instantiate Normalization

Key Issues

1. No Deferred Execution for Dynamic Modules

It can be quite confusing to new users that:

<module name="test">
  define(function() {
 console.log('running');
@guybedford
guybedford / extension-register.js
Last active September 27, 2015 15:17
System.register ES6 form loader hooks implementation for https://github.com/google/traceur-compiler/issues/953#issuecomment-40969512
// our side table
// registry = { deps, declare ; normalizedDeps, depMap ; execute, exports }
// Lifecycle:
// 1. before instantiate, just deps, declare
// 2. after instantiate, normalizedDeps and depMap
// 3. after linking, execute, exports
// 4. after partial tree execution just exports
// 5. after full tree execution, removed from registry
var registry = {};