Skip to content

Instantly share code, notes, and snippets.

@marksim
marksim / keybase.md
Created March 3, 2016 17:06
Keybase

Keybase proof

I hereby claim:

  • I am marksim on github.
  • I am marksim (https://keybase.io/marksim) on keybase.
  • I have a public key whose fingerprint is 351B AEFF 19E6 F01A 283F E0E6 FB4A 9F3A 2F2C B718

To claim this, I am signing this object:

require 'rspec'
require 'date'
class EmploymentEvent < Struct.new(:date, :status)
def <=> (b)
date <=> b.date
end
def as_start
date + 1

Github Questions

Q1:

Knowing what you know about GitHub, how would you design the high level infrastructure for github.com? What sequence of steps would happen when loading http://www.github.com in a browser? Don't worry about describing the specific libraries and services that handle each step.

A1:

Assumptions

Well, let's start with a few assumptions so we're on the same page:

require 'rspec'
def next_server_number(server_numbers)
server_numbers.sort.each.with_index do |s, i|
return i+1 if s > i+1
end
return server_numbers.count + 1
end
describe 'next_server_number' do
#!/usr/bin/ruby
version = ARGV.first
if version
releases = `heroku releases -n 50 --remote=production | grep Deploy | grep -A1 #{ARGV.first}`
commits = releases.split("\n").reverse.map {|r| r.split(/\s/)[3] }.join('..')
command = 'git log --pretty=format:"%h - %an, %ar : %s" ' + commits
puts `#{command}`
else
puts "A version is required: ex: release_notes v191"
xcode-select --install
# homebrew / cask / util
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew doctor
brew tap phinze/homebrew-cask
brew install brew-cask
brew cask install alfred
brew cask install iterm2
@marksim
marksim / .powenv
Last active January 4, 2016 17:39
Pow Config
# Automatically exports all variables in .env files
export $(cat .env)
require 'rspec'
class GameOfLife
def initialize(generation)
@generation = generation
end
attr_reader :generation
def is_alive?(x, y)
require 'rspec'
class TicTacToe
attr_reader :current_player
def initialize
@current_player = 'O'
@plays = {'O' => [], 'X' => []}
end
def play(x,y)
require 'rspec'
require 'set'
class TicTacToe
attr_reader :current_player
def initialize
@current_player = 'O'
@plays = {
'O' => [],