Skip to content

Instantly share code, notes, and snippets.

View caged's full-sized avatar
🎸

Justin Palmer caged

🎸
View GitHub Profile
@caged
caged / gist:666368
Created November 7, 2010 19:56
Buying a domain name from a squatter
Visiting the domain name told me it might be for sale through domainsponsor.com. I created an account with domainsponsor and then placed the minimum bid that the owner (http://www.ireit.com/ - A professional squatter) said they would take. The next day, I received an email saying my offer was accepted.
After that I received an email from someone at Internet Reit with instructions on how to proceed and what would happen when they received payment (you can use CC, Paypal, etc). I sent the payment via paypal and as they specified in the email, they would open an account on my behalf at http://opensrs.com with the contact information they asked for earlier.
Once the money was sent and my account was created, they sent me the login information where I could sign in and manage the domain name. They requested that I transfer the domain name to my registrar within a year or I would risk losing it. So, I did.
I started the transfer at Godaddy and the next steps were a confusing mix of auth codes, keys and co
@caged
caged / local-conversion.js
Created November 29, 2010 19:11
All the parts we use to convert dates on the page to local times
var date = new Date();
var offset = date.getTimezoneOffset();
$.cookie('tzoffset', offset, { path: '/' })
/**
* Add age-based class name
*/
$this.find('p.date .timestamp').each(function() {
var el = $(this),
var crimes = [
{"crime": "Assault", "property": "States Avenue"},
{"crime": "Larceny", "property": "Marvin Gardens"},
{"crime": "Assault", "property": "States Avenue"},
{"crime": "Motor Vehicle Theft", "property": "Boardwalk"},
{"crime": "Assault", "property": "States Avenue"},
{"crime": "Larceny", "property": "Marvin Gardens"},
{"crime": "Assault", "property": "States Avenue"},
{"crime": "Drugs", "property": "Marvin Gardens"},
{"crime": "Drugs", "property": "Marvin Gardens"},
@caged
caged / NCAA-1A-Football.md
Created December 24, 2010 09:02
Different financial breakdowns of NCAA 1A Football 2003-2010. Data from the OPE Equity in Athletics Disclosure Website

2003 REPORT

Big Spenders

1. UCLA: $16,012,608
2. Ohio State: $14,728,966
3. USC: $14,394,589
4. Texas A&M: $14,060,784
5. Syracuse: $14,045,106
6. Miami: $13,445,769
7. Kentucky: $13,163,963
@caged
caged / stale.rb
Created January 4, 2011 20:11
Quick script to help you find and deal with old watched repos, forks and owned repos.
#!/usr/bin/env ruby
#
# Quick hack to help you find and deal with old watched repos, forks and owned repos.
#
# It will ask you to confirm once if you want to unwatch a repo.
#
# You can't unwatch your own repos, so they will need to be deleted.
# THIS SCRIPT WILL ASK YOU FOR CONFIRMATION TWICE BEFORE IT DELETES A REPO.
#
require 'rubygems'
@caged
caged / rspec2 and mongomapper
Created January 29, 2011 18:52
Stack level too deep
justin@justin ~pdxc[master]% rake spec:models --trace
(in /Users/justin/dev/lrr/rails/portlandcrime)
** Invoke spec:models (first_time)
** Invoke noop (first_time)
** Execute noop
** Execute spec:models
/Users/justin/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S bundle exec rspec ./spec/models/crime_spec.rb ./spec/models/neighborhood_spec.rb ./spec/models/offense_spec.rb ./spec/models/stop_spec.rb
FFFFFFFFFFF
Failures:
@caged
caged / gist:861108
Created March 8, 2011 21:27
Portland, OR Crime comparison Jan 1 - Mar 1 2010 and 2011
offense,2011,2010
Arson,30,22
Aggravated Assault,235,278
Burglary,530,719
Homicide,5,5
Larceny,2933,3271
Rape,26,30
Robbery,160,188
Theft from Auto,0,0
Motor Vehicle Theft,505,446
@caged
caged / gist:865243
Created March 11, 2011 00:22
Crimes within 100 yards of a Max stop 2009-2011
# Total Crimes Within 100 yards of a stop
== Top 20 2011
Mall/SW 5th Ave MAX Station: 63
Pioneer Place/SW 5th Ave MAX Station: 50
Gateway/NE 99th Ave TC MAX Station: 43
NW 6th & Davis St MAX Station: 34
Pioneer Square South MAX Station: 34
Skidmore Fountain MAX Station: 32
N Lombard TC MAX Station: 28
> db.crimes.count({'loc.lat': 45.524583810712635, 'loc.lon': -122.67135799839151})
59
> db.crimes.findOne({'loc.lat': 45.524583810712635, 'loc.lon': -122.67135799839151})
{
"_id" : ObjectId("4cdf7a5f8aebb1a25b00000e"),
"case_id" : 11988211,
"reported_at" : ISODate("2010-06-01T20:50:00Z"),
"district" : 822,
"precinct" : "PORTLAND PREC CE",
"address" : "NW DAVIS ST and NW 1ST AVE, PORTLAND, OR 97209",
@caged
caged / grouped-bar.coffee
Created March 22, 2011 20:29
d3 grouped bar
$ ->
if $('body[data-path=trends-index]').length != 0
$.getJSON '/trends.json', (data) ->
[weeks, months] = data
mlabels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
curYear = new Date().getUTCFullYear()
p = 20
nweeks = weeks[0].values.length
w = $('#trends').width() - p * 10
h = 200 - p