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
$:.unshift File.dirname(__FILE__) | |
require 'sinatra' | |
require 'site.rb' | |
ENV['RACK_ENV'] = 'production' | |
run Sinatra::Application |
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
$(document).ready(function() { | |
$('.delete').click(function() { | |
if(confirm('Are you sure?')) { | |
var f = document.createElement('form'); | |
$(this).after($(f).attr({ | |
method: 'post', | |
action: $(this).attr('href') | |
}).append('<input type="hidden" name="_method" value="DELETE" />')); | |
$(f).submit(); | |
} |
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
# Picks a random record from a DataMapper resource. If no records are present, it returns nil. | |
def self.random | |
all.length > 0 ? (get(rand(all.length) + 1) || random) : nil | |
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
require 'isaac' | |
configure do |c| | |
c.nick = "BotFace" | |
c.server = "irc.freenode.net" | |
c.port = 6667 | |
end | |
sayings = [ | |
'Pete is awesome.', |
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
$ dig sinatrarb.com | |
; <<>> DiG 9.4.2-P2 <<>> sinatrarb.com | |
;; global options: printcmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44991 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 | |
;; QUESTION SECTION: | |
;sinatrarb.com. IN A |
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 | |
# 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 |
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 'sinatra' | |
require 'dm-core' | |
require 'user.rb' | |
enable :sessions | |
configure :development do | |
DataObjects::Sqlite3.logger = DataMapper::Logger.new(STDOUT, :debug) | |
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/development.sqlite3") |
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
<?php | |
# CoffMan (http://www.wickle.com) code adapted from timeline extension. | |
# Timeline extension | |
# To use, include this file from your LocalSettings.php | |
# To configure, set members of $wgGraphVizSettings after the inclusion | |
class GraphVizSettings { | |
var $dotCommand; | |
}; |
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
#!/bin/bash | |
# Open/create a file in Coda, open a folder, or just open Coda. | |
if [ -n "$1" ]; then | |
if [ ! -f $1 ]; then | |
touch $1 | |
fi | |
fi | |
open $1 -a /Applications/Coda.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
#!/bin/bash | |
mv $1 ~/.Trash |