This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Tom Robinson <http://tlrobinson.net/> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (name, definition){ | |
if (typeof define === 'function'){ // AMD | |
define(definition); | |
} else if (typeof module !== 'undefined' && module.exports) { // Node.js | |
module.exports = definition(); | |
} else { // Browser | |
var theModule = definition(), global = this, old = global[name]; | |
theModule.noConflict = function () { | |
global[name] = old; | |
return theModule; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inside your beforeEach hook | |
spyOn(window, 'setTimeout').andCallFake(function(fn){ | |
fn.apply(null, [].slice.call(arguments, 2)); | |
return +new Date; | |
}); | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MyClass(){ | |
if (this instanceof MyClass){ | |
this.init.apply(this, arguments); | |
} else { | |
MyClass.from(arguments[0]) | |
} | |
} | |
MyClass.from = function(object){ | |
// convert object into a MyClass or something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var plistParser = require("../lib/sax").parser(false, {lowercasetags:true, trim:true}), | |
sys = require("sys"), | |
fs = require("fs"); | |
function entity (str) { | |
return str.replace('"', '"'); | |
} | |
plistParser.getInteger = function (string) { | |
this.value = parseInt(string, 10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var extend = function(child, parent) { | |
for(var i in parent) { | |
if(parent.hasOwnProperty(i)) { | |
child[i] = parent[i]; | |
} | |
} | |
return child; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function serverReachable() { | |
// IE vs. standard XHR creation | |
var x = new ( window.ActiveXObject || XMLHttpRequest )( "Microsoft.XMLHTTP" ), | |
s; | |
x.open( | |
// requesting the headers is faster, and just enough | |
"HEAD", | |
// append a random string to the current hostname, | |
// to make sure we're not hitting the cache | |
"//" + window.location.hostname + "/?rand=" + Math.random(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- ObjC -*- | |
// Hiroshi Saito / Yakitara.com | |
/* | |
You know OCMock does great, but (If I'm not get wrong with it) | |
- it will supposed to be used in tests not a production code | |
- it can't mock class methods | |
- it requires an instace to be mocked accessible in your tests | |
If you not familiar with alias_method_chain, see: | |
https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/module/aliasing.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Browser = require('Browser').Browser; | |
var Request; | |
(function(){ | |
Request = Browser.something ? new Class(...) : new Class(...); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Foo = 'bar'; |