Skip to content

Instantly share code, notes, and snippets.

@octaflop
octaflop / keyerror
Created February 10, 2012 02:08
KeyError at /products/apparel/womens-apparel/wet/+womens-wetsuit/
Environment:
Request Method: GET
Request URL: http://localhost:8000/products/apparel/womens-apparel/wet/+womens-wetsuit/
Django Version: 1.3.1
Python Version: 2.6.6
Installed Applications:
['localeurl',
@octaflop
octaflop / admin.py
Created February 10, 2012 05:27
Key error
# -*- coding:utf-8 -*-
from django import forms
from django.contrib import admin
from django.conf import settings
from django.forms.models import modelform_factory
from django.utils.translation import ugettext_lazy as _
import django.db.models
from categories.app import product_app
import pricing.models
@octaflop
octaflop / traceback
Created February 20, 2012 03:58
deluge traceback
19:58:13.154 [ERROR ][deluge.pluginmanagerbase :158 ] Unable to instantiate plugin 'Blocklist' from '/usr/local/lib/python2.7/dist-packages/deluge-1.3.900_dev-py2.7.egg/deluge/plugins/Blocklist-1.2-py2.7.egg'!
19:58:13.154 [ERROR ][deluge.pluginmanagerbase :1164] No module named init
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/deluge-1.3.900_dev-py2.7.egg/deluge/pluginmanagerbase.py", line 154, in enable_plugin
cls = entry_point.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1955, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python2.7/dist-packages/deluge-1.3.900_dev-py2.7.egg/deluge/plugins/Blocklist-1.2-py2.6.egg/deluge/plugins/blocklist/__init__.py", line 37, in <module>
ImportError: No module named init
@octaflop
octaflop / s2prod.markdown
Created May 26, 2012 18:05
Some notes about going from services to product

Don't do hourly billing!

@octaflop
octaflop / fail.sh
Created November 8, 2012 20:30
Flask-Login Usage Testing
======================================================================
FAIL: test_login (__main__.JoyHikeDBCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "dbtests.py", line 68, in test_login
assert "logged in as" in rv.data
AssertionError
======================================================================
FAIL: test_logout (__main__.JoyHikeDBCase)
@octaflop
octaflop / dbtests.py
Created November 10, 2012 01:38
Flask sqlalchemy declarative db configuration
import someapp as j
from someapp.db.database import init_db, drop_db
import unittest
import fixtures
from BeautifulSoup import BeautifulSoup as bs
appurl = "/api/%s"
header = { "content-type": "application/json" }
@octaflop
octaflop / joyhikedbtest.py
Created November 10, 2012 01:44
flask integration testing with postgresql and sqlalchemy
import joyhikeserve as j
from joyhikeserve.db.testdatabase import init_db, drop_db
import unittest
import fixtures
from BeautifulSoup import BeautifulSoup as bs
appurl = "/api/%s"
header = { "content-type": "application/json" }
@octaflop
octaflop / beautiful_trees.py
Last active December 12, 2015 05:08
beautiful_trees.py fetchs Vancouver's open tree data and downloads all varieties of trees it can from wikipedia infoboxes.
# coding: utf-8
import urllib2
from urllib2 import HTTPError
from StringIO import StringIO as stio
from bs4 import BeautifulSoup
import zipfile
import pprint
import simplejson
def robot():
@octaflop
octaflop / models_blog.js
Last active December 13, 2015 22:08
Wrapping my head around async in expressjs
var redis = require("redis"),
client = redis.createClient();
var MODELSET_ID = "cogblog.v.0.0.0_"
function pad(n) {
return n<10 ? '0'+n : n
}
function add_blog_entry(id) {
@octaflop
octaflop / blog.js
Last active December 13, 2015 23:18
exports.get = function(req, cb) {
if (req.params.id) {
var id = req.params.id;
var ret = {};
var len = 4; // The number of calls we'll be making
function callback() {
--len || cb(ret);
}
client.hgetall(MODELSET_ID + ":blog:entry:" + id, function(err, reply) {