This file contains 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 | |
from collections import defaultdict | |
from rest_framework.renderers import * | |
from StringIO import StringIO | |
class CSVRenderer(BaseRenderer): | |
""" | |
Renderer which serializes to CSV | |
""" |
This file contains 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
mjumbewu@mjumbewu-xps ~ | |
$ uname -a | |
Linux mjumbewu-xps 3.5.0-22-generic #34+kamal11~DellXPS-Ubuntu SMP Fri Jan 11 09:12:57 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux | |
mjumbewu@mjumbewu-xps ~ | |
$ xinput list-props 12 | |
Device 'CyPS/2 Cypress Trackpad': | |
Device Enabled (132): 1 | |
Coordinate Transformation Matrix (134): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 | |
Device Accel Profile (255): 1 |
This file contains 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
#!/usr/bin/env python | |
#-*- coding:utf-8 -*- | |
import sys | |
from requests import get | |
import re | |
import time | |
pattern = re.compile(r'(\w+)\.legistar\.com') |
This file contains 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
var Complex = function(real, imag) { | |
if (!(this instanceof Complex)) { | |
return new Complex (real, imag); | |
} | |
if (typeof real === "string" && imag == null) { | |
return Complex.parse (real); | |
} | |
this.real = Number(real) || 0; |
This file contains 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 selenium import webdriver | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
from unittest import TestCase, main | |
from functools import wraps | |
from os import environ | |
# ============================================================ | |
# Helper functions -- skip these and go to the tests... | |
# ============================================================ |
This file contains 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
LINK_DETECTION_REGEX = /(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?).?(\s+|$)/gi | |
EMOJI_DIRECTORY = "/path/to/assets/emoji/20x20" | |
# Handlebars is presumed, but you could swap out | |
ESCAPE_EXPRESSION_FUNCTION = Handlebars.Utils.escapeExpression | |
MARKSAFE_FUNCTION = (str) -> new Handlebars.SafeString(str) | |
# Emoji unicode chars become images. |
This file contains 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 | |
# Setup and start BrowserStack Tunnel for your TravisCI build | |
# | |
# This script was adopted from Santiago Suarez Ordoñez's Sauce Connect | |
# setup script: https://gist.github.com/santiycr/5139565/ | |
# | |
# This script requires your .travis.yml to include the following private | |
# env variable: | |
# |
This file contains 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
// We went over: | |
/* | |
* - What's JS used for | |
* - Modifying document structure (the HTML is not the webpage, like the | |
* blueprint is not the building) | |
* - Retrieving data from a server without a page reload | |
* - Widgets and usability | |
*/ |
This file contains 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 rest_framework_csv.renderers import CSVRenderer | |
class PaginatedCSVRenderer (CSVRenderer): | |
results_field = 'results' | |
def render(self, data, media_type=None, renderer_context=None): | |
if not isinstance(data, list): | |
data = data.get(self.results_field, []) | |
return super(PaginatedCSVRenderer, self).render(data, media_type, renderer_context) |
This file contains 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
rvm system | |
travis encrypt SAUCE_USERNAME=$SAUCE_USERNAME --repo openplans/hatch | |
travis encrypt SAUCE_ACCESS_KEY=$SAUCE_ACCESS_KEY --repo openplans/hatch | |
# Add the values to your .travis.yml file | |
# | |
# NOTE: If you specify "--add env.global" with the encrypt command this will | |
# be done automatically. | |
# | |
# env: |