Skip to content

Instantly share code, notes, and snippets.

View supertopher's full-sized avatar

Topher Lubaway supertopher

  • Minneapolis, MN
View GitHub Profile
@supertopher
supertopher / vehicle.rb
Last active December 18, 2015 09:19 — forked from aespaldi/vehicle.rb
class Vehicle
@wheels = 4
def initialize args
@color = args[:color]
end
def drive
@status = :driving
end
@supertopher
supertopher / boggle.rb
Created June 6, 2013 22:53
Call a boggle grid of any size with random dice movement.
class BoggleBoard
# because we wanted to
def initialize (board_size = 4)
@board_size = board_size
shake!
end
def shake!
possible_dice = [
"AAEEGN",
@supertopher
supertopher / large_fibonacci.rb
Last active December 16, 2015 01:49
Large fibonacci check
def is_fibonacci?(i)
require "bigdecimal"
require "bigdecimal/math"
include BigMath
plusfour = 5 * i**2 + 4
minusfour = 5 * i**2 - 4
#second argument is number of decimels for all big num arguments
plusfour = BigDecimal.new(plusfour, 5)
@supertopher
supertopher / posts_controller.rb
Created April 1, 2013 20:25
Quick look at really basic cache
class PostsController < ApplicationController
caches_page :index, :show
def index
#if nothing happens that should affect the cache leave it alone
end
def edit
#in any class that has potentional to change cache