Skip to content

Instantly share code, notes, and snippets.

function build_hierarchy(list, key, tuple_func) {
var direct_hierarchy = list
.map(tuple_func)
.reduce(function(obj, tuple) {
tuple[0] in obj ? obj[tuple[0]].push(tuple[1]) : obj[tuple[0]] = [tuple[1]];
return obj;
}, {});
var hierarchy = Object.keys(direct_hierarchy)
.reduce(function(obj, type) {
public class AccessBenchmark {
private final long N = 1000000000;
private static final int M = 1;
private LocalClass instanceVar;
private class LocalClass {
public void someFunc() {}
}
@jcla1
jcla1 / maybe.py
Created May 18, 2014 14:56 — forked from senko/maybe.py
# maybe.py - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@jcla1
jcla1 / activityLog.hs
Created July 4, 2014 21:27
Haskell activity log script
import Data.Function (on)
import Data.List (sort, sortBy, groupBy, nub)
import Data.List.Utils (replace)
import Data.Ord (comparing)
import Data.Either (rights)
import Control.Monad (liftM)
import System.Environment (getArgs)
import Text.Parsec.Error (ParseError)
@jcla1
jcla1 / springer-free-maths-books.md
Created December 28, 2015 17:48 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links