Skip to content

Instantly share code, notes, and snippets.

Avatar
:bowtie:
Focusing on @planetargon at the moment

Robby Russell robbyrussell

:bowtie:
Focusing on @planetargon at the moment
View GitHub Profile
View gist:2186
require "shorturl"
# rubyurl
url = ShortURL.shorten( 'http://mypage.com' )
# moourl
moo_url = ShortURL.shorten( 'http://mypage.com', :moourl )
View gist:2219
# 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)
View gist:5085
~ : irb
2 + 3>> 2 + 3
=> 5
>> x = 4
=> 4
>> x + 2
=> 6
>> x * 3
=> 12
>> x / 2
View gist:7355
~ : cat .gitconfig
[user]
email = robby@planetargon.com
name = Robby Russell
[alias]
co = checkout
ci = commit
st = status
br = branch
View .gitconfig
[user]
email = robby@planetargon.com
name = Robby Russell
[alias]
co = checkout
ci = commit
st = status
br = branch
mg = merge
View request.xml
POST http://rubyurl.com/api/links
<link>
<website_url>http://github.com/robbyrussell</website_url>
</link>
View rubyurl-response.xml
<?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 Sep 2, 2008
request/response for RubyURL via JSON
View rubyurl-request.json
{ "link": { "website_url": "http://github.com/robbyrussell/rubyurl" } }
View rubyurl-httparty.rb
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
View rubyurl to_yaml from zsh
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
You can’t perform that action at this time.