This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging, sys | |
| logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| browser_mapping = ( | |
| ('MSIE 7.*Trident/4.0', 'Internet Explorer 8.0'), | |
| ('MSIE 6.0', 'Internet Explorer 6.0'), | |
| ('MSIE 7.0', 'Internet Explorer 7.0'), | |
| ('MSIE 8.0', 'Internet Explorer 8.0'), | |
| ('MSIE 9.0', 'Internet Explorer 9.0'), | |
| ('MSIE 10.0', 'Internet Explorer 10.0'), | |
| ('Trident/7.0; rv:11.0','Internet Explorer 11.0'), | |
| ('droid', 'Android'), | |
| ('Chrome', 'Chrome'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select * from Table FORCE INDEX (primary) | |
| where /* lots of complex where clauses */ | |
| order by id desc limit 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery.get('https://api.github.com/gists/3a065d804c44b0149eac', function(data) { | |
| console.log(data.files['file1.txt'].content) | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.http import HttpResponse | |
| from django.views.decorators.csrf import csrf_exempt | |
| import requests, json | |
| # Get an OAuth token from https://www.eventbrite.com/myaccount/apps/ | |
| # Create a new app, then expand the expandy-thingy and copy out the | |
| # 'Your personal OAuth token' value. | |
| EVENTBRITE_OAUTH_TOKEN = '...' | |
| # Should look something like https://yoursite.slack.com/services/hooks/incoming-webhook?token=xxx...xxx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| flatten() and unflatten() | |
| A pair of functions that can convert an arbitrary JSON object into a | |
| flat name/value pair dictionary and back again, preserving type | |
| information and handling both nested lists and nested dictionaries. | |
| For example: | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv, sys | |
| def fetch_data(): | |
| # Returning some example data - hit a JSON API or something here | |
| return [{ | |
| "name": "Name 1", | |
| "age": 32, | |
| "description": "Look, we can use commas and\ttabs & stuff in here!", | |
| }, { | |
| "name": "Name 2", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.conf import settings | |
| from django.http import HttpResponse | |
| from django.conf.urls import url | |
| settings.configure( | |
| DEBUG = True, | |
| SECRET_KEY = 'yourrandomsecretkey', | |
| ROOT_URLCONF = __name__, | |
| MIDDLEWARE_CLASSES = (), | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Create scratch with 'virtualenv --python=python2.7 scratch && scratch/bin/pip install ipython' | |
| scratch/bin/pip install $1 | |
| scratch/bin/ipython -c "import $1; print '\nimported $1'" -i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2014-10-22: https://pypi.python.org/packages/source/l/librabbitmq/librabbitmq-1.5.2.tar.gz#md5=842aea204fcfb5d7a541ae72d5ad38bc | |
| 2014-10-28: https://pypi.python.org/packages/source/r/raven/raven-3.5.2.tar.gz#md5=a3fe6c823d01cca0802b78d43cc4953a | |
| 2014-10-31: https://pypi.python.org/packages/source/e/exam/exam-0.10.5.tar.gz#md5=cb5a5848f3779283054d5556a6c16f55 |