Skip to content

Instantly share code, notes, and snippets.

View patshaughnessy's full-sized avatar

Pat Shaughnessy patshaughnessy

View GitHub Profile
@patshaughnessy
patshaughnessy / pusher.rb
Created January 29, 2012 19:19
Part of the Pusher class from RubyGems.org
class Pusher
attr_reader :user, :spec, :message, :code, :rubygem, :body, :version, :version_id
def initialize(user, body, host_with_port=nil)
@user = user
@body = StringIO.new(body.read)
@indexer = Indexer.new
@host_with_port = host_with_port
end
@patshaughnessy
patshaughnessy / hostess.rb
Created January 29, 2012 19:17
Part of the Hostess class from RubyGems.org
class Hostess < Sinatra::Base
... etc ...
def serve_via_s3
serve do
redirect "http://#{$rubygems_config[:s3_domain]}#{request.path_info}"
end
end
def avatar_geometry(style = :original)
@geometry ||= {}
begin
path = avatar.path(style)
unless path
temp_file = Tempfile.open("#{avatar_file_name}_#{style}")
temp_file << avatar.file_contents(style)
path = temp_file.path
end
@geometry[style] ||= Paperclip::Geometry.from_file path
@patshaughnessy
patshaughnessy / application.css.scss
Created November 23, 2011 20:39
application.css.scss example overriding Twitter Bootstrap variables (using bootstrap-sass)
/*
* application.css.scss
*= require_self
*/
@import "bootstrap/reset.css.scss";
@import "bootstrap/variables.css.scss";
// Override link color for my app:
@patshaughnessy
patshaughnessy / application.css.less
Created November 23, 2011 20:38
application.css.less example overriding Twitter Bootstrap variable (using less-rails-bootstrap)
*
* application.css.less
*= require_self
*/
@import "twitter/bootstrap/reset.less";
@import "twitter/bootstrap/variables.less";
// Override link color for my app: