This file contains 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
rails_workspace(){ | |
osascript -e 'tell application "Terminal"' \ | |
-e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \ | |
-e "do script with command \"cd `pwd`;clear;\" in selected tab of the front window" \ | |
-e "do script with command \"rails server\" in selected tab of the front window" \ | |
-e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \ | |
-e "do script with command \"cd `pwd`;clear;\" in selected tab of the front window" \ | |
-e "do script with command \"rails console\" in selected tab of the front window" \ | |
-e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \ | |
-e "do script with command \"cd `pwd`;clear;\" in selected tab of the front window" \ |
This file contains 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
# | |
# Author: Jim Fisher @jimfish | |
# Date: March 7th, 2011 | |
# Description: A simple program to calculate the difference in degrees between two hands on analog clock. This was a puzzle presented to me, so I thought I'd give it a shot in code. | |
# | |
def difference_between_hands_on_an_analog_clock_in_degrees(time) | |
hours = time.strftime("%l").to_f | |
minutes = time.min.to_f | |
hratio = 1/12.0 | |
mratio = 1/60.0 |
This file contains 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
begin | |
# lets define numbers for every letter as A = 1, B = 2, C=3, etc. | |
alphabet_numbers = {} | |
('a'..'z').each_with_index{|x,y| alphabet_numbers[x] = y+1} | |
# lets get a word | |
loop do | |
puts "Please enter a word to convert to a percent (ctrl C to exit):" | |
input = gets.chomp.downcase | |
# lets process the word | |
sum = input.split("").map{|l|alphabet_numbers[l].to_i}.reduce(&:+) |