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
| 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 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 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 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
| 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 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
| #!/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 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
| 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 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 | |
| from collections import defaultdict | |
| from rest_framework.renderers import * | |
| from StringIO import StringIO | |
| class CSVRenderer(BaseRenderer): | |
| """ | |
| Renderer which serializes to CSV | |
| """ |
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
| #!/usr/bin/env python | |
| import os | |
| from django.core.management import setup_environ | |
| import settings | |
| setup_environ(settings) | |
| from django.conf import settings | |
| from django.contrib.gis.gdal import CoordTransform, DataSource, OGRGeometry, OGRGeomType | |
| from django.core.management.base import BaseCommand |
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 djangorestframework.renderers import JSONRenderer | |
| from colorpicks.serializer import ColorSerializer | |
| # NOTE: Resources are nominally much less present in the | |
| # restframework2 branch. You use Serializers directly | |
| # to achieve the same thing. | |
| obj = ... | |
| serializer = ColorSerializer(instance=obj) | |
| data = serializer.data |
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
| # chadmasso has an interesting solution to using Django template tags in your | |
| # Handlebars JS templates: precompile the template to Handlebars JS code, and | |
| # then run the template through Django's template renderer. | |
| # | |
| # https://github.com/chadmasso/pencilthin | |
| # | |
| # Below are two possibilities for how a similar thing would be accomplished in | |
| # django-jstemplate. | |
| # | |
| # 1) PREPROCESSOR(S) |
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
| mjumbewu@lemur:~$ uname -a | |
| Linux lemur 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux | |
| mjumbewu@lemur:~$ xinput list-props 12 | |
| Device 'SynPS/2 Synaptics TouchPad': | |
| 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 (254): 1 | |
| Device Accel Constant Deceleration (255): 2.500000 | |
| Device Accel Adaptive Deceleration (256): 1.000000 | |
| Device Accel Velocity Scaling (257): 12.500000 |