This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(.) :: 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)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
module Parser where | |
import System.IO.Unsafe (unsafePerformIO) | |
import Text.Parsec | |
import Csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'singleton' | |
require 'benchmark/ips' | |
class StringIntern | |
include ::Singleton | |
@@hash = {} | |
def self.intern(str) | |
@@hash[str] = str.to_sym | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Person = Person { | |
_name :: String | |
} deriving (Eq, Show, Generic, ToJSON) | |
data Event = Event { | |
_personId :: Int64 | |
, _type :: String | |
, _happenedOn :: UTCTime | |
} deriving (Eq, Show, Generic, ToJSON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = brady.ouren | |
email = brady.ouren@gmail.com | |
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
ui = auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE DeriveAnyClass #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Main where | |
import Control.Applicative |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |