Skip to content

Instantly share code, notes, and snippets.

View fweep's full-sized avatar

Jim Stewart fweep

View GitHub Profile
@fweep
fweep / testlogging.py
Created November 29, 2013 15:34
pyramid logging example
#!/usr/bin/env python
from pyramid.paster import bootstrap
stuff = bootstrap("development.ini")
import logging
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
# encoding: utf-8
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import ForeignKeyConstraint
from sqlalchemy.types import INTEGER
from sqlalchemy.types import TEXT
CREATE TABLE account (
id SERIAL NOT NULL UNIQUE,
name TEXT NOT NULL
);
CREATE TABLE credit_card (
id SERIAL NOT NULL UNIQUE,
account_id INTEGER NOT NULL REFERENCES account(id),
card_number TEXT NOT NULL,
UNIQUE (account_id, id)
@fweep
fweep / gist:aefb9d8fbfed6478fccd
Created May 6, 2014 18:16
pyramid_mailer traceback
Traceback (most recent call last):
File "/Users/jim/uniregistrar/uniregistrar/uniregistrar/lib/tasks/job_task.py", line 79, in execute_job_task
response = task_method(job_task)
File "/Users/jim/uniregistrar/uniregistrar/uniregistrar/lib/tasks/file_upload_email_forward_task.py", line 29, in task_file_upload_email_forward
result = file_upload_email_forward(user_id, account_id, job_data)
File "/Users/jim/.virtualenv/unireg/lib/python2.7/site-packages/celery-3.1.8-py2.7.egg/celery/local.py", line 167, in <lambda>
__call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
File "/Users/jim/.virtualenv/unireg/lib/python2.7/site-packages/celery-3.1.8-py2.7.egg/celery/app/trace.py", line 417, in __protected_call__
return orig(self, *args, **kwargs)
File "/Users/jim/.virtualenv/unireg/lib/python2.7/site-packages/celery-3.1.8-py2.7.egg/celery/app/task.py", line 419, in __call__
@fweep
fweep / gist:5af1c5fc8084fe219129
Last active August 29, 2015 14:01
SQL problem
create table file_upload (
id serial not null,
name text
);
create table reg_domain (
id serial not null,
name text
);
@fweep
fweep / karma.config.js
Created November 8, 2016 12:58
Karma config
'use strict';
var path = require('path');
module.exports = function (config) {
config.set({
basePath: '../webpack/test',
reporters: ['mocha'],
port: 9876,