Skip to content

Instantly share code, notes, and snippets.

View jimryan's full-sized avatar

Jim Ryan jimryan

View GitHub Profile
@jimryan
jimryan / dabblet.css
Created January 7, 2012 07:03
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
-webkit-perspective: 900;
background:#E7E7E7;
}
.doorway {
@jimryan
jimryan / dabblet.css
Created January 9, 2012 00:56
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
-webkit-perspective: 900;
background:#E7E7E7;
}
.doorway {
should "process :original style first" do
file = File.new(File.join(File.dirname(__FILE__), "fixtures", "50x50.png"), 'rb')
rebuild_class :styles => { :small => '100x>', :original => '42x42#' }
dummy = Dummy.new
dummy.avatar = file
dummy.save
# :small avatar should be 42px wide (processed original), not 50px (preprocessed original)
assert_equal "42", `identify -format "%w" "#{dummy.avatar.path(:small)}"`.strip
should "save the files as the right formats and sizes" do
[[:large, 400, 61, "PNG"],
[:medium, 100, 15, "GIF"],
[:small, 32, 32, "JPEG"]].each do |style|
cmd = %Q[identify -format "%w %h %b %m" "#{@attachment.path(style.first)}"]
out = `#{cmd}`
width, height, size, format = out.split(" ")
assert_equal style[1].to_s, width.to_s
assert_equal style[2].to_s, height.to_s
assert_equal style[3].to_s, format.to_s
def test_sets_settings_with_hash
user = User.create :name => 'Mr. Foo'
user.settings[:three] = 3
user.settings = { :one => 1, :two => 2 }
assert_equal 1, user.settings[:one]
assert_equal 2, user.settings[:two]
assert_equal 3, user.settings[:three] # ensure existing settings remain intact
end
@jimryan
jimryan / dabblet.css
Created February 21, 2012 00:10
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
-webkit-perspective: 900;
background:#E7E7E7;
}
.doorway {
@jimryan
jimryan / dabblet.css
Created February 21, 2012 00:11
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height:100%;
@jimryan
jimryan / dabblet.css
Created March 5, 2012 00:34
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
-webkit-perspective: 900;
background:#E7E7E7;
}
.doorway {
@jimryan
jimryan / Gemfile
Created April 21, 2012 04:58
RailsConf 2012 ical generator
source "http://rubygems.org"
gem 'json'
gem 'ri_cal'
gem 'tzinfo'
@jimryan
jimryan / railsconf2012.ics
Created April 21, 2012 04:59
RailsConf 2012 iCal
BEGIN:VCALENDAR
PRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN
CALSCALE:GREGORIAN
VERSION:2.0
BEGIN:VEVENT
DTEND;VALUE=DATE-TIME:20120423T180000
DTSTART;VALUE=DATE-TIME:20120423T173000
DESCRIPTION:Rich Hickey\, the author of <a href="http://clojure.org/">Clo
jure</a> and designer of <a href="http://datomic.com/">Datomic</a>\, is
a software developer with over 20 years of experience in various domains