Skip to content

Instantly share code, notes, and snippets.

View chrislkeller's full-sized avatar

Chris Keller chrislkeller

View GitHub Profile
@chrislkeller
chrislkeller / halt_harassment.py
Last active March 6, 2017 18:42
Thinking through an Intent Schema and method to handle and process harassing language thrown at Amazon's Alexa service.
# random module required
import random
"""
plug_in method that responds
to "HaltHarassment" intent
"""
def halt_harassment():
list_of_responses = []
list_len = (len(list_of_responses) - 1)
@chrislkeller
chrislkeller / 2016_11_08_la_county_pres_by_precinct.csv
Created November 10, 2016 03:33
csv of precinct-by-precinct pre-certified results from Los Angeles County from the Nov. 8, 2016 presidential election
We can't make this file beautiful and searchable because it's too large.
row_ids,ballot_type,precinct_id,registration,ballots cast,turnout,stein,clinton,la_riva,trump,johnson,orig_location,concatanated_location,
1,precinct ballots, 0050003A ,1084,456,0.42,9,116,0,287,16,ACTON , 0050003A - ACTON ,
2,vote by mail ballots, 0050003A ,0,154,NULL,3,40,0,105,5,VOTE BY MAIL, 0050003A - VOTE BY MAIL,
3,total ballots, 0050003A ,1084,610,0.56,12,156,0,392,21,TOTAL, 0050003A - TOTAL,
4,precinct ballots, 0050004B ,592,244,0.41,1,54,3,175,3,ACTON , 0050004B - ACTON ,
5,vote by mail ballots, 0050004B ,0,98,NULL,0,34,0,59,2,VOTE BY MAIL, 0050004B - VOTE BY MAIL,
6,total ballots, 0050004B ,592,342,0.58,1,88,3,234,5,TOTAL, 0050004B - TOTAL,
7,precinct ballots, 0050005A ,733,306,0.42,2,62,2,220,11,ACTON , 0050005A - ACTON ,
8,vote by mail ballots, 0050005A ,0,113,NULL,0,33,0,78,2,VOTE BY MAIL, 0050005A - VOTE BY MAIL,
9,total ballots, 0050005A ,733,419,0.57,2,95,2,298,13,TOTAL, 0050005A - TOTAL,
"""
Requires twitter==1.14.3
You wil need to register a twitter application to acquire the proper authentication keys & tokens: https://apps.twitter.com/
* TWITTER_CONSUMER_KEY
* TWITTER_CONSUMER_SECRET
* TWITTER_ACCESS_TOKEN
* TWITTER_ACCESS_TOKEN_SECRET
"""
@chrislkeller
chrislkeller / script.py
Created July 7, 2015 23:03
Beginning of a class to work through the rap collaboration data...
import logging
import json
logger = logging.getLogger("root")
logging.basicConfig(
format = "\033[1;36m%(levelname)s: %(filename)s (def %(funcName)s %(lineno)s): \033[1;37m %(message)s",
level=logging.DEBUG
)
class SearchJsonFile(object):
@chrislkeller
chrislkeller / supplies.md
Last active August 29, 2015 14:23
Some hints as to what supplies new parents could use as the journey begins...

Friend No. 1

  • STROLLER/CARSEAT

    • Baby Jogger City Mini (We picked this over the Britax B-Agile. The Baby Jogger handle height was a little more comfortable for me, but they are essentially the same.)
    • Chicco KeyFit w/infant insert
    • Adapter to use the infant carseat with the stroller
    • Stroller console (useful for neighborhood walks, to hold a coffee mug, keys, burp cloth)
  • CRIB:

    • Ikea Sundvik (The reviews are mixed, because previous versions had a recall. But for us, it does the job, feels sturdy for the right price. We have friends who spent a lot more and are also happy, so to each their own.)
