Skip to content

Instantly share code, notes, and snippets.

class String
def bling
self + "inator"
end
def bling!
replace(self.bling)
end
end
namespace :gource do
desc "Build gource file"
task :build => :environment do
system("gource -s .05 -800x600 --disable-progress --stop-at-end --bloom-multiplier .4 --bloom-intensity 1.5 --hide-filenames --output-framerate 30 --user-image-dir #{Rails.root}/.git/avatar --output-ppm-stream #{Rails.root}/gource/pathways.ppm #{Rails.root}")
system("ffmpeg -y -b 3000k -r 30 -f image2pipe -vcodec ppm -i #{Rails.root}/gource/pathways.ppm -vcodec libx264 -vpre hq -vpre fastfirstpass #{Rails.root}/gource/pathways.mp4")
system("rm #{Rails.root}/gource/pathways.ppm")
end
end
@bowsersenior
bowsersenior / gist:768344
Created January 6, 2011 18:57
Improved .rvmrc for cancan
#!/usr/bin/env bash
# adapted from: http://rvm.beginrescueend.com/workflow/rvmrc/
ruby_string="1.8.7"
gemset_name="cancan"
if rvm list strings | grep -q "${ruby_string}" ; then
# Load or create the specified environment
%w(rubygems mongoid rspec).each do |gem|
require gem
end
Mongoid.configure do |config|
name = "dirty_track_test"
host = "localhost"
config.master = Mongo::Connection.new.db(name)
config.persist_in_safe_mode = false
end
module Workflow
module MongoidInstanceMethods
def load_workflow_state
self.workflow_state
end
def persist_workflow_state(new_value)
self.workflow_state = new_value
save!
end
@bowsersenior
bowsersenior / cancan_mongoid.rb
Created September 2, 2010 00:42 — forked from blackgold9/mongoid_addtions.rb
How to get CanCan to work with Mongoid 2
module CanCan
class Query
def sanitize_sql(conditions)
conditions
end
end
# customize to handle Mongoid queries in ability definitions conditions
class CanDefinition
def matches_conditions_hash?(subject, conditions = @conditions)