Skip to content

Instantly share code, notes, and snippets.

View falonofthetower's full-sized avatar

Peter Karth falonofthetower

  • CompanyCam
  • Sanford, NC
View GitHub Profile
@falonofthetower
falonofthetower / 0_reuse_code.js
Last active September 10, 2015 16:59
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
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
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
class Robot
attr_reader :directions
def initialize
@directions = [:north, :east, :south, :west]
end
def orient(direction)
if invalid_direction? direction
raise ArgumentError
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'
development:
adapter: postgresql
encoding: unicode
database: myflix_dev
pool: 5
username: falon
password: 3141-5926-5359
test:
adapter: postgresql
class Board
def self.transform(board)
@rows = []
explode_rows(board)
validate_rows
process_rows
reform_rows
end
def self.validate_rows
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
source 'https://rubygems.org'
group :development do
gem 'guard'
gem 'guard-minitest'
end
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