Skip to content

Instantly share code, notes, and snippets.

class << self
def image_styles
ActiveSupport::OrderedHash.new.tap do |styles|
styles[:original] = {:processors => [:slice]}
styles[:preview] = {:geometry => "100x100", :processors => [:thumbnail]}
end
end
end
has_attached_file :image,
@nevernormal1
nevernormal1 / gist:720445
Created November 29, 2010 19:35
MapReduce scripts
#!/usr/bin/env ruby
def dump_items(items)
if items.size > 1
items.each_with_index do |item_to_print, i|
items.each_with_index do |related_item, j|
next if item_to_print == related_item
puts "#{item_to_print}:#{related_item}\t1"
end
end
var closeVolume = function(pathVolume) {
var firstPoint, lastPoint, points;
if (pathVolume === null) {
return null;
}
points = pathVolume.shape.points;
if (points.length < 2) {
@nevernormal1
nevernormal1 / clipper.js
Last active February 14, 2019 02:13
Easel helper functions. Download this as a zip file and add dependencies to your app.
// rev 452
/********************************************************************************
* *
* Author : Angus Johnson *
* Version : 6.1.3a *
* Date : 22 January 2014 *
* Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2014 *
* *
* License: *
@nevernormal1
nevernormal1 / .block
Last active April 17, 2024 07:19
SVG Jigsaw Puzzle Generator
license: MIT