Skip to content

Instantly share code, notes, and snippets.

dirs = ["output/test/deepdir", "testdir", "another"]
task :default => dirs
dirs.each do |dir|
directory dir
end
# fjean@Prometheus ~/dev/gist-806422
# master* $ rake -t -v [13:22:23]
@fredjean
fredjean / jobs.rb
Created July 29, 2012 17:31 — forked from ahoward/jobs.rb
./script/jobs
#!/usr/bin/env ruby
# encoding: utf-8
# setup
#
require 'fileutils'
script = File.expand_path(__FILE__).gsub(%r|\breleases/\d+\b|, 'current')
script_dir = File.dirname(script)
rails_root = File.dirname(script_dir)
@fredjean
fredjean / Gemfile
Created August 14, 2012 21:04
Using Redcarpet on Middleman
gem 'redcarpet'
@fredjean
fredjean / gist:3355455
Created August 15, 2012 03:30
Custom Git URL Handlers

Using a custom URL scheme for shorter GitHub URLs

Run the following command:

git config --global url.ssh://[email protected]/.insteadof gh:

This will tell Git to expand the gh: URL scheme to ssh://[email protected]. You can then checkout a repo using the shorter syntax:

require 'right_aws'
def instances_from_ec2(load_balancer = nil)
load_balancer ||= aws_load_balancer
payload = elb.describe_load_balancers(load_balancer)
instances = ec2.describe_instances payload.first[:instances]
instances.collect{|instance| instance[:dns_name] if (instance[:aws_state] == 'running')}
end
require 'right_aws'
def instances_from_ec2(load_balancer = nil)
load_balancer ||= aws_load_balancer
payload = elb.describe_load_balancers(load_balancer)
instances = ec2.describe_instances payload.first[:instances]
instances.collect{|instance| instance[:dns_name] if (instance[:aws_state] == 'running')}
end
def elb
@elb ||= RightAws::ElbInterface.new(aws_access_key_id, aws_secret_access_key, :region => 'us-west-1')
set :raise_errors, true
set :show_exceptions, true if development?
require 'exceptional'
use Rack::Exceptional, "11a42f81f3652f34d226904c671659d7cedb44d9" unless (Rails.env.development? || Rails.env.test?)
desc "Imports all existing Salesforce accounts"
task :households => :environment do |t|
accounts = Salesforce::Household.all
start = 0
size = 100
loop do
puts "Loading from #{start} to #{start + size}"
accounts[start...(start + size)].each do |account|
SnuggHome::SalesforceImporter.import_home(account)
end
@fredjean
fredjean / quiz-1.md
Created September 26, 2012 15:52 — forked from ahoward/quiz-1.md
quiz-1.md
So you think you wanna be a web developer...

Fork this, update your copy with answers.

They don't need to be precise - pseudo-code is fine in most cases.

Some questions don't have correct answers.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.fredjean.cleandownloads</string>
<key>ProgramArguments</key>
<array>
<string>mv</string>
<string>~/Downloads/*(mw+1) ~/.Trash</string>