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
// Based on apidock.org Ubiquity Search: http://gist.github.com/8132 | |
CmdUtils.CreateCommand( | |
{ | |
name: "code", | |
takes: {"function": noun_arb_text}, | |
icon: "http://github.com/fluidicon.png", | |
homepage: "http://tiago.zusee.com", | |
author: {name: "Tiago Bastos", email: "[email protected]"}, | |
license: "MPL,GPL", | |
description: "Search on Github Code Search", |
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 | |
# | |
# fetch hosts from amazon EC2 meta-data | |
# | |
# Based on http://dysinger.net/2008/10/13/using-amazon-ec2-metadata-as-a-simple-dns | |
# | |
%w(logger optparse rubygems right_aws resolv pp).each { |l| require l } | |
LOGGER = Logger.new("/var/log/fetch_hosts.log") |
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
Let's make a list of Sinatra-based apps! | |
Apps: | |
- http://github.com/cschneid/irclogger "Sinatra based irclogger.com" | |
- http://github.com/rtomayko/wink "minimalist blogging engine" | |
- http://github.com/foca/integrity "The easy and fun Continuous Integration server" | |
- http://github.com/sr/git-wiki "git-powered wiki" | |
- http://github.com/entp/seinfeld "Seinfeld-inspired productivity calendar to track your public github commits." | |
- http://github.com/karmi/marley "Marley, the blog engine without <textareas>." | |
- http://github.com/ichverstehe/gaze "Serve up your Markdown files with this tiny Sinatra app!" |
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
# 1) Point *.example.com in your DNS setup to your server. | |
# | |
# 2) Setup an Apache vhost to catch the star pointer: | |
# | |
# <VirtualHost *:80> | |
# ServerName *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain | |
class ApplicationController < ActionController::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
# SUPER DARING APP TEMPLATE 1.0 | |
# By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |
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
def parse_youtube(url) | |
youtube = "http://www.youtube.com/" | |
# url =~ /(?:http\:\/\/.*youtube.com\/(?:watch\?v=|v\/))?(.*)$/ | |
url =~ /watch\?v=(.*)/ | |
video_id = $1 | |
video_id = video_id.split("&")[0] | |
flv_url = nil | |
open("#{youtube}watch\?v=#{video_id}") do |f| | |
f.each_line do |line| | |
if line =~ /watch_fullscreen\?(.*?)video_id=([\w-]+)&(.*?)&t=([\w-]+)&/ |
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 | |
# | |
# usage: script/server_restarter | |
# | |
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+ | |
# is so fast when completely reloading the server, I wrote this script to listen to the | |
# given directories, and kill/restart the server when any file is changed. | |
# | |
# It's quick, simple, and it reliably reloads your application when changes are made. | |
# |
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 'sinatra/metal' | |
class SinatraMetal < Sinatra::Base | |
include Sinatra::Metal | |
get '/sinatra' do | |
'hello sinatra!' | |
end | |
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
# | |
# Usage: | |
# rake db:rollback_to_common branch=production | |
# git checkout -m production | |
# rake db:migrate | |
# | |
namespace :db do | |
desc 'Rolls back database to common migration state between current branch and another' | |
task :rollback_to_common do | |
FileUtils.cd(RAILS_ROOT) do |
OlderNewer