Skip to content

Instantly share code, notes, and snippets.

View johana-star's full-sized avatar
🕶️

Johana Star johana-star

🕶️
View GitHub Profile
# No two days are alike
# Except the first and fifteenth, pretty much.
# "December 4th", Jay-Z
last = Date.new(2013, 06, -1)
first = Date.new(2013, 06, 1)
month = (first..last).map { |day| OpenStruct.new date: day, pay_day: false }
[month[0], month[14]].each { |day| day.pay_day = true }
month.reject { |day| day.pay_day == false }

Mailers

- Action Mailer
  http://guides.rubyonrails.org/action_mailer_basics.html
  http://railscasts.com/episodes/206-action-mailer-in-rails-3

Chef and Puppet

- Chef
  http://gettingstartedwithchef.com/
  http://foodfightshow.org/ - awesome podcast
  http://railscasts.com/episodes?utf8=%E2%9C%93&search=puppet

https://peepcode.com/products/chef-i

class Worker
def self.work(number = 1, &job)
result = nil
number.times { result = job.call }
result
end
end
class Timer
def self.time_code(number = 1)
start_time = Time.now
number.times { yield }
end_time = Time.now
(end_time - start_time) / number.to_f
end
end
require "pry"
desc "List the members of a class"
task :print_roster do
roster = File.open("roster.txt").map { |line| line.chomp }
roster.each { |student| puts student }
end
desc "Create a class directory"
task :create_class_dir do
unless Dir['*'].include? "class"
@johana-star
johana-star / gist:5807599
Created June 18, 2013 17:42
pig_latin.rb
require "pry"
module PigLatinTranslator
def translate(string)
string.split(" ").map { |word| translate_word(word) }.join(" ")
end
def translate_word(word)
if word.match(/\bqu/)
word[2..-1] + "quay"

What's the name of your app?

Household Gizmo

Fitgrapher (just developed this for fun on Sunday, but also demonstrates competency in Rails)

What does it do?

Household Gizmo is a house communication and expense calculation app.

desc "read names"
task :read_names do
@names = File.readlines "names"
@names.each do |name|
puts name
end
end
desc "make class directory"
task :make_class_dir do