Skip to content

Instantly share code, notes, and snippets.

View johndhancock's full-sized avatar

John Hancock johndhancock

  • The Boston Globe
  • Dallas, Texas
View GitHub Profile
@johndhancock
johndhancock / django-commands.md
Last active May 25, 2017 21:05
django commands

In project directory command line where website is to be created ...

STARTING PROJECT

django-admin startproject <website_name>


In created project command line ...

RUN SERVER
@johndhancock
johndhancock / terminalCommands.md
Last active June 7, 2017 16:25
Handy terminal commands for various things.

In command line of directory desired:

Virtual Env

Creating viruatl environment

virtualenv venv

Specifying python version upon creation

virtualenv venv --python=python3

Stepping into the virtual environment
@johndhancock
johndhancock / jquery ajax request
Created March 2, 2017 14:44
jquery ajax request that doesn't cache data
$.ajax({
dataType: "json",
url: "<url for json here>",
success: <function to run when request is done ex: filterdata>,
cache: false
});
@johndhancock
johndhancock / dropdown.css
Last active September 2, 2015 12:55
Dropdown panels
.dropList .dropHed {
cursor: pointer;
}
.dropList .dropItem {
background-color: rgb(240,240,240);
border-radius: 2px;
margin-bottom: .6rem;
padding: 1rem;
}
.dropList .dropHed span.cardinal {
@johndhancock
johndhancock / responsiveD3.js
Created July 20, 2015 16:40
Starter js for responsive d3 charts. Assumes jquery and a div for your d3 chart with id of "chart". Your d3 charts will redraw to the new #chart with upon window resize
// this is a starter template for a responsive d3 chart
// it assumes you're using jquery, and that the div your chart
// will live in has an id of "chart"
$(document).ready(function() {
var windowWidth = $(window).width();
//variable setup: chartcontainer and it's width
@johndhancock
johndhancock / export
Created June 7, 2015 16:13
Export JSON to S3
///////////////////////////////////////////////////////
// EXPORT JSON to S3 ///////////////////////////
////////////////////////////////////////////
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [
{name: "Publish to DMN data store", functionName: "exportS3"},
];
ss.addMenu("Publish Data", menuEntries);
@johndhancock
johndhancock / customJS.js
Last active August 29, 2015 14:20
Map repositioning on scroll
$(document).ready(function() {
//custom scripting goes here
// map setup
L.Browser.webkit3d = false;
var map;
map = L.map('map').setView([32.8935772, -96.8870228],10);
@johndhancock
johndhancock / TouchesData.csv
Created April 20, 2015 03:57
Knight Project Week 5: Running backs with 420+ touches
Player Age Games Started Rush RushYds RushTD Rec RecYds RecTD Touches YScm Era
James Wilder (1981) 23 16 16 107 370 4 48 507 1 155 877 pre
James Wilder (1982) 24 9 9 83 324 3 53 466 1 136 790 pre
James Wilder (1983) 25 10 10 161 640 4 57 380 2 218 1020 pre
James Wilder (1984) 26 16 16 407 1544 13 85 685 0 492 2229 current
James Wilder (1985) 27 16 16 365 1300 10 53 341 0 418 1641 post
James Wilder (1986) 28 12 12 190 704 2 43 326 1 233 1030 post
James Wilder (1987) 29 12 12 106 488 0 40 328 1 146 816 post
James Wilder (1988) 30 7 7 86 343 1 15 124 0 101 467 post
James Wilder (1989) 31 15 4 70 244 0 36 335 3 106 579 post
@johndhancock
johndhancock / audio bug css
Last active August 29, 2015 14:19
Floating Audio player
/*clearfix hack */
.clearFix:after {
content: "";
display: table;
clear: both; }
.audioBug {
position: fixed;
bottom: 5%;
width: 4rem;
@johndhancock
johndhancock / TouchesData.csv
Created April 12, 2015 18:26
Running Backs with 420+ touches (Week 4)
Player Age Games Started Rush RushYds RushTD Rec RecYds RecTD Touches YScm
James Wilder (1981) 23 16 16 107 370 4 48 507 1 155 877
James Wilder (1982) 24 9 9 83 324 3 53 466 1 136 790
James Wilder (1983) 25 10 10 161 640 4 57 380 2 218 1020
James Wilder (1984) 26 16 16 407 1544 13 85 685 0 492 2229
James Wilder (1985) 27 16 16 365 1300 10 53 341 0 418 1641
James Wilder (1986) 28 12 12 190 704 2 43 326 1 233 1030
James Wilder (1987) 29 12 12 106 488 0 40 328 1 146 816
James Wilder (1988) 30 7 7 86 343 1 15 124 0 101 467
James Wilder (1989) 31 15 4 70 244 0 36 335 3 106 579