Skip to content

Instantly share code, notes, and snippets.

//1. FizzBuzz
function fizzBuzz(number) {
var buzz = number % 5 === 0, fizz = number % 3 === 0;
if (fizz && buzz) return "fizzbuzz";
else if (buzz) return "buzz";
else if (fizz) return "fizz";
else return String(number);
};
//2. onClickList
class Http_Response
attr_reader :version, :status_code, :reason_phrase, :content_type, :body
def intialize(args)
@version = args.fetch(:version)
@status_code = args.fetch(:status_code)
@reason_phrase = args.fetch(:reason_phrase)
@content_type = args.fetch(:content_type)
@body = args.fetch(:body)
end
@mcardacci
mcardacci / gist:7c35a5b32f6f9708be93
Created April 12, 2015 23:46
A Queue-like data structure built in ruby
class Queue
attr_reader :store
def initialize
@store = []
end
def enqueue(x)
store.push(x)
end
@mcardacci
mcardacci / The Queue
Created April 12, 2015 23:42
A Queue-like data structure built in ruby
class Queue
attr_reader :store
def initialize
@store = []
end
def enqueue(x)
store.push(x)
end