Skip to content

Instantly share code, notes, and snippets.

View joemocha's full-sized avatar


View GitHub Profile
# The GraphicsMagick action, dependent on the `gm` command, is able to perform
# any number of GraphicsMagick conversions on an image passed in as an input.
# The options hash should specify the +name+ for the particular step (which is
# appended to the resulting image filename) the +command+ (eg. convert, mogrify),
# the +options+ (to the command, eg. -shadow -blur), and the +extension+ which
# will determine the resulting image type. Optionally, you may also specify
# +input+ as the name of a previous step; doing this will use the result of
# that step as the source image, otherwise each step uses the original image
# as its source.
class GraphicsMagick < CloudCrowd::Action
joemocha / Gemfile
Created February 19, 2010 20:55
interesting setup
# encoding: utf-8
source :gemcutter
source ''
# Rails 2.x style.
group :rails do
gem 'rails', '~> 2.3.5', :require => nil
gem 'builder', '~> 2.1.2'
gem 'memcache-client', '>= 1.7.4', :require => nil
gem 'tzinfo', '~> 0.3.12'
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
# Usage:
# ruby redis_pubsub_demo.rb
DB = {
:redis => SITE_REDIS,
:geo => GEO
SITES = DB[:redis].smembers("sites").inject({}) do |sum, site|
sum[site] = JSON.parse(DB[:redis]["site:#{site}"])
module FCG
module Client
module Comment
# sort attributes
ATTRIBUTES = [:site, :record, :body, :body_as_html, :deleted, :flagged_by, :depth, :path, :parent_id, :displayed_name, :user_id]
module ClassMethods
class CommentsController < ApplicationController
before_filter :require_user
def index
@comments = Comment.all
def new
module FCG::Service
class AlbumApp < FCG::Service::Base
include FCG::Rest
restful :search => true
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
joemocha / rails.js
Created November 15, 2010 03:06
include this in your application.haml.html
jQuery(function ($) {
var csrf_token = $('meta[name=csrf-token]').attr('content'),
csrf_param = $('meta[name=csrf-param]').attr('content');
* Triggers a custom event on an element and returns the event result
* this is used to get around not being able to ensure callbacks are placed
* at the end of the chain.
module FCG
module Rest
attr_accessor :model
module ClassMethods
def restful(*args)
options = args.extract_options!
opts = {
:only => [:get, :post, :put, :delete],
:search => false