Skip to content

Instantly share code, notes, and snippets.

View sonymusic-d2c-pairs's full-sized avatar

sonymusic-d2c-pairs

View GitHub Profile
@sonymusic-d2c-pairs
sonymusic-d2c-pairs / grape.rb
Created April 23, 2012 01:54
Elegant example of declaring requires, modules, and autoloads for ruby lib in rails env
require 'rack'
require 'rack/builder'
module Grape
autoload :API, 'grape/api'
autoload :Endpoint, 'grape/endpoint'
autoload :MiddlewareStack, 'grape/middleware_stack'
autoload :Client, 'grape/client'
autoload :Route, 'grape/route'
autoload :Entity, 'grape/entity'
@sonymusic-d2c-pairs
sonymusic-d2c-pairs / randomthumbs.rb
Created April 22, 2012 16:10 — forked from psobot/randomthumbs.rb
Random Image Thumbnailer
# Hacky random image thumbnailer.
# by Peter Sobot, April 21, 2012
# Based heavily on code by Michael Macias
# (https://gist.github.com/a54cd41137b678935c91)
require 'rmagick'
images = Dir.glob(ARGV[0] ? ARGV[0]
: '-default-input-paths-')
output_dir = (ARGV[1] ? ARGV[1]