A great couple of lines that add a `to_bool` method to the Ruby String class. This is really helpful when passing in
require File.join(File.dirname(__FILE__), '..', 'app.rb') require 'rack/test' set :environment, :test set :run, false set :raise_errors, true set :logging, false def access_token "xxxxx" end
def time_ago time, append = ' ago' return time_ago_in_words(time).gsub(/about|less than|almost|over/, '').strip << append end I love the time_ago_in_words method that comes bundled
The most common way to make files publicly accessible for an Amazon S3 bucket is to add a bucket policy (Bucket Properties
This technique is helpful if you are using Amazon S3 as a file repository and want to detect duplicate files as they
The Problem We have a file on a server and want to create a hash (or checksum) of it, so we can
This paper is kind of academic, but its a good look at the 3 tradeoffs encountered when you try to build a
ActiveRecord can be a nice way to make querying a database easy, object-friendly, and language-independent. The two restrictions you face when using
> mkdir activerecord-sinatra && cd activerecord-sinatra > touch app.rb Install two gems for ActiveRecord and the JSON gem for a real API-looking
Sinatra is a DSL (Domain Specific Language), which makes it conceptually very similar to a framework, but to be more concise, as