This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
# From a fresh install of squeeze | |
apt-get install ruby rubygems # Need ruby to use fpm | |
gem1.8 install fpm --no-ri --no-rdoc | |
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz | |
tar -zxvf ruby-1.9.3-p125.tar.gz | |
cd ruby-1.9.3-p125 | |
rm -rf /tmp/ruby193 |
# Returns a lambda used to determine what number is at t in the range of a and b | |
# | |
# interpolate_number(0, 500).call(0.5) # 250 | |
# interpolate_number(0, 500).call(1) # 500 | |
# | |
def interpolate_number(a, b) | |
a = a.to_f | |
b = b.to_f | |
b -= a | |
lambda { |t| a + b * t } |
# RAILS 2.3.15 | |
# | |
# Since <tag type="yaml"> was removed from rails' xml parsing, | |
# but not from its to_xml method, rails can't talk to an API | |
# generated by rails, if you have serialized attributes. | |
# This can be put in config/initializers and you should probably | |
# upgrade to rails 3 already. Ugh. | |
# Three parts: |
module Fixtures | |
# | |
# Set up fixtures that will be defined once during startup | |
# and (perhaps) rolled back at the beginning of each test run | |
# | |
def fixtures &block | |
if block_given? | |
instance_eval &block | |
@fixtures = {} | |
(instance_variables - [:@fixtures]).each do |fresh| |
This is a set of helpers for finding the application's currently active models/routes/controllers/etc. This isn't a straightforward process because of how Ember (rightly) encapsulates application objects, but it's useful in debugging environments to be able to quickly access them. And with the beta release of Ember Data, the store is not easily accessible without helpers either.
All helpers can be called directly if you provide them an application instance:
var BackboneAdapterMethods = { | |
hide : function(){ | |
this.invoke('hide'); | |
}, | |
attr : function(map){ | |
this.invoke('writeAttribute',map); | |
}, | |
text: function() { |
#!/usr/bin/env ruby | |
toc = "# Table of Contents\n" | |
newmd = "" | |
ARGF.each_line do |line| | |
newmd << line | |
next if !line.start_with?("#") | |
heading = line.gsub("#", "").strip |
It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time
class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime
steps in:
>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000