Skip to content

Instantly share code, notes, and snippets.

Lose It or Lose It's formula to success
Maximum Weekly Reward = week# * $/lb * lb/wk + $5
Actual Weekly Reward = min(MWR, ((start - goal) - (actual - goal))*$/lb) + $5
where
* goal = start - week number * lb/wk
* start = first weigh-in weight
* actual = week's actual weigh-in weight
So, for week 5 of 2-2:
merkin /forge38/clients/extra_credit/rails (master)
r38y $ git checkout -b test-branch
Switched to a new branch 'test-branch'
merkin /forge38/clients/extra_credit/rails (test-branch)
r38y $ ls
Capfile books doc log script test
Rakefile config exports public spec tmp
app db lib randy.tmproj stories vendor
r38y $ rvm ree --debug
+ case "$rvm_action" in
+ rvm-use ree
+ '[' -z '' ']'
+ rvm-select ree
+ rvm_ruby_interpreter=ree
+ rvm_ruby_interpreter=ree
+ '[' '' = 1.8 ']'
+ '[' '' = 1.9 ']'
+ case "$rvm_ruby_interpreter" in
r38y $ rvm use ree
<w> ree 1.8.6 is not installed.
<i> Installing Ruby Enterprise Edition from source to: /Users/r38y/.rvm/ruby-enterprise-1.8.6-20090610
<i> Downloading ruby-enterprise-1.8.6-20090610, this may take a while depending on your connection...
<i> Extracting ruby-enterprise-1.8.6-20090610...
rvm 0.0.24 (2009.08.25) [http://rvm.beginrescueend.com/]
ruby:
interpreter: "ruby"
version: "1.8.6"
date: "2008-08-11"
platform: "universal-darwin9.0"
patchlevel: "2008-08-11 patchlevel 287"
full_version: "ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]"
# enqueue two emails to be sent later
UserMailer.send_later(:deliver_new_enrollment, @user, @offering.course, course_url(@offering.course.permalink))
UserMailer.send_later(:deliver_new_user, @user, @user.password)
# test that they are being sent the right arguments and being enqueued
# both tests are failing with the expectation of the other one.
# any suggestions on how I should spec this?
it "should send a new user email to the user" do
UserMailer.should_receive(:send_later).once.with(:deliver_new_user, @new_user, @new_user.password)
do_post
# A dictionary of movie critics and their ratings of a small
# set of movies
critics={'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5,
'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5,
'The Night Listener': 3.0},
'Gene Seymour': {'Lady in the Water': 3.0, 'Snakes on a Plane': 3.5,
'Just My Luck': 1.5, 'Superman Returns': 5.0, 'The Night Listener': 3.0,
'You, Me and Dupree': 3.5},
'Michael Phillips': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.0,
'Superman Returns': 3.5, 'The Night Listener': 4.0},
{ "to": "[email protected]",
"from": "[email protected]",
"from_name": "Randy Schmidt",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam est.\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\n\n",
"date": "2009-07-03T17:47:51Z",
"subject": "Email with multiple attachments and a body",
"attachments": [
{
"size": 1813,
"content_type": "image/jpeg",
require 'rubygems'
require 'tmail'
require 'rest_client'
DESTINATION = ARGV.first || 'http://localhost:4567/posts'
class Message
def self.receive(raw)
message = parse(raw)
params = {}
module Grackle
module Handlers
# Decodes JSON Twitter API responses but doesn't turn them into OpenStructs
class JSON2Handler
def decode_response(res)
JSON.parse(res)
end
end
end