This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_total(cards) | |
array = cards.map {|e| e[1]} | |
total = 0 | |
array.each do |value| | |
if value == "Ace" | |
total += 11 | |
elsif value == "Jack" || value == "Queen" || value == "King" | |
total += 10 | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'io/console' | |
def read_char | |
STDIN.echo = false | |
STDIN.raw! | |
input = STDIN.getc.chr | |
if input == "\e" then | |
input << STDIN.read_nonblock(3) rescue nil | |
input << STDIN.read_nonblock(2) rescue nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Robot | |
attr_reader :directions | |
def initialize | |
@directions = [:north, :east, :south, :west] | |
end | |
def orient(direction) | |
if invalid_direction? direction | |
raise ArgumentError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#rc() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tpope/vim-unimpaired' | |
Plugin 'tpope/vim-repeat' | |
Plugin 'flazz/vim-colorschemes' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
adapter: postgresql | |
encoding: unicode | |
database: myflix_dev | |
pool: 5 | |
username: falon | |
password: 3141-5926-5359 | |
test: | |
adapter: postgresql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Board | |
def self.transform(board) | |
@rows = [] | |
explode_rows(board) | |
validate_rows | |
process_rows | |
reform_rows | |
end | |
def self.validate_rows |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
if has("autocmd") | |
filetype indent plugin on | |
endif | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#rc() | |
set tags+=gems.tags |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
group :development do | |
gem 'guard' | |
gem 'guard-minitest' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard :minitest do | |
watch(%r{^(.*)\/?test_(.*)\.rb$}) | |
watch(%r{^(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" } | |
watch(%r{^test_helper\.rb$}) { 'test' } | |
end |