Skip to content

Instantly share code, notes, and snippets.

View dhhiep's full-sized avatar

Hiep Dinh dhhiep

  • Viet Nam
  • 07:51 (UTC +07:00)
View GitHub Profile
@bastien
bastien / content.rb
Created July 6, 2012 09:58
Paperclip processor to convert PDF to JPG to go around problems with the old versions of imagemagick and ghostscript available on Heroku. This file is located in [APP_ROOT]/lib/paperclip_processors/ghostscript.rb
# Model using the ghostscript processor
class Content < ActiveRecord::Base
has_attached_file :resource,
:styles => { :preview => ["725x1200>", :jpg], :thumb => ["100x140>", :jpg] },
:processors => [:ghostscript, :thumbnail],
:convert_options => { :all => '-colorspace RGB -flatten -density 300 -quality 100' },
:path => ":page_path/:class/:id/:resource_token/:style/:filename"
end
@tim-reynolds
tim-reynolds / jquery.centerit.js
Created June 29, 2012 18:16
Setting scroll to center on an element (jQuery) - Super simple stuff
/*
If you have a horizontal (or vertical) scroll container and want to set the scroll to center a specific
element in the container you can use the following super simple technique.
I'm going to show you how it was derived, because it's important to know why, not just how.
*/
/*
Setup:
[HTML]
<div class="outer">