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
| $ git clone github:lenary/guides.git | |
| Cloning into guides... | |
| remote: Counting objects: 255, done. | |
| remote: Compressing objects: 100% (216/216), done. | |
| remote: Total 255 (delta 111), reused 163 (delta 35) | |
| Receiving objects: 100% (255/255), 1.49 MiB | 564 KiB/s, done. | |
| Resolving deltas: 100% (111/111), done. | |
| $ cd guides | |
| $ git remote -v |
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'; |
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
| // -*- 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
| 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
| 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
| 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
| 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
| // 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 (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; |