This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "shorturl" | |
# rubyurl | |
url = ShortURL.shorten( 'http://mypage.com' ) | |
# moourl | |
moo_url = ShortURL.shorten( 'http://mypage.com', :moourl ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ : irb | |
2 + 3>> 2 + 3 | |
=> 5 | |
>> x = 4 | |
=> 4 | |
>> x + 2 | |
=> 6 | |
>> x * 3 | |
=> 12 | |
>> x / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ : cat .gitconfig | |
[user] | |
email = robby@planetargon.com | |
name = Robby Russell | |
[alias] | |
co = checkout | |
ci = commit | |
st = status | |
br = branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
email = robby@planetargon.com | |
name = Robby Russell | |
[alias] | |
co = checkout | |
ci = commit | |
st = status | |
br = branch | |
mg = merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST http://rubyurl.com/api/links | |
<link> | |
<website_url>http://github.com/robbyrussell</website_url> | |
</link> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<link> | |
<website_url>http://github.com/robbyrussell</website_url> | |
<permalink>http://rubyurl.com/PNsF</permalink> | |
</link> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "link": { "website_url": "http://github.com/robbyrussell/rubyurl" } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer