Skip to content

Instantly share code, notes, and snippets.

@bencooling
bencooling / README.md
Last active December 17, 2015 12:29 — forked from lovasoa/README.md
Javascript: array_intersect function for intersecting many arrays

javascript: array_intersect

Fastest function to intersect a large number of big arrays in javascript, without dependencies

  • The compressed version is only 345 caracters long.
  • Faster than common libraries, even a large number of arrays, or on very big arrays. (See benchmarks)
usage
array_intersect(array1, array2, ..., arrayN)

This is a plugin meant for Jekyll.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

{% youtube oHg5SJYRHA0 %}
@bencooling
bencooling / 0. intro.md
Last active February 8, 2016 00:16 — forked from jquense/0. intro.md
Alternative ways to define react Components

The 0.13.0 improvements to React Components are often framed as "es6 classes" but being able to use the new class syntax isn't really the big change. The main thing of note in 0.13 is that React Components are no longer special objects that need to be created using a specific method (createClass()). One of the benefits of this change is that you can use the es6 class syntax, but also tons of other patterns work as well!

Below are a few examples creating React components that all work as expected using a bunch of JS object creation patterns (https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&%20object%20prototypes/ch4.md#mixins). All of the examples are of stateful components, and so need to delegate to React.Component for setState(), but if you have stateless components each patterns tends to get even simpler. The one major caveat with react components is that you need to assign props and context to the component instance otherwise the component will be static. The reason is

@bencooling
bencooling / GIF-Screencast-OSX.md
Created February 29, 2016 09:59 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@bencooling
bencooling / download-node-nightly.sh
Last active July 5, 2016 05:48
download-node-nightly.sh - simple script to fetch Node.js nightlies on OS X and Linux (x86, x64 & ARM)
#!/bin/sh
# Usage:
# sh download-node-nightly.sh
hasxz=$(which xzcat)
os=$(uname | tr '[A-Z]' '[a-z]')
arch=$(uname -m)
pwd=$(PWD)
@bencooling
bencooling / README.md
Last active July 11, 2016 05:15 — forked from anonymous/index.html
React Redux Bootstrap Thunk Hello WorldReact Redux Bootstrap Thunk Hello World// source http://jsbin.com/bufuxi

Minimal prototype of React, Redux, Redux Thunks +React Bootstrap + Bootstrap Material Design + fetch + jsonplaceholder.