Skip to content

Instantly share code, notes, and snippets.

View jam-tmrw's full-sized avatar

James Hamilton jam-tmrw

  • Webpass.net
  • San Francisco
View GitHub Profile
@jam-tmrw
jam-tmrw / second_highest.rb
Last active December 16, 2015 20:29
Second Highest
#refactored to handle negative numbers and duplicates
def second_highest( numbers )
if numbers[0] > numbers[1]
highest, second_highest = numbers.shift, numbers.shift
else
second_highest, highest = numbers.shift, numbers.shift
end
second_highest = numbers.shift if highest == second_highest
class Model
attr_reader :deck, :size
def initialize(doc)
@doc = doc
@input = input
@deck = []
@size = 0
end
@jam-tmrw
jam-tmrw / gist:4983353
Created February 19, 2013 05:31
Tips and tricks - Command Line & Sublime
Command Line:
Use the up and down keys to scroll through commands that you've recently used.
Use Ctrl-A to go to the beginning of the line
Use cd ~ to get back to the root file
Sublime:
Use Cmnd-B to build right in the editor (Note: use this for syntax only because it doesn't run 1.9).
Use Cmnd-P to find just about anything in sublime including variable and methods.
Use the file structure tab on the right when you want to navigate through the treee.