Skip to content

Instantly share code, notes, and snippets.

@shangaslammi
shangaslammi / concatenative.hs
Created February 17, 2012 06:01
Concatenative Programming in Haskell
{-# LANGUAGE TypeOperators, NoImplicitPrelude #-}
import qualified Data.List as L
import Control.Arrow
import Control.Monad
import Prelude (Bool, Int, Float, fst, snd, flip, ($), uncurry, Show(..), String, (.), otherwise, IO)
import qualified Prelude as P
data s :. a = !s :. !a
infixl 1 :.
@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
@jboner
jboner / latency.txt
Last active April 19, 2024 23:08
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@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.

@shancarter
shancarter / .block
Last active November 28, 2019 02:01
Mister Nester
license: mit
height: 700
@jaredwilli
jaredwilli / todoCtrl.js
Created April 27, 2013 08:30
todoFactor and TodoCtrl modules for the angularFire TodoMVC example to show an alternative example for using angularFireCollection to sync data with a Firebase by using a Factory to do so. https://github.com/firebase/angularFire/issues/24
'use strict';
todomvc.controller('TodoCtrl', [ '$scope', 'todoFactory', 'filterFilter',
function OtherCtrl($scope, todoFactory, filterFilter) {
$scope.todos = todoFactory.getAllTodos('todos');
$scope.newTodo = '';
$scope.editedTodo = '';
$scope.addTodo = function() {
todoFactory.addTodo($scope.newTodo);
};
$scope.editTodo = function(todo) {
@thebinarypenguin
thebinarypenguin / DiceRoller.js
Created June 19, 2013 01:27
A dice roller library for javascript
/*
* A virtual dice roller that accepts standard dice notation
*
*
* Dice Notation
*
* [Num Dice] d <Num Sides> [Modifier]
*
*
* Num Dice - Number of dice to roll (optional)
@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')
@caged
caged / d3-server.js
Last active October 17, 2023 04:05
Directly render and serve d3 visualizations from a nodejs server.
// Start `node d3-server.js`
// Then visit http://localhost:1337/
//
var d3 = require('d3'),
http = require('http')
http.createServer(function (req, res) {
// Chrome automatically sends a requests for favicons
// Looks like https://code.google.com/p/chromium/issues/detail?id=39402 isn't
// fixed or this is a regression.
@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>