Skip to content

Instantly share code, notes, and snippets.

@sczizzo
sczizzo / Tracker.js
Created April 16, 2010 00:46
JavaScript API for the CTA BusTracker
// = Name
// tracker.js
// Douglass - Cross-browser, cross-platform alternative to CTA BusTracker
//
// = Description
// The ChicagoTransit module queries the CTA BusTracker Service using the
// official version 1.0 API. CTA uses the BusTime system to provide developers
// with real-time route information through BusTracker. The BusTracker Service
// allows deveopers to make HTTP requests and recieve XML responses. The CTA
// provides {official API documentation (PDF)}[http://www.transitchicago.com/assets/1/developer_center/BusTime_Developer_API_Guide.pdf],
@sczizzo
sczizzo / fuckup.js
Created August 8, 2011 20:20
Fuck up any page nice enough to use jQuery
// TODO More up()s than just deleting elements, e.g.
// - Swapping random elements
// - Removing random bits of HTML
function up(i) {
var k = Math.floor(Math.random() * i) % i;
var l = Math.floor(Math.random() * i * k) % i;
console.log( 'Deleting element: ' + l );
console.log( $('body *:eq(' + l + ')').remove() );
}
@sczizzo
sczizzo / classesdev-lookup.rb
Created August 26, 2011 21:08
Classesdev Lookup
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
require 'yaml'
# Course, username, password
# e.g. ./classesdev-lookup.rb AFAM20005 mycnetid 'mysecretpassword'
exit(1) unless ARGV.length == 3
course = ARGV[0]
course_php = 'https://classesdev.uchicago.edu/courseDetail.php?courseName='
@sczizzo
sczizzo / Swap.js
Created December 12, 2011 16:29
Turn a site with jQuery into a strobe light
function swap() {
if ($(window).data('on') === undefined) {
$('body').remove();
$('html').css('background', 'white');
$(window).data('on', false);
}
if ($(window).data('on')) {
$('html').css('background', 'black');
$(window).data('on', false);
@sczizzo
sczizzo / Walker.rb
Created December 12, 2011 16:30
Simple dungeon map reader and walker
#!/usr/bin/env ruby -w
class Array
def second
self[1]
end
end
class Symbol
def to_i
@sczizzo
sczizzo / DealOrNoDeal.rb
Created December 21, 2011 01:42
A really, really quick Deal or No Deal
#!/usr/bin/ruby
# Updated 2010-01-10 by Sean Clemmer
#
# Overkill
class Case
attr_reader :number, :value
def initialize( number, value )
@number = number
@value = value
@sczizzo
sczizzo / ScheduleWatcher.rb
Created December 21, 2011 01:42
The original ScheduleSpy script, ScheduleWatcher
#!/usr/bin/env ruby
# = Name
# University of Chicago TimeSchedules Spy (ScheduleSpy)
#
# = Description
# The ScheduleSpy watches the University of Chicago TimeSchedules system for
# openings in the classes you want. Pass the system the name of the classes,
# and watch for Growl notifications keeping you abreast of any openings.
#
# = License
@sczizzo
sczizzo / Todo.rb
Created December 21, 2011 01:43
Simple command-line Todo utility
#!/usr/bin/ruby
require 'yaml'
# Need a file for our list
unless File.exists?( ".todo" )
todo_file = File.open( '.todo', 'w' )
todo_file.puts( '---' )
todo_file.close
end
@sczizzo
sczizzo / Tracker.rb
Created December 21, 2011 01:44
Ruby wrapper around CTA BusTracker API
# = Name
# Chicago Transit Authority BusTracker Service API
#
# = Description
# The ChicagoTransit module queries the CTA BusTracker Service using the
# official version 1.0 API. CTA uses the BusTime system to provide developers
# with real-time route information through BusTracker. The BusTracker Service
# allows deveopers to make HTTP requests and recieve XML responses. The CTA
# provides {official API documentation (PDF)}[http://www.transitchicago.com/assets/1/developer_center/BusTime_Developer_API_Guide.pdf],
# and you can request an access key at the {API homepage}[http://www.transitchicago.com/developers/bustracker.aspx].
@sczizzo
sczizzo / del.sh
Created December 21, 2011 01:44
del - A safer alternative to rm
#!/bin/bash
# del
# "Safe" version of rm
# Updated 2010-01-13 by Sean Clemmer
#
# If I learned one thing writing this script it's as follows:
# When in doubt, quote.
# At the very least, this thing can handle spaces
usage="USAGE: del [-vler] file*"