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
# Requires the following songs to be in the same directory as this file: | |
# phoenix.1901.mp3 | |
# tokyo.police.club.wait.up.mp3 | |
# sufjan.stevens.too.much.mp3 | |
# the.naked.and.the.famous.young.blood.mp3 | |
# far.from.home.tiga.mp3 | |
# the.cults.abducted.mp3 | |
# phoenix.consolation.prizes.mp3 | |
# You can download these files from http://loganhasson.com/ruby/supporting/audio/jukebox2.0.audio.zip | |
# The files must be in the same level as the .rb file, not within their own directory |
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
until Time.now.hour == 20 && Time.now.min == 59 && Time.now.wday == 0 | |
sleep(30) | |
end | |
system("say Its time for Homeland.") |
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
# Soon-to-be way better version. |
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
# Rules: | |
## Any live cell with fewer than two live neighbours dies, as if caused by under-population. | |
## Any live cell with two or three live neighbours lives on to the next generation. | |
## Any live cell with more than three live neighbours dies, as if by overcrowding. | |
## Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. | |
require 'colorize' | |
init_array = [] |
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
function cdir () { | |
mkdir $1 > /dev/null | |
cd $1 | |
} |
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 help_me | |
system("clear") | |
puts "Check it out...this is how I work:" | |
puts "Press 'help' to get some help. (But you already knew that.)" | |
puts "Press 'play' to play a song." | |
puts "Press 'list' to see what you can play." | |
puts "Press 'exit' to quit." | |
puts "Enter to continue..." | |
input = gets.chomp | |
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
# Download this file: | |
# https://gist.github.com/scottcreynolds/ac1b5c8d96de0c91bf7c/download | |
# Run it from your terminal with: | |
# ruby ruby_phone_format.rb | |
# (Just make sure you are in the right directory) | |
# ====================================== | |
# Ignore All This Code | |
# ====================================== |
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 String | |
def punct | |
marks = "" | |
regex = "^\\w\\s\\-" | |
# but this part does | |
self.each_char do |c| | |
marks += c[eval("/[#{regex}]/")] if c[eval("/[#{regex}]/")] != nil | |
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
## 1. Write a method that returns whether a given letter is a vowel, using `if` and `elsif` | |
def one(letter) | |
if letter == "a" | |
true | |
elsif letter == "e" | |
true | |
elsif letter == "i" | |
true | |
elsif letter == "o" |
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 create_badge(*names) | |
badge_array = [] | |
names.each { |name| badge_array << "Hello, my name is #{name}." } | |
badge_array | |
end | |
def get_rooms(list) | |
rooms = [1, 2, 3, 4, 5, 6, 7] | |
room_assignments = [] |