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
class String | |
# ANSI-colored version of the string | |
def colorize(color) | |
n = case color | |
when :black: 30 | |
when :red: 31 | |
when :green: 32 | |
when :yellow: 33 | |
when :blue: 34 | |
when :magenta: 35 |
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
CmdUtils.CreateCommand({ | |
name: "bitly", | |
takes: {"url to shorten": noun_arb_text}, | |
preview: "Replaces the selected URL with a bit.ly-shortened URL.", | |
description: "Replaces the selected URL with a bit.ly-shortened URL.", | |
icon: "http://bit.ly/favicon.png", | |
execute: function( urlToShorten ) { | |
var baseUrl = "http://bit.ly/api"; | |
var params = {url: urlToShorten.text}; | |
jQuery.get(baseUrl, params, function(shortenedUrl) { |
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
CmdUtils.CreateCommand( | |
{ | |
name: "ruby", | |
takes: {"function": noun_arb_text}, | |
icon: "http://ruby-doc.org/favicon.ico", | |
homepage: "http://jackndempsey.blogspot.com", | |
author: {name: "Jack Dempsey", email: "jack.dempsey@gmail.com"}, | |
license: "MPL,GPL", | |
description: "Search ruby functions documentation", | |
help: "Select a ruby function", |
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 'linahi' # this is just my app, which seems to work ok | |
require 'sinatra/test/spec' | |
context 'Linahi' do | |
specify 'should list files when asked' do | |
get_it '/' | |
puts body | |
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
=begin | |
Shooter | |
<http://gist.github.com/25886> | |
Harry Vangberg <http://trueaffection.net> | |
Simon Rozet <http://purl.org/net/sr/> | |
EXAMPLE | |
IRC.shoot('irc://irc.freenode.net:6667/integrity', :as => "IntegrityBot") do |channel| |
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
get '/:id' do | |
@vent = Vent.get(params[:id]) | |
erb :show | |
end | |
# show post | |
get '/:id.xml' do | |
@vent = Vent.get(params[:id]) | |
builder :show | |
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
# A Sinatra App as a Rails Plugin | |
# | |
# In your Edge Rails app: | |
# | |
# ruby script/plugin install git://gist.github.com/50625.git | |
require 'sinatra/base' | |
class SinatraRailsPlugin < Sinatra::Base | |
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
# Meh, I went overboard. Usage: | |
# | |
# To tweet, write in channel: | |
# nancie, tweet this: some nice thing about sinatra and stuff | |
# To give permissions, private message: | |
# /msg nancie allow awesome_user | |
# | |
# Additional extensions are welcome. | |
require 'rubygems' |
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
#!/usr/bin/env ruby | |
# -*- ruby -*- | |
# twitter command line client | |
# That's What I Call Lame | |
# 09nov2008 +chris+ | |
require 'json' | |
require 'open-uri' |
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
class Foo < Sinatra::Base | |
host_name "sinatrarb.com" | |
user_agent /Mosaic/ | |
provides :xml | |
get '/' do | |
"Welcome!" | |
end | |
get '/' do | |
"You are not to be welcomed!" |
OlderNewer