Skip to content

Instantly share code, notes, and snippets.

View glebtv's full-sized avatar

Gleb glebtv

View GitHub Profile
@rklemme
rklemme / work.rb
Created January 25, 2011 10:11
Sample work distribution across processes
require 'set'
LOCK = Mutex.new
num = Integer(ARGV.shift || 4)
processes = Set.new
Signal.trap "INT" do |s|
$stderr.puts "Shutdown"
@laurynas
laurynas / watermark.rb
Created November 20, 2010 19:27
Paperclip Watermark processor
# Based on
# https://github.com/ng/paperclip-watermarking-app/blob/master/lib/paperclip_processors/watermark.rb
# Modified by Laurynas Butkus
module Paperclip
class Watermark < Processor
# Handles watermarking of images that are uploaded.
attr_accessor :format, :whiny, :watermark_path, :position
def initialize file, options = {}, attachment = nil