Skip to content

Instantly share code, notes, and snippets.

@kolodny
kolodny / .minttyrc
Created October 6, 2016 22:54
.minttyrc solarized with zsh-autosuggestions
Font=Inconsolata for Powerline
FontHeight=12
Transparency=off
CursorType=line
ForegroundColour=131,148,150
BackgroundColour=0,43,54
CursorColour=220,50,47
Black=7,54,66
BoldBlack=30,73,84
Red=220,50,47
@kolodny
kolodny / index.js
Created May 2, 2016 00:23
array opt in micro optimization plugin
// in
const a = ['x', 'y', 'z'];
const b = a.map(c => c + c);
const c = a.reduce((acc, c) => acc + c, '');
a.forEach(c => console.log(c));
a.forEach(console.log);
// out
const a = ['x', 'y', 'z'];
@kolodny
kolodny / link.txt
Created April 26, 2016 03:14
self hosting webpage
@kolodny
kolodny / mocha-clone.js
Last active April 20, 2016 14:17
mocha clone
var Global = typeof global === 'object' ?
global :
typeof window === 'object' ?
window :
typeof self === 'object' ?
self :
{};
var Promise = Global.Promise || require('bluebird');
var exports = typeof module === 'object' ? module.exports : {};
@kolodny
kolodny / git-review.sh
Created February 16, 2016 16:14
check out a pull request locally
#!/bin/sh
id=$1
branch=$2
branch="${branch:-pr-$id}"
git fetch origin pull/$id/head:$branch
git checkout $branch
import {renderToStaticMarkup} from 'react-dom/server';
import {html as beautifyHTML} from 'js-beautify';
import {diffWords} from 'diff';
import chalk from 'chalk';
import {fail} from 'assert';
const colors = new chalk.constructor({
enabled: !!global.top.karma
});
@kolodny
kolodny / index.js
Last active January 28, 2016 03:08
import deact from 'https://wzrd.in/standalone/deact';
const sayHi = () => console.log('hi');
const firstName = 'Moshe';
const lastName = 'Kolodny';
const todos = [ 'make todos list', 'something else?' ];
const domElement = deact`
<div>
<h1>Hello ${firstName} ${lastName}</h1>
@kolodny
kolodny / index.js
Last active January 11, 2016 18:19
import update from 'react-addons-update';
global.update = update;
@kolodny
kolodny / proxy.js
Created January 4, 2016 02:23 — forked from cmawhorter/proxy.js
Node script to forward all http requests to another server and return the response with an access-control-allow-origin header. Follows redirects.
// Simple proxy/forwarding server for when you don't want to have to add CORS during development.
// Usage: node proxy.js
// Open browser and navigate to http://localhost:9100/[url]
// Example: http://localhost:9100/http://www.google.com
// This is *NOT* for anything outside local development. It has zero error handling among other glaring problems.
// This started as code I grabbed from this SO question: http://stackoverflow.com/a/13472952/670023
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import assert from 'assert';
function render(jsx) {
return ReactDOMServer.renderToStaticMarkup(jsx);
}
function assertEqual(actual, expected) {
assert.equal(render(actual), render(expected));