Skip to content

Instantly share code, notes, and snippets.

View InPermutation's full-sized avatar

Jacob Krall InPermutation

View GitHub Profile
@InPermutation
InPermutation / stack_edsl.cs
Last active August 29, 2015 13:57 — forked from brendanzab/stack_edsl.rs
A statically typed, concatenative EDSL in C#.
/// <summary>Used to enforce type nesting</summary>
public interface HList { }
public class Empty : HList { }
public class Stack<T, TChild> : HList where TChild : HList
{
public T Item { get; private set; }
public TChild Child { get; private set; }
@InPermutation
InPermutation / gist:1257730
Created October 2, 2011 18:24 — forked from jcbozonier/gist:1257652
Aggregating the scores by lol and associating with the name of the user who created it.
var aggregate_scores_by_lol = function(votes, lols, users){
var vote_count = lols.reduce(function(p,lol,i,r){ return p[lol.id] = 0, p; }, {});
var lol_dictionary = lols.reduce(function(p,lol,i,r){ return p[lol.id] = lol, p}, {});
votes.forEach(function(vote){ vote_count[vote.lol_id]++; });
var vote_count_keys = vote_count.map(function(el,ix){ return ix;});
var sorted_lol_ids = vote_count_keys.sort(function(a, b){
return vote_count[b] - vote_count[a];