Skip to content

Instantly share code, notes, and snippets.

View jbrowning's full-sized avatar

Jeff Browning jbrowning

View GitHub Profile
@longlostnick
longlostnick / uploads_controller.rb
Created June 17, 2014 18:20
Rails JSON file upload with carrierwave (from base64 string)
class Api::UploadsController < ApiController
def create
@upload = Upload.new(upload_params)
ensure
clean_tempfile
end
private
@bert
bert / draw_image.js
Created August 31, 2012 18:57
Backing store and device pixel ratio
/**
* Writes an image into a canvas taking into
* account the backing store pixel ratio and
* the device pixel ratio.
*
* @author Paul Lewis
* @param {Object} opts The params for drawing an image to the canvas
*/
function drawImage (opts)
{
anonymous
anonymous / rails_3_date_formats.rb
Created September 7, 2010 05:56
# Rails 2
# config/initializers/date_formats.rb
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
:date => '%m/%d/%Y',
:date_time12 => "%m/%d/%Y %I:%M%p",
:date_time24 => "%m/%d/%Y %H:%M"
)
# Rails 3
# config/initializers/date_formats.rb