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
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
curl -X POST -H 'Content-Type: application/json' -H "Accept: application/json" -d '{ "link": { "website_url": "http://github.com/robbyrussell/rubyurl" } }' http://rubyurl.com/api/links | ruby -rubygems -e 'require "json"; require "yaml"; puts JSON.parse($stdin.gets).to_yaml'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 107 100 107 0 0 527 0 --:--:-- --:--:-- --:--:-- 0
---
link:
permalink: http://rubyurl.com/G2mM
website_url: http://github.com/robbyrussell/rubyurl