Skip to content

Instantly share code, notes, and snippets.

@nbar1
nbar1 / socks.js
Created March 2, 2015 02:49
socks.js
function wash(socks) {
var socksYouHave = [];
var sockSizes = ['small', 'medium', 'large'];
socks.forEach(function(sock) {
// Weird socks never survive
if(sockSizes.indexOf(sock) === -1) return;
// One in ten socks never make it out alive
if(Math.floor(Math.random() * 10) === 0) return;
@nachocab
nachocab / genes.csv
Created May 20, 2012 22:16
D3 heatmap using Backbone.js and CoffeeScript
gene_name lassa_day_0 lassa_day_3 lassa_day_6 lassa_day_8 lassa_day_10 lassa_day_12 marburg_day_0 marburg_day_1 marburg_day_3 marburg_day_5 marburg_day_7 marburg_day_9 ebola2_day_0 ebola2_day_1 ebola2_day_3 ebola2_day_4 ebola2_day_5 ebola2_day_6 ebola2_day_7 ebola2_day_8 lcmv_day_1 lcmv_day_2 lcmv_day_3 lcmv_day_4 lcmv_day_6 lcmv_day_7
GENE_1 0 0.685 1.047 1.020 0.957 8e-01 0 -0.855 -1e+00 -1.546 -1.359 -1.077 0 -6e-01 -0.219 1.295 0.923 1.216 1e+00 1.632 0.550218483523337 -0.117805570597282 0.0732205574710542 -0.564914153485835 -0.359415199104997 0.00898927502093986
GENE_2 0 2.459 3.299 3.086 2.658 3e+00 0 0.193 9e-01 1.433 1.246 1.091 0 -1e-01 0.392 2.142 2.734 3.863 4e+00 4.216 -0.0754593963815329 0.0967734690139892 0.28316769523287 -0.412279746153753 -0.324753442770228 0.288227993676913
GENE_3 0 0.121 2.131 1.628 1.561 1e+00 0 -0.939 -1e+00 -1.544 -1.632 -1.055 0 2e-02 -0.049 0.008 0.393 1.031 3e-01 0.324 0.0499325227230727 -0.0397401531526083 0.2124328794823 0.0731657480808578 0.0189570855935306 -0.01848
@balupton
balupton / README.md
Last active October 11, 2015 23:48
DocPad: Absolute URL Helper

DocPad: Absolute URL Helper

Uses a docpad configuration file to specify template data that we can use in our document to generate absolute urls.

@pilwon
pilwon / code.js
Last active October 13, 2015 04:13
react-native DependencyResolver perf test (script & full result) https://github.com/facebook/react-native/issues/361#issuecomment-87829808
var path = require('path');
var async = require('async');
var mathjs = require('mathjs');
var ReactPackager = require('react-native/packager/react-packager');
var blacklist = require('react-native/packager/blacklist');
var reactNativePackage = require('react-native/package');
var NUM_TESTS = 100;
function test() {
@ryanburgess
ryanburgess / README.md
Last active October 19, 2015 09:58
Determines whether or not the given browser supports SVG

If SVG

Is a simple JavaScript module that determines whether or not the given browser supports SVG.

Install

npm install if-svg --save-dev
@Hypercubed
Hypercubed / .gitignore
Last active December 11, 2015 08:45
plotly-jspm
jspm_packages
@espadrine
espadrine / tokenizer.js
Last active February 23, 2016 01:51
Raw tokenizer taken from Esprima.
/*
Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be>
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
@zachlysobey
zachlysobey / ng-directive-inline-multi-line-template-string.es6.js
Last active March 3, 2016 11:17
Angular 1 Directive with ES6 Multi-line string template inline.
(function() {
'use strict';
angular
.module('myModule')
.directive('myDirective', myDirective);
const template = `
<div class="my-directive-template">
<h1>Using multi-line Strings for templates</h1>
@matthewp
matthewp / programming-language.md
Last active March 28, 2016 07:19
programming-language.md

Motivation

Writing JavaScript libraries that are stable is hard, too hard. The extreme level of modularity we practice has only made things worse, as it's become very easy to depend on quirks/bugs that exist in other libraries.

The approach that is most often taken to increase stability in a programming language is to introduce Types. That is, trade expressiveness for better static reasoning. The point being, the compiler should be able to find bugs in your program.

I'm interested in another approach; make it easier for the developer to find bugs themselves. To that end, the motivation for this language is to be easy to test. What if everything within a programs closure was available to be mocked.

exports.getName = function(person){
@ocolot
ocolot / url_shortener.coffee
Created July 23, 2013 12:50
Url Shortener (AngularJS service using Google UrlShortener API)
angular.module('AppServices')
.factory 'UrlShortener', ($q, $rootScope) ->
gapiKey = 'APP_KEY'
gapi_deferred = $q.defer()
gapi_loaded = gapi_deferred.promise
gapi.client.setApiKey(gapiKey)
gapi.client.load 'urlshortener', 'v1', ->
$rootScope.$apply ->
gapi_deferred.resolve('loaded')