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
# irb...
# Numbers
3 + 2
# Strings
puts "Hi, everybody!"
# Booleans
true
false
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"
@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
@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 / 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 / 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 / HelloGoodbye.j
Created September 4, 2008 19:09
Hello/Goodbye in Cappuccino
import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
CPTextField label;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
#ALL HAILZ THE TRV DVRK EMPORER
#THEBIRDCAGETHEATER
require 'ruby-processing'
require 'boids'
class HailHail < Processing::App
attr_reader :blackout
# And what shall He look like?
#IRB Funone
def hacked_computer
(1000 * 100).times do
puts "Preparing hard drive for reformat"
end
end
def ruin_computer
(1000 * 100).times do
for i in 1..100;if i%15==0;print"FizzBuzz";elsif i%5==0;print"Buzz";elsif i%3==0;print"Fizz";else;print i;end;print "\n";end