Skip to content

Instantly share code, notes, and snippets.

@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active April 2, 2024 15:19
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@kennethreitz
kennethreitz / flaskapp.py
Created June 9, 2012 15:38
My typical flask app base
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_heroku import Heroku
from flask_sslify import SSLify
from raven.contrib.flask import Sentry
from flask.ext.celery import Celery
@charliepark
charliepark / hatchshow.js
Created July 30, 2011 16:07
A jquery typography plugin.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(window).load(function(){
$().hatchShow();
});
jQuery.fn.hatchShow = function(){
$('.hsjs').css('display','inner-block').css('white-space','pre').each(function(){
var t = $(this);
t.wrap("<span class='hatchshow_temp' style='display:block'>");
var pw = t.parent().width();
@acdha
acdha / gist:f1f506b47a38574f3a5f
Last active August 29, 2015 14:13
Quick mock example showing how to simulate errors
>>> from unittest import mock
>>> import json
>>> m_o = mock.mock_open()
>>> m_o.side_effect = OSError('Insufficient voltage')
>>> json.load(m_o('foo.json', 'rb'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/mock.py", line 896, in __call__
return _mock_self._mock_call(*args, **kwargs)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/unittest/mock.py", line 952, in _mock_call