Skip to content

Instantly share code, notes, and snippets.

View tgriesser's full-sized avatar

Tim Griesser tgriesser

View GitHub Profile
<!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>
### 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:
import {Component} from 'react'
import shallowEqual from 'react/lib/shallowEqual'
export function observe(ComposedComponent) {
if (!ComposedComponent.observe) {
return ComposedComponent
}
Object.defineProperty(ComposedComponent.prototype, 'data', {
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));
});
$ 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
// 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);
@tgriesser
tgriesser / gist:db8330e04f27ae5ac077
Created June 27, 2014 20:31
renderComponentToInstance
// 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);
User.where('id', 1).fetch({withRelated: [{'posts': function(qb) {
qb.where('post.status', 'published').limit(10).offset(n);
}}, 'posts.tags']})
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;
bookshelf.Model.find = function(id, options) {
var model = new this();
model.set(this.idAttribute, id);
return model.fetch(options);
};