Skip to content

Instantly share code, notes, and snippets.


Kris Williams kriswill

View GitHub Profile
gaearon / index.js
Last active Oct 29, 2020
Breaking out of Redux paradigm to isolate apps
View index.js
import React, { Component } from 'react'
import Subapp from './subapp/Root'
class BigApp extends Component {
render() {
return (
<Subapp />
<Subapp />
<Subapp />
View ast.swift
import Foundation
public func getASTString() -> String {
// get the file path for the file "test.json" in the playground bundle
// let filePath = NSBundle.mainBundle().pathForResource("FirstTtest", ofType: "ast")
// get the contentData
let contentData = NSFileManager.defaultManager().contentsAtPath("a.txt")
bishboria /
Last active Dec 1, 2020
Springer made a bunch of books available for free, these were the direct links
gaearon / slim-redux.js
Last active Dec 4, 2020
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
View slim-redux.js
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
kristopolous / hn_seach.js
Last active Dec 1, 2020
hn job query search
View hn_seach.js
function query() {
// HN is done with very unsemantic classes.
job_list ='.c5a,.cae,.c00,.c9c,.cdd,.c73,.c88')),
query_list =,
shown = 0, total = job_list.length;
// Traverses up the dom stack trying to find a match of a specific class
function up_to(node, klass) {
if (node.classList.contains(klass)) {
tappleby / 0_concept.js
Created Jul 7, 2015
Redux => To web worker
View 0_concept.js
const composedCreateStore = compose(
() => promiseMiddleware,
reu / denodify.js
Last active Jul 11, 2017
Convert any NodeJS async function into a Promise
View denodify.js
module.exports = function denodify(fn) {
return function() {
var self = this;
var args =;
return new Promise(function(resolve, reject) {
args.push(function(error, result) {
error ? reject(error) : resolve(result);
rauchg /
Last active Jun 19, 2017
Writing ES6 today, effectively.

Effective transpiling of ES6

After publishing my article on ECMAScript 6, some have reached out to ask how I exactly I make it all work.

I refrained from including these details on the original post because they're subject to immiment obsoletion. These tools are changing and evolving quickly, and some of these instructions are likely to become outdated in the coming months or even weeks.

The main tool

When evaluating the available transpilers, I decided to use 6to5, which has recently been renamed to Babel. I chose it based on:

kristianmandrup / Converting libraries to Ember CLI
Last active Apr 25, 2020
Guide to Developing Addons and Blueprints for Ember CLI
View Converting libraries to Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

staltz /
Last active Dec 5, 2020
The introduction to Reactive Programming you've been missing
You can’t perform that action at this time.