Skip to content

Instantly share code, notes, and snippets.

@elliottkember
elliottkember / routes.rb
Created March 27, 2009 20:41
Simple OAuth in Rails
map.with_options :controller => 'user_sessions' do |session|
session.callback '/callback', :action => 'callback'
session.logout '/logout', :action => 'destroy'
session.login '/login', :action => 'new'
end
@elliottkember
elliottkember / dreamcatcher.rb
Created July 20, 2009 13:39
Dreamcatcher - An "mm_" checker for Gmail - deletes emails with links to sites that use Dreamweaver!
#! /usr/bin/ruby
## Elliott Kember's Delete MM_ Script.
# I bet you thought I wouldn't write this!
## Usage:
# $ ruby dreamcatcher.rb emailaddress password
## dreamcatcher.rb
# Tested on Ubuntu 8.10
apt-get update
# Git
apt-get install git-core -y
# Apache
/* Elliott Kember's jSnake, version 3 */
// Usage: new Snake()
// Adding options: new Snake({ width: 30, mouse_chasing: true })
// TODO: Add list of options
// Compass bearings for directions
UP = 0;
RIGHT = 90;
DOWN = 180;
LEFT = 270;
$(document).ready(function(){
if($.browser.safari){
height = parseInt($('#wrapper').css('height'));
number = height / 100;
for(i=0;i<number;i++){
$("<a name="+i+"></a>").css('position','absolute').css('top', i*100+'px').appendTo($('body'));
}
}
})
// Thanks to Joshua Hatfield (@fjhat) for the pluginizing!
(function($){
$.fn.ek3d = function(options) {
var defaults = {
strength: 5,
hex: '#aaaaaa'
};
@elliottkember
elliottkember / gist:367329
Created April 15, 2010 16:30
in /Applications/WebKit.app/Contents/Frameworks/10.6/WebCore.framework/Versions/A/Resources/inspector/inspector.css
.outline-disclosure li {padding: 1px 0 1px 14px;}
body.platform-mac.platform-mac-snowleopard .monospace,
body.platform-mac.platform-mac-snowleopard .source-code {font-family: 'Lucida Grande', monospace;}
beforemovenode: function (tree, node, oldParent, newParent, index) {
var self = this;
self.moved = false;
self.ready = false;
Ext.Msg.confirm('', '', function (button) {
if (button === 'yes') {
$.ajax({
async: false,
url: CMS.BaseUrl() + 'pfCMSTree/moveNode/',
# In your crontab:
* * * * * ruby ~/run.rb
# in ~/run.rb
12.times do
uptime = `uptime`.split(' ')[-3]
user = `whoami`.sub("\n", '')
# Optionally, use the following line to customize your username
# user = "@YOUR-TWITTER-NAME"
`curl http://loadaverages.elliottkember.com/statistics -s -d statistic\\[computer_id\\]=#{user}\\&statistic\\[uptime\\]=#{uptime}`
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %c"
autodetach on # Autodetach session on hangup instead of terminating screen completely
startup_message off # Turn off the splash screen
defscrollback 30000
term screen-256color
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason