Skip to content

Instantly share code, notes, and snippets.

View robbyrussell's full-sized avatar
:bowtie:
Focusing on @planetargon at the moment

Robby Russell robbyrussell

:bowtie:
Focusing on @planetargon at the moment
View GitHub Profile
require "shorturl"
# rubyurl
url = ShortURL.shorten( 'http://mypage.com' )
# moourl
moo_url = ShortURL.shorten( 'http://mypage.com', :moourl )
# Required for using Mongrel with Capistrano2
# gem install palmtree
require 'palmtree/recipes/mongrel_cluster'
########################################################################
# Rails Boxcar - Capistrano Deployment Recipe
# Configuration
########################################################################
# What is the name of your application? (no spaces)
~ : irb
2 + 3>> 2 + 3
=> 5
>> x = 4
=> 4
>> x + 2
=> 6
>> x * 3
=> 12
>> x / 2
~ : cat .gitconfig
[user]
email = robby@planetargon.com
name = Robby Russell
[alias]
co = checkout
ci = commit
st = status
br = branch
@robbyrussell
robbyrussell / .gitconfig
Created August 29, 2008 23:52
my ~/.gitconfig
[user]
email = robby@planetargon.com
name = Robby Russell
[alias]
co = checkout
ci = commit
st = status
br = branch
mg = merge
@robbyrussell
robbyrussell / export.rake
Created August 31, 2008 00:02
rake task and library extension for ActiveRecord to export a model's records to a CSV file
namespace :export do
desc "Export ActiveRecord model records to a CSV file. Pass model name: model=ModelName"
task :to_csv => :environment do
require 'exportable'
open(RAILS_ROOT + '/log/export.pid', "w") do |file|
file << Process.pid
end
POST http://rubyurl.com/api/links
<link>
<website_url>http://github.com/robbyrussell</website_url>
</link>
<?xml version="1.0" encoding="UTF-8"?>
<link>
<website_url>http://github.com/robbyrussell</website_url>
<permalink>http://rubyurl.com/PNsF</permalink>
</link>
@robbyrussell
robbyrussell / rubyurl-request.json
Created September 2, 2008 01:21
request/response for RubyURL via JSON
{ "link": { "website_url": "http://github.com/robbyrussell/rubyurl" } }
require 'rubygems'
require 'httparty'
class Rubyurl
include HTTParty
base_uri 'rubyurl.com'
def self.shorten( website_url )
post( '/api/links.json', :query => { :link => { :website_url => website_url } } )
end