Skip to content

Instantly share code, notes, and snippets.

if (typeof console === 'undefined') {
window.console = {
log: function () {}
};
}
function loggerFactory(label) {
return (function () {
var timestamp = function () {};
timestamp.toString = function () {
@jvanasco
jvanasco / feedgen_facebook.py
Last active March 9, 2016 19:33
This creates an extension that can be used with my fork of feedgen [https://github.com/jvanasco/python-feedgen/tree/feature-load_extension] It just adds a content element that renders as encoded cdata.
# -*- coding: utf-8 -*-
'''
feedgen_facebook.instant_article
~~~~~~~~~~~~~~~~~~~
Extends the FeedGenerator to produce Facebook InstantArticle.
:copyright: 2016, Jonathan Vanasco <jonathan@findmeon.com>
:license: FreeBSD
# -*- coding: utf-8 -*-
'''
feedgen_facebook.instant_article
~~~~~~~~~~~~~~~~~~~
Extends the FeedGenerator to produce Facebook InstantArticle.
:copyright: 2016, Jonathan Vanasco <jonathan@findmeon.com>
:license: FreeBSD
# -*- coding: utf-8 -*-
'''
feedgen_facebook.instant_article
~~~~~~~~~~~~~~~~~~~
Extends the FeedGenerator to produce Facebook InstantArticle.
:copyright: 2016, Jonathan Vanasco <jonathan@findmeon.com>
:license: FreeBSD
@jvanasco
jvanasco / parse_flake8.py
Last active February 18, 2016 19:34
Flake8 output was giving me a headache, so i wrote this quick parser. It will convert a `--file` of flake8 text to a "checklist" format , json or pretty-printed json.
import argparse
import os.path
import pprint
"""
flake8 parser.
this is a quick and dirty tool.
Flake8 output was giving me a headache, so i wrote this quick parser. It will convert a `--file` of flake8 text to a "checklist" format , json or pretty-printed json.
@jvanasco
jvanasco / parse_flake8.py
Created February 18, 2016 19:29
Flake8 output was giving me a headache, so i wrote this quick parser.
import argparse
import os.path
import pprint
_sample_data = """/Users/me/path/to/project/files/lib/data/bar.py:52:1: W293 blank line contains whitespace
/Users/me/path/to/project/files/lib/data/foo.py:101:1: W293 blank line contains whitespace
/Users/me/path/to/project/files/lib/utils/date.py:328:5: F811 redefinition of unused 'currentYear' from line 306
/Users/me/path/to/project/files/lib/utils/date.py:331:5: F811 redefinition of unused 'currentMonth' from line 310
/Users/me/path/to/project/files/lib/utils/date.py:334:5: F811 redefinition of unused 'currentDay' from line 314
/Users/me/path/to/project/files/lib/utils/foo.py:595:1: W293 blank line contains whitespace
@jvanasco
jvanasco / read_email.py
Created January 29, 2016 01:08
silly little file for reading postfix files on a dev server.
import argparse
import os
import subprocess
"""
$ mailq
show mail queue contents
$ sudo postcat -q {queue_id}
show message details
@jvanasco
jvanasco / memory_pickle.py
Created November 26, 2013 00:26
memory_pickle backend for dogpile.cache
"""
Memory Backend
--------------
Provides a simple dictionary-based backend.
"""
from dogpile.cache.api import CacheBackend, NO_VALUE
@jvanasco
jvanasco / gist:7532625
Created November 18, 2013 18:16
sqlalchemy hstore test
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext import mutable as sa_mutable
import sqlalchemy.dialects.postgresql
import string
import pdb
@jvanasco
jvanasco / _api.py
Created November 15, 2013 18:29
Example Pyramid Shell Script ( using a custom api )
from pyramid.paster import bootstrap
from pyramid.request import Request
from pyramid.scripting import prepare as prepare_request
import MYAPP
import MYAPP.lib.handlers
import sqlalchemy
import time