Skip to content

Instantly share code, notes, and snippets.

@zerokarmaleft
zerokarmaleft / Monoid.hs
Last active August 29, 2015 14:02 — forked from puffnfresh/Monoid.rs
Semigroups and Monoids
class Semigroup a where
mappend :: a -> a -> a
class Semigroup a => Monoid a where
mempty :: a
mconcat :: [a] -> a
mconcat = foldr mappend mempty
instance Semigroup Int where
@zerokarmaleft
zerokarmaleft / medicat.rb
Last active December 14, 2015 06:39 — forked from laod/medicat.rb
map = [
#general
{name: "Patient Control ID", value: nil},
{name: "SSN", value: nil},
{name: "Other ID", source: :ldap, source_name: "datatelid"},
{name: "Last Name", source: :ldap, source_name: "sn"},
{name: "First Name", source: :ldap, source_name: "givenName"},
{name: "Middle Initial", source: :ldap, source_name: "initials", mapper: Proc.new {|v| v[0]}},
{name: "Sex", source_name: "gender", source: :ods},
{name: "Address", source: :ods, source_name: ["home_address_line_1","home_address_line_2"], mapper: Proc.new{|v| v.join " "}},
@zerokarmaleft
zerokarmaleft / lisp_ch1.clj
Created August 16, 2012 23:19 — forked from fogus/lisp_ch1.clj
Chapter 1 from Lisp in Small Pieces
(ns lisp-ch1)
(def self-evaluating?
(some-fn number? string? char?
true? false? vector?))
(defn -atom? [s]
(or (self-evaluating? s)
(symbol? s)))
@zerokarmaleft
zerokarmaleft / gist:3234714
Created August 2, 2012 07:09 — forked from swannodette/gist:3217582
sudoku_compact.clj
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
(defn init [vars hints]
@zerokarmaleft
zerokarmaleft / gist:1410689
Created November 30, 2011 20:31 — forked from buddylindsey/gist:1410596
Max-Heap
#include <iostream>
#include <stdlib.h>
#include <limits.h>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
ofstream outfile;