Skip to content

Instantly share code, notes, and snippets.

@TGOlson
TGOlson / Dockerfile
Created March 26, 2016 02:27
GHC Cross Compiler attempt
# NOTE: Currently not working
# Gets all the way to the final ./configure step and exists with error: Unknown CPU
FROM haskell:7.10.2
RUN apt-get update
WORKDIR /opt/compiler
# Install core dependencies
@TGOlson
TGOlson / baz-types.js
Last active September 26, 2017 16:11
FlowType from Haskell type hack
/* @flow */
export type Baz = {
bar: number;
baz: Array<string>;
};
embed.spotify.com/openspotify/?spuri=spotify:track:2IuWB214OCchhPrBK8OtIR&closedelay=5000
var Path = require('path');
var getRegCommand = function() {
var command = 'reg.exe';
if (process.env.SystemRoot) {
command = Path.join(process.env.SystemRoot, 'System32', command);
}
return command;
}
@TGOlson
TGOlson / MaybeT.hs
Last active December 19, 2015 00:53
MaybeT implementation
module Transformers.MaybeT where
import Control.Applicative
import Control.Monad
import Control.Monad.Trans
data MaybeT m a = MaybeT { runMaybeT :: m (Maybe a) }
@TGOlson
TGOlson / TableStore.js
Last active September 23, 2015 23:51
Utility for simple Flux store definitions
import {ActionTypes} from 'wagon/constant/Constants';
import {makeStoreStrict} from 'wagon/store/store-utils';
// Initial Store Data
const initialData = {
tablePages: {},
};
@TGOlson
TGOlson / notes.js
Created August 14, 2015 05:46
Simple note taker in node
var readline = require('readline');
var fs = require('fs');
var DEFAULT_DIR = '/usr/local/';
var DEFAULT_NOTE_FILE = 'default.notes';
// TODO: make file if it does not exist
var DEFUALT_PATH = makePath(DEFAULT_DIR, DEFAULT_NOTE_FILE);
var commands = {
@TGOlson
TGOlson / primes.js
Created June 29, 2015 01:17
Infinite list of primes with ES6
function* primeGenerator() {
var n = 2;
while(true) {
if(isPrime(n)) {
yield n;
}
n++;
}
@TGOlson
TGOlson / curry.js
Created June 18, 2015 01:13
Currying with JS
function curry(f) {
return curryN(f.length, f);
}
function curryN(n, f) {
return function() {
var args = toArray(arguments);
if (args.length >= n) {
@TGOlson
TGOlson / sorter.hs
Last active August 29, 2015 14:22
Sorter Monoid
module Sorter where
import Data.Monoid
import Data.List
import Data.Ord
data Sorter a = Sorter (a -> a -> Ordering)