Skip to content

Instantly share code, notes, and snippets.

@andrewhouse
andrewhouse / template.rb
Last active August 29, 2015 14:05
Template for a New Rails App
def source_paths
Array(super) +
[File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]
end
gsub_file "Gemfile", /^gem\s+["']sqlite3["'].*$/,''
gsub_file "Gemfile", /^gem\s+["']turbolinks["'].*$/,''
gsub_file "Gemfile", /^gem\s+["']spring["'].*$/,''
gem 'haml-rails'
def hypotenuse side1, side2
Math.sqrt(side1**2 + side2**2).to_f
end
# Mostly, symbols have that don't allow much change. Symbols are meant to be
# constant and have little to no variation.
# While strings have the flexibility to be manipulated and changed at will.
# Strings have many destructive menthods such as delete, gsub, and split
@andrewhouse
andrewhouse / 0.2.1-boggle_class_from_methods.rb
Last active January 2, 2016 01:49 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
def initialize(board)
@board = board
end
def create_word(*coords)
coords.map { |coord| @board[coord.first][coord.last]}.join("")
end
def get_row(row)