Skip to content

Instantly share code, notes, and snippets.

View tippenein's full-sized avatar

Brady Ouren tippenein

  • Los Angeles, CA
  • 17:10 (UTC -07:00)
View GitHub Profile
@tippenein
tippenein / blasphemy.hs
Last active April 22, 2016 20:56
if you can't leave your precious OO mindset
(.) :: a -> (a -> b) -> b
a . f = f a
infixl 9 .
main =
let g = [1,2,3,4].zip([10,20,30,40])
in
g.show.putStrLn
-- > [(10,1),(20,2),(30,3),(40,4)]
@tippenein
tippenein / credit.hs
Created April 8, 2016 02:10
simple amortization dsl
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Concurrent.MVar
import Numeric
-- A = P * (r (1+r) ^ n)
-- (1+r)^n - 1
-- p = principal amount borrowed
-- r = periodic interest rate / 100
@tippenein
tippenein / parser.hs
Created April 7, 2016 01:59
a parser for transunion ffr
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Parser where
import System.IO.Unsafe (unsafePerformIO)
import Text.Parsec
import Csv
require 'singleton'
require 'benchmark/ips'
class StringIntern
include ::Singleton
@@hash = {}
def self.intern(str)
@@hash[str] = str.to_sym
end
data Person = Person {
_name :: String
} deriving (Eq, Show, Generic, ToJSON)
data Event = Event {
_personId :: Int64
, _type :: String
, _happenedOn :: UTCTime
} deriving (Eq, Show, Generic, ToJSON)
### Keybase proof
I hereby claim:
* I am tippenein on github.
* I am tippenein (https://keybase.io/tippenein) on keybase.
* I have a public key whose fingerprint is D37A 1824 EA7D D444 B9AF 586D 81A6 054C 1F5D 413F
To claim this, I am signing this object:
-- A cell C is represented by a 1 when alive or 0 when dead, in an m-by-m square
-- array of cells. We calculate N - the sum of live cells in C's eight-location
-- neighbourhood, then cell C is alive or dead in the next generation based on the
-- following table:
-- C N new C
-- 1 0,1 -> 0 # Lonely
-- 1 4,5,6,7,8 -> 0 # Overcrowded
-- 1 2,3 -> 1 # Lives
-- 0 3 -> 1 # It takes three to give birth!
[user]
name = brady.ouren
email = brady.ouren@gmail.com
[color]
diff = auto
status = auto
branch = auto
ui = auto
@tippenein
tippenein / Main.hs
Last active April 9, 2016 22:13
a servant user client
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeOperators #-}
module Main where
import Control.Applicative
@tippenein
tippenein / numbers.rb
Created November 13, 2015 19:14
example implementation of trivial math object
# implement this functionality
# you can assume it only needs to work on
# numbers 1-3 and operators + and -
#
# one.plus.two.minus.three
# should return 0
#
#
# example implementation