Skip to content

Instantly share code, notes, and snippets.

View fweep's full-sized avatar

Jim Stewart fweep

View GitHub Profile
@fweep
fweep / gist:c885da9c4d0472dd2fba7558459624d6
Last active March 23, 2026 00:28
Movie Literary Sources

Movies Based on Literary Sources

Movie Year Source Type Source Title Author
12 Angry Men 1957 Play Twelve Angry Men Reginald Rose
12 Years a Slave 2013 Memoir Twelve Years a Slave Solomon Northup
2001: A Space Odyssey 1968 Short Story "The Sentinel" Arthur C. Clarke
25th Hour 2002 Novel The 25th Hour David Benioff
A Beautiful Mind 2001 Biography A Beautiful Mind Sylvia Nasar
A Charlie Brown Christmas 1965 Comic Strip Peanuts Charles M. Schulz
@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,
@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 / 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__
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)
# 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
@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__)
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from myapp.tests.base import ViewTestBase
from myapp.views.authentication.login import login_view
from myapp.tests.helper import create_user
class LoginViewTests(ViewTestBase):
def setUp(self):
@fweep
fweep / test_login.py
Last active December 20, 2015 13:39
Pyramid, WebTest, SQLAlchemy functional test
import unittest
from myapp.tests.helper import create_user
SQLALCHEMY_URL = "postgresql://unireg@localhost/myapp"
def _init_testing_db():
from sqlalchemy import create_engine
from myapp.models import DBSession, Base
engine = create_engine(SQLALCHEMY_URL)
@fweep
fweep / gist:5306664
Created April 4, 2013 00:20
before filter example
class StudentsController < ApplicationController
before_filter :find_student, only: [:show, :update]
def show
# @student will already be loaded here
# do whatever
end
private