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 Die | |
def initialize | |
roll | |
end | |
def roll | |
@numberShowing = 1 + rand(6) | |
end | |
def showing |
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 Cigs | |
def initialize(brand = "Cigarettes") | |
@brand = brand | |
end | |
def light | |
puts "I'm lighting up a #{@brand}." | |
end | |
def smoke | |
puts "#{@brand} tastes great!" | |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'sqlite3' | |
require 'active_record' | |
require 'active_support' | |
ActiveRecord::Base.establish_connection( | |
:adapter => "sqlite3", |
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 | |
set number | |
set ruler | |
syntax on | |
" Set encoding | |
set encoding=utf-8 | |
" Whitespace stuff |
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
if has("gui_macvim") | |
" Fullscreen takes up entire screen | |
set fuoptions=maxhorz,maxvert | |
" Command-T for CommandT | |
macmenu &File.New\ Tab key=<D-T> | |
map <D-t> :CommandT<CR> | |
imap <D-t> <Esc>:CommandT<CR> | |
" Command-Return for fullscreen |
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
questions = [ | |
'How spontaneous of a traveler are you?', | |
'Do you drink alcohol?', | |
'Do you smoke cigarettes?', | |
'Do you like to know how things work?', | |
'I always like to try new things:', | |
'How religious are you?', | |
'In general, it is important to follow the rules:', | |
'Are you sensitive to others\' needs?' | |
] |
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 User < ActiveRecord::Base | |
has_many :events | |
has_many :ratings | |
has_many :messages | |
belongs_to :profile | |
def self.create_with_omniauth(auth) | |
create! do |user| | |
user.provider = auth["provider"] | |
user.uid = auth["uid"] |
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
Tourious::Application.configure do | |
# Settings specified here will take precedence over those in config/application.rb | |
TWITTER_KEY = 'Development Keys' | |
TWITTER_SECRET = 'Development Secret' | |
FACEBOOK_KEY = 'Development Keys' | |
FACEBOOK_SECRET = 'Development Secret' | |
# In the development environment your application's code is reloaded on | |
# every request. This slows down response time but is perfect for development |
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
found = false | |
(1..1E3).each { |x| | |
(1..1E3).each { |y| | |
puts "a = #{x}, b = #{y}, c = #{1000 - x - y}, product = #{x * y * (1000 - x - y)}" | |
found = true if x ** 2 + y ** 2 == (1000 - x - y) ** 2 | |
break if found | |
} | |
break if found | |
} |
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
grid_string = <<EOS | |
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 | |
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 | |
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 | |
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91 | |
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80 | |
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50 | |
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70 | |
67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21 | |
24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72 |
OlderNewer