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 EventEmitter = require("events").EventEmitter; | |
| var emitter = new EventEmitter(); | |
| emitter.once("foo", function() { | |
| console.log("foo"); | |
| }); | |
| emitter.on("foo", function() { | |
| console.log("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
| class UserDetail extends Base { | |
| render () { | |
| let { user } = this.props; | |
| return ( | |
| <strong>{user.name}</strong> | |
| ); | |
| } | |
| } |
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
| something.then(function() { | |
| throw new Error(“lel”); | |
| }, function(error) { | |
| // lol you think I’ll catch, but I wont | |
| }).then(null, function(error) { | |
| // Actually gets caught here. | |
| console.error(error); // "lel" | |
| }); |
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 ($) { | |
| var keys = [], code = '38,38,40,40,37,39,37,39,66,65'; | |
| var konami = function (e) { | |
| keys.push(e.which); | |
| if (keys.length >= 11 && keys.slice(-11).toString() !== code) { | |
| keys = []; | |
| /* do your konami thing here */ | |
| } else if (keys.length > 11) { | |
| keys.length = 11; | |
| } |
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
| define(["ember"], function (Ember) { | |
| return { | |
| load: function(name, require, onload, config) { | |
| require(["text!/js/templates/" + name + ".hbs"], function (template) { | |
| Ember.TEMPLATES[name] = Ember.Handlebars.compile(template); | |
| onload(); | |
| }); | |
| } | |
| }; | |
| }); |
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
| { | |
| "uid": 47777, // Dropbox user ID | |
| "stripeId": "cus_xxx", // Stripe customer ID, used for payments | |
| "donationRedeemed": false, // Flag to determine if the user has redeemed a PayPal donation | |
| "isNewPro": true, // Flag to determine if the user should be shown the "new pro" pop up | |
| "joined": "2013-02-06T03:42:28.825Z", // Date the user joined | |
| "lastActivity": "2013-02-06T16:05:47.797Z", // Date of the account's last activity | |
| "pro": true, // Flag to determine if the account is a Pro account | |
| "token": "xxxx", // Dropbox OAuth token | |
| "tokenSecret": "xxxx", // Dropbox OAuth token secret |
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
| Stream = require "stream" | |
| class Base64Stream extends Stream | |
| _queue: "" | |
| _emitChunk: ( chunk ) -> | |
| @emit "data", new Buffer chunk, "base64" | |
| write: ( chunk ) -> |
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
| { | |
| numMessages: "You have {numMessages, plural, one {one message} other {#{numMessages} messages}}." | |
| } |
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
| <script> | |
| // Load browser shims | |
| Modernizr.load([ | |
| { | |
| test: window.JSON, | |
| nope: 'libs/shims/json3.js' | |
| }, | |
| { | |
| test: Object.getOwnPropertyNames, | |
| nope: "libs/shims/es5-shim.js", |
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 obj = { | |
| "ralph" : 1, | |
| "jon" : 2, | |
| "alex" : 3 | |
| }; | |
| function _with( fn, data ) { | |
| var keys = Object.keys( data ), | |
| values = keys.map(function( key ) { |
NewerOlder