Skip to content

Instantly share code, notes, and snippets.

View pkqk's full-sized avatar
📯
💨 🎶 🎵 🎶

Adam Sven Johnson pkqk

📯
💨 🎶 🎵 🎶
View GitHub Profile
require 'nokogiri'
require 'active_support'
require 'builder'
require 'digest'
class Statement
attr_accessor :rows
HEADINGS = [:date,:type,:description,:paid_out,:paid_in,:balance]
def initialize(file)
@pkqk
pkqk / 7books.py
Created November 11, 2010 17:43 — forked from tomcritchlow/7books.py
import cgi
import os
from google.appengine.ext.webapp import template
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.api import memcache
from google.appengine.api import urlfetch
@pkqk
pkqk / utf8ify.py
Created March 4, 2011 18:08
utf8 it the fuck up
import sys
import string
def force_utf8(fragment):
try:
return fragment.decode('utf8')
except:
try:
return fragment.replace('\xe2\x80?', '\xe2\x80\x9d').decode('utf8')
except:
@pkqk
pkqk / tztest.py
Created June 23, 2011 19:52
Timezones how the fuck do they work
from datetime import datetime, tzinfo, timedelta
class TimeZone(tzinfo):
def __init__(self, name, offset):
self.name = name
self.offset = offset
self.timedelta = timedelta(hours=offset)
def utcoffset(self, dt):
return self.timedelta
@pkqk
pkqk / Procfile
Created June 24, 2011 13:55
Python on Heroku cedar stack
web: bin/python test-webapp.py
@pkqk
pkqk / do-this-once
Created July 11, 2011 15:36
mentalist git hook
ssh user@remote-server
cd /path/to/working-tree
git config receive.denyCurrentBranch ignore
@pkqk
pkqk / pridegrid.js
Created August 3, 2011 13:37
The Pride Grid
javascript:if%20(!window.goviasGrid)%20{var%20grid%20=%20window.goviasGrid%20=%20document.createElement(%22canvas%22);var%20height%20=%20window.screen.height;grid.width%20=%20960;grid.style.width%20=%20grid.width%20+%20%22px%22;grid.style.margin%20=%20%220%20auto%22;grid.style.height%20=%20height%20+%20%22px%22;grid.style.position%20=%20%22fixed%22;grid.style.top%20=%20%220%22;grid.style.bottom%20=%20%220%22;grid.style.left%20=%20%220%22;grid.style.right%20=%20%220%22;grid.style.display%20=%20%22none%22;grid.style.zIndex%20=%20%2299999%22;grid.onclick%20=%20function(el)%20{grid.style.display%20=%20%22none%22;};var%20ctx%20=%20grid.getContext(%222d%22);var%20grad%20=%20ctx.createLinearGradient(0,0,960,0);grad.addColorStop(0,%20%27rgba(255,0,0,0.3)%27);grad.addColorStop(0.2,%20%27rgba(255,165,0,0.3)%27);grad.addColorStop(0.4,%20%27rgba(255,255,0,0.3)%27);grad.addColorStop(0.6,%20%27rgba(0,128,0,0.3)%27);grad.addColorStop(0.8,%20%27rgba(0,0,255,0.3)%27);grad.addColorStop(1,%20%27rgba(128,0,128,0.3)%27);ctx.fillS
@pkqk
pkqk / gist:1183508
Created August 31, 2011 13:11
ssl csr generation
openssl req -newkey rsa:1024 -nodes -keyout myssl.key -out myssl.csr
@pkqk
pkqk / grid.js
Created November 29, 2011 10:38
Uncompressed pridegrid.js
//javascript:if%20(!window.goviasGrid)%20{var%20grid%20=%20window.goviasGrid%20=%20document.createElement(%22canvas%22);var%20height%20=%20window.screen.height;grid.width%20=%20960;grid.style.width%20=%20grid.width%20%22px%22;grid.style.margin%20=%20%220%20auto%22;grid.style.height%20=%20window.screen.height%20%22px%22;grid.style.position%20=%20%22fixed%22;grid.style.top%20=%20%220%22;grid.style.bottom%20=%20%220%22;grid.style.left%20=%20%220%22;grid.style.right%20=%20%220%22;grid.style.display%20=%20%22none%22;grid.style.zIndex%20=%20%2299999%22;grid.onclick%20=%20function(el)%20{grid.style.display%20=%20%22none%22;};var%20ctx%20=%20grid.getContext(%222d%22);var%20grad%20=%20ctx.createLinearGradient(0,0,0,150);addColorStop(0,%20%27rgba(0,255,0,0.2)%27);addColorStop(0,%20%27rgba(0,255,100,0.8)%27);addColorStop(1,%20%27rgba(0,255,0,0.2)%27);ctx.fillStyle%20=%20grad;for%20(var%20x%20=%200;%20x%20*%2080%20<%20grid.width;%20x)%20{ctx.fillRect(10%20x%20*%2080,%200,%2060,%20height);}ctx.fillStyle%20=%20%22rgba(200,
if Rails::VERSION::MAJOR > 3 || Rails::VERSION::MINOR > 2
raise "Get rid of line #{__LINE__} in #{__FILE__}"
else
require 'schema_hotfix'
end