Skip to content

Instantly share code, notes, and snippets.

View Aupajo's full-sized avatar

Pete Nicholls Aupajo

  • Christchurch, New Zealand
View GitHub Profile
@Aupajo
Aupajo / gist:139093
Created July 1, 2009 21:51 — forked from gabe/gist:137356
Possible implementation of Sinatra URI templates?
require 'addressable/template'
module Juxt
module Sinatra
# Allows for declared, named URI Templates in Sinatra applications,
# for both routing and URI generation.
#
# The URI generation method (included as a Sinatra helper) modifies
# the path of generated URIs with request.script_name, meaning the
# URIs generated will still be valid if multiple Sinatra applications
@Aupajo
Aupajo / twat.rb
Created April 6, 2009 01:40 — forked from fauxparse/twat.rb
#!/usr/bin/env ruby
# Find common Twitter friends
# Usage: ./twat.rb user1 user2 ...
lists = ARGV.inject({}) do |hash, username|
page = 0
while !(output = `curl -s http://twitter.com/statuses/friends/#{username}.xml?page=#{page += 1} | grep "<screen_name>"`.gsub(%r{</?screen_name>}, '').split).empty?
hash[username] = ((hash[username] || []) + output).sort
end
hash
@Aupajo
Aupajo / gist:61649
Created February 10, 2009 22:45 — forked from anonymous/gist:61647
Top used commands
history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr
83 nano
55 git
47 ssh
47 ghproxy
47 cd
36 ls
24 ping
19 sudo
@Aupajo
Aupajo / github-code-search.js
Created November 29, 2008 20:58 — forked from bastos/github-code-search.js
Different command.
// Based on apidock.org Ubiquity Search: http://gist.github.com/8132
CmdUtils.CreateCommand(
{
name: "github",
takes: {"function": noun_arb_text},
icon: "http://github.com/fluidicon.png",
homepage: "http://tiago.zusee.com",
author: {name: "Tiago Bastos", email: "comechao@gmail.com"},
license: "MPL,GPL",
description: "Search on Github Code Search",