Skip to content

Instantly share code, notes, and snippets.

View dougo-chris's full-sized avatar

Chris Douglas dougo-chris

  • Melbourne Australia
View GitHub Profile
Cool Gist for the web
SET INPUT VALUE BY ID
---------------------
$('input[id=' + id + ']').attr('value', "");
CURRENT SELECT / OPTIONS
-------------------------
$('form#new_image select[id=image_modality] :selected').attr('value')
CURRENT CHECKBOX CHECKED
-------------------------
Capistrano::Configuration.instance(:must_exist).load do
before 'deprec:ree:symlink_ree' do
sudo "test -L #{ree_short_path} && sudo unlink #{ree_short_path} || true"
end
namespace :deprec do
namespace :ree do
set :ree_version, 'ruby-enterprise-1.8.7-2010.01'
# I want to define access levels with:
# ActionController::Base.define_access_level(:reporter, 9)
module Dougo
module MyExtensionToClass
def self.included(base)
base.class_eval do
extend ClassMethods
end
@dougo-chris
dougo-chris / bam
Created March 24, 2010 22:26
bmani
#!/opt/local/bin/ruby -w
#
# run this script in the gem direcory with the
# example bam ~/Workspace/my_rails_project [name]
#
# /rails_generators/manifests/NAME.yml
#
# contents :
# - app/views/admin/users
# - app/views/user_mailer
#!/opt/local/bin/ruby -w
# git clone http://github.com/jjl/get_iplayer.git ~/Workspace/bin/get_iplayer/get_iplayer
# curl http://ftp.twaren.net/Unix/NonGNU/flvstreamer/macosx/flvstreamer_macosx_intel_32bit_latest --output ~/Workspace/bin/flvstreamer
# chmod 755 ~/Workspace/bin/flvstreamer
GET_IPLAYER = "~/Workspace/bin/get_iplayer/get_iplayer"
IPLAYER_CACHE = "~/.get_iplayer/radio.cache"
IPLAYER_HISTORY = "~/.get_iplayer/download_history"
FLVSTREAMER = "~/Workspace/bin/flvstreamer"
DOWNLOAD_PATH = "~/Music/BBC"
# FINDING AD VIEWS
# klass = AdView
# klass = klass.by_campaign_id(@campaign.id)
# klass = klass.order_event_time('DESC')
#
# @ad_views = klass.paginate(:page => params[:page], :per_page => 100 )
#
# CREATING AD VIEWS
# AdView.by_activated_campaign_id(@campaign.id]).create(: ... )
#
<%-
start_date = @trip.start_date;
location_map = @locations.map do | location |
map = {
:start_date => format_date(start_date),
:location_id => location.id,
:position => location.position,
:title => location.title,
:nights => location.nights,
:latlng => location.latlng,
require 'spec_helper'
describe "routing to profiles" do
extend RulesEngine::RouteMatcher
describe "/re_plans" do
# index methods
match_route(:get, :re_plans, :index => '/re_plans')
match_route(:get, :re_plans, :new => '/re_plans/new')
match_route(:post, :re_plans, :create => '/re_plans')
@dougo-chris
dougo-chris / frogger.rb
Created July 12, 2011 16:10
Frogger for rspec
####################################################
# this file belongs in the ./spec/support directory
####################################################
require 'rspec/core/formatters/base_formatter'
class Frogger < RSpec::Core::Formatters::BaseFormatter
COLOR_START = "\e[34m" # blue
COLOR_FAILED = "\e[31m" # red
COLOR_PASSED = "\e[32m" # green