Skip to content

Instantly share code, notes, and snippets.

View neonstalwart's full-sized avatar

Ben Hockey neonstalwart

  • google.com
  • Boulder, CO
View GitHub Profile
@neonstalwart
neonstalwart / wrapperStore
Created August 18, 2011 16:48 — forked from dmachi/wrapperStore
getting started with wrapping two stores with one
var store = function(substores,options){
return {
query: function(query, options){
return when(promise.all(substores.map(function (store) {
return when(store.query(query, options));
}), function (results) {
return results.reduce(function (out, arr) {
return out.concat(arr);
}, []);
/**
* @license Copyright (c) 2011 Cello Software, LLC.
* All rights reserved.
* Available via the new BSD License.
*/
/*jshint
bitwise: false, curly: true, eqeqeq: true, forin: true, immed: true, indent: 4, maxlen: 100,
newcap: true, noarg: true, noempty: true, onevar: true, passfail: false, undef: true,
white: true
*/
@neonstalwart
neonstalwart / try-catch.html
Created June 13, 2011 14:38
try/catch performance with requirejs
<!DOCTYPE html>
<html>
<head>
<script>
var testIterations = 1e5;
var benchmark = function(hint, m,i) {
var d1 = new Date, d2, r;
while(i--)
r = m();
diff --git a/lib/DAV/plugins/codesearch.js b/lib/DAV/plugins/codesearch.js
index 9d3f77b..d961af0 100644
--- a/lib/DAV/plugins/codesearch.js
+++ b/lib/DAV/plugins/codesearch.js
@@ -152,12 +152,12 @@ jsDAV_Codesearch_Plugin.MAXSIZE = 2097152; //2MB
if (!Util.isTrue(options.casesensitive))
cmd += " -i ";
var t,
- include = "*.{" + jsDAV_Codesearch_Plugin.PATTERN_EXT + "}";
+ include = "\\*.{" + jsDAV_Codesearch_Plugin.PATTERN_EXT + "}";
define([
'dojo',
'dijit/_Widget',
'./_base',
'dojo/query!css3'
], function (d, _Widget, mustache, query) {
//'use strict';
var dfe = d.forEach,
empty = {};
@neonstalwart
neonstalwart / foo_bar_one.js
Created May 20, 2011 13:44
relative module id resolution
// foo/bar/one.js
define(['./two'], function (two) {
return {
two: two
};
});
@neonstalwart
neonstalwart / define-node.js
Created April 22, 2011 13:46 — forked from kriszyp/define-node.js
Add AMD/define() support to NodeJS
// Credit: this is derived from a combination of
// - https://gist.github.com/650000
// - https://github.com/joyent/node/pull/350
// - https://github.com/ajaxorg/cloud9/blob/master/support/requireJS-node.js
var path = require('path'),
fs = require('fs'),
defaultCompile = module.constructor.prototype._compile,
defaultResolveFilename = module.constructor._resolveFilename,
// this gives the main module a chance to use define iff it does so before any other module
Environment:
Request Method: POST
Request URL: http://dev04.cello.com:8000/admin/cms/page/4/?language=en&
Django Version: 1.2.5
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
@neonstalwart
neonstalwart / requirejs.diff
Created February 1, 2011 21:19
requirejs sync plugin loading support
diff --git a/require.js b/require.js
old mode 100644
new mode 100755
index 9147d58..4341bad
--- a/require.js
+++ b/require.js
@@ -254,7 +254,7 @@ var require, define;
if (prefix) {
prefix = normalize(prefix, parentName);
//Allow simpler mappings for some plugins
define([
'dojo',
'./mustache'
], function (d, mustache) {
var dfe = d.forEach,
empty = {};
return d.declare(null, {
declaredClass: 'mustache_Templated',