Skip to content

Instantly share code, notes, and snippets.

View practicingruby's full-sized avatar

Gregory Brown practicingruby

View GitHub Profile
class Application
def initialize
@commands = {}
end
def command(name, &callback)
@commands[name] = callback
end
def run(name)
class Node
Path = Struct.new(:probability, :destination)
def initialize(name)
@name = name
@paths = []
end
attr_reader :name
class Board
def self.from_file(filename)
board = new
File.open(filename) do |file|
line = file.gets.strip
board.add_territories(line.split(","))
file.each_line do |line|
territory = line.strip
borders = file.gets.strip.split(",")
module ExpenseTracker
Environment = Object.new
class << Environment
def configure
@configuration = yield Configuration.new
end
attr_reader :configuration
end
end
class Throttler
def initialize(delay)
self.delay = delay
self.timestamp = Time.now
end
def execute(&callback)
elapsed = Time.now - timestamp
sleep(delay - elapsed) if elapsed < delay
Thank you for your hard work and dedication throughout the core
skills course. I'm very happy to have you join our community.
Only one thing is left for you to do: we are now asking for new
alumni to write introduction letters BEFORE we give them access
to our various community resources.
Please send an email to gregory.t.brown@gmail.com with a
section about yourself, a section about the projects/exercises
you worked on during your session, and a section on your experiences

Continued from Results from the January 2012 Core Skills Course, by Gregory Brown

For our integration exercise we had students build multi-user email based applications. All ten students who completed the course worked on this exercise, and we ended up with everything from an email-based wiki to a system for sharing funny stories and jokes.

For our academic exercise, we asked students to make use of Markov Chains to do something interested. Seven of our students participated in this exercise, and we ended up all sorts of cool results, including a jazz chart generator and a tool which predicts movements in currency exchange rates.

For our [modeling e

require_relative "../lib/postal_service"
require_relative "config"
list_members = []
PostalService.run(CONFIGURATION_DATA) do |incoming, outgoing|
if incoming.to.any? { |e| e[/\+subscribe@#{CONFIGURATION_DATA[:domain]}/] }
if list_members.include?(incoming.from)
outgoing.subject = "ERROR: Already subscribed"
outgoing.body = "You are already subscribed, you can't subscribe again"
require_relative "../lib/postal_service"
require_relative "config"
mailing_list = PostalService::MailingList.new("simple_mailing_list.store")
PostalService.run(CONFIGURATION_DATA) do |incoming, outgoing|
from_address = sender(incoming)
case incoming
when filter(:to, /\+subscribe@#{CONFIGURATION_DATA[:domain]}/)
require_relative "../lib/postal_service"
list = PostalService::MailingList.new("db/lists/simple_mailing_list.store")
app = PostalService::Application.new do
to(:tag, "subscribe") do
if list.subscriber?(sender)
respond :subject => "ERROR: Already subscribed",
:body => template("subscribe-error")