$ npm run perf
> [email protected] perf /Users/tgriesser/Github/immutable-js
> node ./resources/bench.js
List > builds from array of 2
Old: 395,950 402,723 409,733 ops/sec
New: 561,242 571,690 582,535 ops/sec
compare: 1 1
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Page Title</title> | |
</head> | |
<body> | |
<img src ="http://d39kbiy71leyho.cloudfront.net/wp-content/uploads/2016/05/09170020/cats-politics-TN.jpg"> | |
</body> | |
</html> |
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
### Keybase proof | |
I hereby claim: | |
* I am tgriesser on github. | |
* I am tgriesser (https://keybase.io/tgriesser) on keybase. | |
* I have a public key whose fingerprint is A2C9 2EC4 1174 BF16 685B CCBF 45C1 AB31 0C04 50B8 | |
To claim this, I am signing this object: |
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
import {Component} from 'react' | |
import shallowEqual from 'react/lib/shallowEqual' | |
export function observe(ComposedComponent) { | |
if (!ComposedComponent.observe) { | |
return ComposedComponent | |
} | |
Object.defineProperty(ComposedComponent.prototype, 'data', { |
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 chunksize = 50; | |
return (function next(items) { | |
if (!items.length) { return; } | |
return knex('sites') | |
.insert(items.slice(0, chunksize)) | |
.then(function () { | |
return next(items.slice(chunksize)); | |
}); |
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
// An object which implements the | |
// IAssociative, ILookup, ICloneable protocols: | |
function MapCursor(data) { | |
this.data = mori.is_map(data) ? data : mori.js_to_clj(data) | |
} | |
MapCursor.prototype = { | |
clone: function() { return new MapCursor(this.data); }, | |
has: function(key) { return mori.has_key(this.data, key); | |
get: function(key, fallback) { | |
var val = mori.get(this.data, key, fallback); |
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
// Added In ReactServerRendering.js | |
function renderComponentToInstance(component) { | |
var transaction; | |
try { | |
var id = ReactInstanceHandles.createReactRootID(); | |
transaction = ReactServerRenderingTransaction.getPooled(false); | |
return transaction.perform(function() { | |
var componentInstance = instantiateReactComponent(component); | |
componentInstance.mountComponent(id, transaction, 0); |
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
User.where('id', 1).fetch({withRelated: [{'posts': function(qb) { | |
qb.where('post.status', 'published').limit(10).offset(n); | |
}}, 'posts.tags']}) |
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 Promise = require("bluebird"); | |
var request = Promise.promisify(require('request')); | |
var knex = require('knex'); | |
var pg = knex({ | |
client: 'pg', | |
connection: connString | |
}); | |
function getUrl(location) { | |
return 'https://maps.googleapis.com/maps/api/geocode/json?address=' + location.address + ', ' + location.city + ', ' + location.state + ' ' + location.zip_code; |
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
bookshelf.Model.find = function(id, options) { | |
var model = new this(); | |
model.set(this.idAttribute, id); | |
return model.fetch(options); | |
}; |