Skip to content

Instantly share code, notes, and snippets.

View heymichaelp's full-sized avatar

Michael Phillips heymichaelp

View GitHub Profile
createCORSRequest = (method, url) ->
xhr = new XMLHttpRequest()
if "withCredentials" of xhr
xhr.open method, url, true
else unless typeof XDomainRequest is "undefined"
xhr = new XDomainRequest()
xhr.open method, url
else
xhr = null
xhr
// want to uses this module like:
// `var $ = require('jquery');`
//
// so it incudes all plugins
var jquery = require('actual-jquery');
inject('plugin.jquery');
module.exports = jquery;
@heymichaelp
heymichaelp / index.js
Created February 13, 2014 15:38
requirebin sketch
var mixin = require('utils-merge');
var foo = { data: { bar: 'baz' } };
var bar = { data: { baz: 'bang' } };
var baz = mixin( foo, bar )
alert(JSON.stringify( baz ) )
@heymichaelp
heymichaelp / 0_reuse_code.js
Created February 25, 2014 18:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
res for Objects.","main":"sigmund.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js","bench":"node bench.js"},"repository":{"type":"git","url":"git://github.com/isaacs/sigmund"},"keywords":["object","signature","key","data","psychoanalysis"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"BSD","readme":"# sigmund\u000a\u000aQuick and dirty signatures for Objects.\u000a\u000aThis is like a much faster `deepEquals` comparison, which returns a\u000astring key suitable for caches and the like.\u000a\u000a## Usage\u000a\u000a```javascript\u000afunction doSomething (someObj) {\u000a var key = sigmund(someObj, maxDepth) // max depth defaults to 10\u000a var cached = cache.get(key)\u000a if (cached) return cached)\u000a\u000a var result = expensiveCalculation(someObj)\u000a cache.set(key, result)\u000a return result\u000a}\u000a```\u000a\u000aThe resulting key will be as unique and reproducible
Last login: Thu Mar 13 09:58:20 on ttys000
cd pMichaels-MacBook-Air:~ michaelphillips$ cd Projects/browser-features/
Michaels-MacBook-Air:browser-features michaelphillips$ node server/development.js
connect.multipart() will be removed in connect 3.0
connect.multipart() will be removed in connect 3.0
connect.multipart() will be removed in connect 3.0
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
st login: Thu Mar 13 09:58:20 on ttys000
cd pMichaels-MacBook-Air:~ michaelphillips$ cd Projects/browser-features/
Michaels-MacBook-Air:browser-features michaelphillips$ node server/development.js
connect.multipart() will be removed in connect 3.0
connect.multipart() will be removed in connect 3.0
connect.multipart() will be removed in connect 3.0
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
https://gist.github.com/9530229
https://gist.github.com/9530234
Last login: Thu Mar 13 10:43:11 on ttys003
Michaels-MacBook-Air:~ michaelphillips$