Skip to content

Instantly share code, notes, and snippets.

View bryanwoods's full-sized avatar
💭
Replacing Security Deposits

Bryan Woods bryanwoods

💭
Replacing Security Deposits
View GitHub Profile
@bryanwoods
bryanwoods / logic_free_fizbuzz.exs
Created July 6, 2015 21:27
Logic free FizzBuzz in Elixir
fizz_word = fn
0, 0, _ -> "FizzBuzz"
0, _, _ -> "Fizz"
_, 0, _ -> "Buz"
_, _, x -> x
end
fizz_buzz = fn n -> fizz_word.(rem(n, 3), rem(n, 5), n) end
Enum.each 1..100, fn(n) -> IO.puts(fizz_buzz.(n)) end
@bryanwoods
bryanwoods / books_2014.txt
Last active August 29, 2015 14:12
My Ten Favorite Books I Read in 2014
My Ten Favorite Books I Read in 2014
Quiet: The Power of Introverts in a World That Can't Stop Talking - Susan Cain
My Brilliant Friend (Honorable mention: The Days of Abandonment) - Elena Ferrante
i will never be beautiful enough to make us beautiful together - Mira Gonzalez
How Should a Person Be? - Sheila Heti
My Struggle: Book 1 (Honorable mentions: Book 2, Book 3)- Karl Ove Knausgaard
Preparation For The Next Life - Atticus Lish
Crapalachia - Scott McClanahan
Citizen: An American Lyric - Claudia Rankine
@bryanwoods
bryanwoods / benchmark.rkt
Created July 16, 2014 18:30
Trying to benchmark an iterative vs recursive solution in Racket Scheme
#lang racket
(define min 0)
(define max 100000000)
(define (recursive-function n)
(if (>= n max)
n
(recursive-function (+ n 1))))
@bryanwoods
bryanwoods / operator.hs
Created May 5, 2014 21:29
x as multiplication operator
x :: Int -> Int -> Int
x other = (* other)
main = (putStrLn . show) (9 `x` 9)
-- 81
In Ruby, your information (or data) can come in different types.
Let's learn about three to start: numbers, booleans, and strings.
Let's set a variable `my_num` to the value 25
my_num = 25
Let's set a variable `my_boolean` to the value true
my_boolean = true
Set `my_string` to "Ruby"
# irb...
# Numbers
3 + 2
# Strings
puts "Hi, everybody!"
# Booleans
true
false
(/
(+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5)))))
(* 3 (- 6 2) (- 2 7)))
(defn square [x]
(* x x))
(defn sum-of-squares [x y]
(+ (square x) (square y)))
import Data.Maybe
-- Lazy evaluation
natNums = [1..]
odds = [1,3..]
evens = [2,4..]
addXAndY :: Integer
addXAndY = sum
where x = 1
@bryanwoods
bryanwoods / favoritebooks.txt
Created December 17, 2013 18:56
My favorite books I read in 2013, alphabetical by author's name
The Verificationist - Donald Antrim
what purpose did i serve in your life - Marie Calloway
The Last Samurai - Helen DeWitt
The White Album - Joan Didion
The Orphan Master's Son - Adam Johnson
Taipei - Tao Lin
The Twelve Tribes of Hattie - Ayana Mathis
The Road - Cormac McCarthy
Swamplandia! - Karen Russell
Journalism - Joe Sacco
@bryanwoods
bryanwoods / s.hs
Last active December 29, 2015 05:19
Feeling lazy
main :: IO()
main = do
putStrLn $ show result
where result = sum $ take 100000 (zipWith (*) [2,4..] [1,3..])