Add backup support to a Rails project with the 'backup' gem
gem 'backup', '3.0.15'
gem 'fog', '0.7.0' # used by backup for s3 uploads, but not a dependency
// For a group of elements, sets 'className' on an element when 'evt' | |
// is triggered, and removes 'className' from all it's | |
// siblings. Useful for highlighting a selection within a list of | |
// choices. | |
// | |
// $('ul#my_list li').setCurrentClassOnEvent('click', 'current'); | |
// <ul id="my_list"> | |
// <li class="current">Chocolate</li> <!-- click adds 'current' class --> | |
// <li>Vanilla<li> | |
// <li>Strawberry</li> |
framework 'cocoa' | |
outpipe = NSPipe.pipe | |
task = NSTask.alloc.init | |
task.setLaunchPath '/usr/bin/tail' | |
task.setArguments %w(-f -n10 /Users/jch/projects/pharmmd/log/wendy.log) | |
task.setStandardOutput outpipe | |
file = outpipe.fileHandleForReading |
You've just written a masterpiece of a web app. It's fun, it's viral, and it's useful. It's clearly going to be "Sliced Bread 2.0". But what comes next is a series of unforeseen headaches. You'll outgrow your shared hosting and need to get on cloud services. A late night hack session will leave you sleep deprived, and you'll accidentally drop your production database instead of your staging database. Once you serve up a handful of error pages, your
2006 500 sel | |
title - clean | |
#num owners | |
side airbags? | |
why selling - company car. maintained through the company. | |
last mechanic - front windshield. oil change. air filter. | |
get back at 5pm. |
def add_to_chargify(user, credit_card_attributes) | |
credit_card_attributes.symbolize_keys! | |
customer = Chargify::Customer.create({ | |
:first_name => credit_card_attributes[:first_name], | |
:last_name => credit_card_attributes[:last_name], | |
:email => user.email, | |
:reference => self.id # one payer per account, so Account is customer_reference, not User | |
}) | |
# TODO: major error handling needed here... | |
puts customer.errors.full_messages |
# I was upgrading an old rails 2 app to rails 3 and noticed that | |
# http://rails.rubyonrails.org/classes/ActionController/Verification/ClassMethods.html | |
# was deprecated. I was using this in the controllers to verify that an action had to be triggered | |
# by an xhr request | |
# I am unable to test it from a functional test b/c it doesn't look like functional tests | |
# go through routes. However, it works fine in the app. I could put this in an integration test, | |
# but I'm wonder if it makes more sense to have some way of testing the route constraint in | |
# a local way. |
/* **She grows old and feeble** */ | |
//...But she would always have to return back to her dull world of chores and grown-ups. | |
return function() { | |
// And her latest story would be filled with wonder | |
latestStory = adventures[adventures.length - 1]; | |
// But time is a bitch... | |
setInterval(function() { | |
// and our dear princess can't help but forget her adventures, |
(1..18).step(3) {|i| puts (i..i+2).to_a.inspect if i.even?} | |
# Breaking it down: | |
# #step(3) yields every 3rd element in the range, so you start with 1, 4, 7, 10... | |
# in the block, we want to print lists of 3's, so we do (i..i+2).to_a. Giving us: [1,2,3], [4,5,6], [7,8,9]... | |
# now we want to skip every other list of 3, so we only print if i is even. |