This file contains 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 merge2dArrayIntoOne = function(arrays){ | |
return arrays.reduce(function(p, n){ | |
return p.concat(n); | |
}); | |
}; |
This file contains 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
> db.products.findOne() | |
{ | |
name : 'left-handed smoke shifter', | |
manufacturer : 'Acme Corp', | |
catalog_number: 1234, | |
parts : [ // array of references to Part documents | |
ObjectID('AAAA'), // reference to the #4 grommet above | |
ObjectID('F17C'), // reference to a different Part | |
ObjectID('D2AA'), | |
// etc |
This file contains 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 reflow(elt){ | |
console.log(elt.offsetHeight); | |
} |
This file contains 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
// default exports | |
export default 42; | |
export default {}; | |
export default []; | |
export default foo; | |
export default function () {} | |
export default class {} | |
export default function foo () {} | |
export default class foo {} |
This file contains 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 express = require('express'); | |
var path = require('path'); | |
var favicon = require('serve-favicon'); | |
var logger = require('morgan'); | |
var cookieParser = require('cookie-parser'); | |
var bodyParser = require('body-parser'); | |
var routes = require('./routes/index'); | |
var users = require('./routes/users'); |
This file contains 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
import {Component, ElementRef, OnInit} from 'angular2/core'; | |
declare var jQuery: any; | |
@Component({ | |
selector: 'my-jquery', | |
template: ` | |
<button>Click Me</button> | |
` | |
}) |
This file contains 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
const combineReducers = (reducers) => { | |
return (state = {}, action) => { | |
return Object.keys(reducers).reduce( | |
(nectState key) => { | |
nextState[key] = reducers[key]( | |
state[key], | |
action | |
); | |
return nextState; | |
} |
This file contains 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 fs = require('fs') | |
var Q = require('q') | |
var fs_stat = Q.denodeify(fs.stat) | |
var fs_readdir = Q.denodeify(fs.readdir) | |
var files = [ | |
'./fixtures/file1', | |
'./fixtures/file2', | |
'./fixtures/file3', | |
'./fixtures/file4' |
This file contains 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
__d("Chromedome", ["fbt"], function(a, b, c, d, e, f, g) { | |
f.start = function(h) { | |
if (h.off || top !== window ||!/(^|\.)facebook\.com$/.test(document.domain)) | |
return; | |
var i = h.stop || "Stop!", j = h.text || "This is a browser feature intended for developers. If someone told you to copy-paste something here to enable a Facebook feature or \"hack\" someone's account, it is a scam and will give them access to your Facebook account.", k = h.more || g._("For more information, see {url}.", [g.param("url", 'https://www.facebook.com/selfxss')]); | |
if ((window.chrome || window.safari)&&!h.textonly) { | |
var l = 'font-family:helvetica; font-size:20px; '; | |
[[i, h.c1 || l + 'font-size:50px; font-weight:bold; ' + 'color:red; -webkit-text-stroke:1px black;'], [j, h.c2 || l], [k, h.c3 || l], ['', '']].map(function(r) { | |
setTimeout(console.log.bind(console, '\n%c' + r[0], r[1])); | |
}); |
This file contains 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 express = require('express'), | |
cluster = require('cluster'), | |
net = require('net'), | |
sio = require('socket.io'), | |
sio_redis = require('socket.io-redis'); | |
var port = 3000, | |
num_processes = require('os').cpus().length; | |
if (cluster.isMaster) { |