Skip to content

Instantly share code, notes, and snippets.

Avatar

barbara shaurette mechanicalgirl

View GitHub Profile
View test.json
This file has been truncated, but you can view the full file.
{
"count": 5760,
"filters": {
"dates": "20150401:20161203",
"tags": "game_preview|chr:entryGroup"
},
"ts": [
{
"distance": 72,
View gist:a22f2ca5efd7771b5c1b0d13bf866710
The code I have now that doesn't work (I only know it's not working because the map changed - the script isn't reading the coordinates I'm trying to pass in):
var testData = {
max: 8,
data: null
};
$.getJSON('traffic_fatalities.json', function(traffic_data) {
console.log(traffic_data);
testData.data = traffic_data;
View weathervane-dev error
(venv)[ec2-user@ip-172-30-4-121 ~]$ /opt/cmgd/venv/src/weathervane/weather/manage.py weatherctl fetch all
Traceback (most recent call last):
File "/opt/cmgd/venv/src/weathervane/weather/manage.py", line 13, in <module>
execute_from_command_line(sys.argv)
File "/opt/cmgd/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/opt/cmgd/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/cmgd/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 263, in fetch_command
app_name = get_commands()[subcommand]
View gist:5c863ef1379152d42d649592e1349c29
++ deactivate nondestructive
2016-06-13 15:18:50,729 [INFO] ++ unset pydoc
2016-06-13 15:18:50,729 [INFO] ++ '[' -n '' ']'
2016-06-13 15:18:50,729 [INFO] ++ '[' -n '' ']'
2016-06-13 15:18:50,729 [INFO] ++ '[' -n /bin/bash -o -n '' ']'
2016-06-13 15:18:50,729 [INFO] ++ hash -r
2016-06-13 15:18:50,729 [INFO] ++ '[' -n '' ']'
2016-06-13 15:18:50,729 [INFO] ++ unset VIRTUAL_ENV
2016-06-13 15:18:50,729 [INFO] ++ '[' '!' nondestructive = nondestructive ']'
2016-06-13 15:18:50,729 [INFO] ++ VIRTUAL_ENV=/opt/cmgd/venv
View gist:d80ca244410df46c4047
export CMG_CONF=/your/path/to/mediaserver/mediaserver/apimage/test_config.json
python2.6 manage.py test apimage --settings='nodb_settings'
@mechanicalgirl
mechanicalgirl / YC
Created Aug 12, 2014
Doing more with Young Coders
View YC
This was the easiest way I could think of to reply to all of you in under 140 characters. :)
My hope for 2015 is to take Young Coders beyond what we're doing with it already. It's great that we're reaching kids at Python conferences. But those kids are, by and large, the children of programmers and probably already have some exposure to what we're teaching them and access to the tools they need to succeed.
What I really want to do, though, is take the class out to underserved kids, kids who maybe wouldn't get the opportunity to be exposed to programming otherwise. I'm happy to arrange all the details - venues, signups, even my own travel to some extent (although I'll start small and work local). But teaching programming to underserved kids means giving them computers - not just the RPis and cards, but all the peripherals, and maybe even books, that they'd need to get set up at home and keep going on their own.
It's the costs for that equipment, of course, that's holding me back. I could apply for a PSF g
View gist:5312503
def _month_bounds(date):
"""
Helper: return the first and last days of the month for the given date.
"""
first_day = date.replace(day=1)
if first_day.month == 12:
last_day = first_day.replace(year=first_day.year + 1, month=1)
else:
last_day = first_day.replace(month=first_day.month + 1)
@mechanicalgirl
mechanicalgirl / gist:4946306
Last active Dec 13, 2015
Drag and drop js
View gist:4946306
jQuery(document).ready(function() {
var $ = jQuery;
/*
Execute revealDropzone() every 1000 milliseconds
Identify all of the input fields - once all of them have been populated,
reveal the drop zone
If any of the text inputs becomes empty again, hide the drop zone again
*/
setInterval(revealDropzone, 1000);
@mechanicalgirl
mechanicalgirl / gist:4119167
Created Nov 20, 2012
sample TX legislator data from the sunlight API
View gist:4119167
[
{ u'+capital_address': u' P.O. Box 12068, Capitol Station\nAustin, TX 78711\n(512) 463-0102',
u'+district_address': u' 18601 LBJ Freeway, Ste. 400\nMesquite, TX 75150\n(972) 279-1800',
u'active': True,
u'chamber': u'upper',
u'country': u'us',
u'created_at': u'2010-06-19 03:51:42',
u'district': u'2',
u'first_name': u'Bob',
u'full_name': u'Bob Deuell',
@mechanicalgirl
mechanicalgirl / redvblue_public
Created Aug 28, 2012
Playing around with the Sunlight Labs 'openstate' API
View redvblue_public
"""
This script pulls from the Sunlight Labs "openstates" API
to get information about legislators at the state level,
do a count of their party affiliations,
and return that information as
1) a JSON object for visualizations
2) a table suitable for embed into an HTML page
Information about the specific API used can be found here:
http://python-sunlight.readthedocs.org/en/latest/services/openstates.html