@chrislkeller
chrislkeller / _2015_#hackforLA_tweets.csv
Created June 9, 2015 06:28
Tweets from the June 6-7 #HackForLa
We can't make this file beautiful and searchable because it's too large.
"hashtag","tweet_utc_date","user_name","user_screen_name","bot_or_not","tweet_text","tweet_url","tweet_id","user_profile_image_url","user_location","source","in_reply_to_screen_name","in_reply_to_status_id","image_link","retweet_count","favorite_count","time_zone","geo_enabled","geography","coordinates","lang"
"#hackforLA","2015-06-09 05:50:30+00:00","Vicky Rodriguez","151ffed5b78a43f","False","RT @ImmigranNacion: Congratulations, Team ExBully @cybercodetwins @jorge_orrantia won the #HackForLA #HackforChange #antibullying #AINF htt","https://twitter.com/151ffed5b78a43f/status/608149149960146944","608149149960146944","http://abs.twimg.com/sticky/default_profile_images/default_profile_4_normal.png","","<a href=""http://twitter.com/download/android"" rel=""nofollow"">Twitter for Android</a>","","","","127","0","","False","","","en"
"#hackforLA","2015-06-09 04:04:34+00:00","Glorys ","GlorysPz","False","RT @ImmigranNacion: Congratulations, Team ExBully @cybercodetwins @jorge_orrantia won the #HackForLA #HackforCha
@chrislkeller
chrislkeller / _2015_talkpay_tweets.csv
Last active August 29, 2015 14:20
Scrape of #talkpay tweets on May 1, 2015 at 2:15 p.m. pacific... Based on code used for https://github.com/chrislkeller/nicar-tweets
We can't make this file beautiful and searchable because it's too large.
"hashtag","tweet_utc_date","user_name","user_screen_name","bot_or_not","tweet_text","tweet_url","tweet_id","user_profile_image_url","user_location","source","in_reply_to_screen_name","in_reply_to_status_id","image_link","retweet_count","favorite_count","time_zone","geo_enabled","geography","coordinates","lang"
"#talkpay","2015-05-07 23:00:55+00:00","Gina Helfrich, Ph.D.","ginahelfrich","False","RT @anitaborg_org: Are you an ally to #WomenIntech? Participate in the dialogue around #TalkPay. Most folks don't realize they're underpai","https://twitter.com/ginahelfrich/status/596449663026266112","596449663026266112","http://pbs.twimg.com/profile_images/583425594890661888/eUkdJ_ct_normal.jpg","Austin, TX","<a href=""http://twitter.com"" rel=""nofollow"">Twitter Web Client</a>","","","","12","0","Central Time (US & Canada)","False","","","en"
"#talkpay","2015-05-07 22:51:30+00:00","Suki Graves","SukiGraves","False","RT @radiatoryang: 76.4% of instructors across US higher education are adjuncts, and most live und
L.geoJson(hydrologic_regions, {
style: function(feature){
//console.log(layerData[i].hydrologic_region);
//var thisFeature = _.where(layerData, {hydrologic_region: feature.properties.FIRST_HRNA});

In django template, I am linking to css like this: <link href="..{% static 'css/style.css' %}" media="screen" rel="stylesheet" type="text/css" />

The baked output gives me exactly what I asked for which is: <link href="../static/css/main-foundation-style-v3.css" media="screen" rel="stylesheet" type="text/css" />

That works fine for each BuildableDetailView that is baked but requires me to change the path on the BuildableListView` to <link href="static/css/style.css" media="screen" rel="stylesheet" type="text/css" />

I do not have the optional build_path set in the BuildableListView class.

Also relevant: STATIC_ROOT = os.path.join(SITE_ROOT, "public", "static")

@chrislkeller
chrislkeller / init.py
Created January 10, 2015 00:38
When you need to name data blogs and data teams and you can't think of anything... script it.
import random
from random import shuffle
data_terms = [
"Parser",
"Numbered",
"Quantified",
"Quantifying",
"Clusters",
"Data",