Skip to content

Instantly share code, notes, and snippets.

@eads
eads / jail-data.sh
Created February 6, 2014 06:10
Jail data
curl 26thandcalifornia.recoveredfactory.net/data/latest.sqlite > /tmp/latest.sqlite
sqlite3 /tmp/latest.sqlite
<script type="text/javascript">
$(document).ready(function() {
// Search 6 weeks back
var start = moment();
var end = start.clone().add('months', 1).add('weeks', 2);
// Set up collection
var collection = new EventAPICollection([], {
url: 'http://urltoapiproxy.com/events.json',
indexed: false,
{
"count": 34,
"total": 34,
"page": 1,
"results": [
{
"event_dates": [
{"event_date": "2014-02-18T18:00:00"},
{"event_date": "2014-02-25T18:00:00"},
{"event_date": "2014-03-04T18:00:00"},
var EventAPICollection = Backbone.Collection.extend({
timezoneRegex: /\+0000$/,
initialize: function(models, options) {
options = options || {};
this.params = options.params || {};
this.preprocess = options.preprocess || false;
this.indexed = (options.indexed != false) ? true : false;
this.start = moment();
this.end = this.start.clone().add('months', 2);
this.filtered = new Backbone.Collection([]);
@eads
eads / gist:2202964
Created March 26, 2012 04:40
Roufa's random sorting
<?php
$results = array();
$terms = array(1, 2);
foreach ($terms as $tid) {
$result = NULL;
$query = new EntityFieldQuery;
$query
@eads
eads / import_tix.py
Created March 28, 2012 22:18 — forked from brianboyer/import_tix.py
Unfuddle ticket generator
import csv, os.path
import os
import httplib, base64
import getpass
username = raw_input("Username:")
password = getpass.getpass("Password:")
subdomain = raw_input("Subdomain:")
project = raw_input("Project id:")
filename = raw_input("Tickets file:")
@eads
eads / a-baseline-for-frontend-developers.md
Created April 24, 2012 02:42
R Murphey post outline

Rebecca Murphey's "A baseline for frontend developers" http://rmurphey.com/blog/2012/04/12/a-baseline-for-front-end-developers/ in tweet form:

  1. Learn Javascript, then jQuery. Learn from the best.
  2. Use Git. Get a Github account.
  3. Use build tools and dependency management.
  4. Use in-browser development tools and learn debugging skills.
  5. Develop strong command line skills: ssh, scp, grep, ack, find, package managers and tools for OS and platform.
  6. Use client side (Javascript) templating for structured data.
  7. Write CSS using preprocessors like LESS and SASS.
  8. Test first, test often using tools like Grunt and Jasmine.
o__
_.>/ _
(_) \(_)
@eads
eads / socrata_query.py
Created July 9, 2012 18:08
Python reference script for Socrata inline query API
import requests
import json
url = "https://data.cityofchicago.org/api/views/INLINE/rows.json?method=getRows&start=0&length=10"
post = { 'originalViewId' : 'ijzp-q8t2', 'name' : 'inline filter' }
resp1 = requests.post(url, data=post) # Form encoded post payload
resp2 = requests.post(url, data=json.dumps(post)) # JSON encoded post payload
# -- Output --
# In [14]: resp1.content
# Out[14]: '{\n "code" : "invalid_request",\n "error" : true,\n "message" : "The view was not included in the post for an INLINE method call"\n}\n'
from Flask import g, jsonify
@blueprint.route('mydata.json')
def mydata():
context = g.current_site.get_context()
mydata = context['sheetname']
# ... process / filter mydata
return jsonify(**mydata)