Skip to content

Instantly share code, notes, and snippets.

@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)
%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
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
class String
def bling
self + "inator"
end
def bling!
replace(self.bling)
end
end
@bowsersenior
bowsersenior / jQueryEvents.rb
Created January 21, 2012 11:01 — forked from agirorn/jQueryEvents.rb
Trigger javascript event in Capybara
module JQueryEventsHelpers
def trigger_js_event(selector, event)
script = "$('#{selector}').trigger('#{event}')"
page.execute_script(script);
end
end
World(JQueryEventsHelpers)
@bowsersenior
bowsersenior / showoff-scraper.rb
Created May 24, 2012 00:15 — forked from ngty/showoff-scraper.rb
Showoff's (https://github.com/schacon/showoff) builtin pdf conversion doesn't work well for me, so i hacked up my own version ... & it works !!
#!/usr/bin/env ruby
require 'rubygems'
require 'RMagick'
require 'capybara'
require 'capybara/dsl'
# ================================================================
# Collect input args
# ================================================================
begin
@bowsersenior
bowsersenior / gist:2997869
Created June 26, 2012 18:44 — forked from Victa/gist:1485536
My Textmate 2 .tm_properties
# Basic Settings
#
fontName = "Monaco"
fontSize = 12
# Extra files to include
#
myExtraIncludes = ".tm_properties,.htaccess,.gitignore"
fileBrowserGlob = "{*,$myExtraIncludes}"
include = "{$include,$myExtraIncludes}"
@bowsersenior
bowsersenior / mountain-lion-brew-setup.markdown
Created July 27, 2012 18:39 — forked from yetanothernguyen/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

# My pimped out unicorn config, with incremental killof
# and all the latest capistrano & bundler-proofing
# @jamiew :: http://github.com/jamiew
application = "000000book.com"
environment = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'production'
app_path = "/srv/#{application}"
bundle_path = "#{app_path}/shared/bundle"
timeout 30

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.