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
value label
920 A.C. Green
1920 A.J. Bramlett
2062 A.J. Guyton
1627773 AJ Hammons
201985 AJ Price
201166 Aaron Brooks
203932 Aaron Gordon
201189 Aaron Gray
1626151 Aaron Harrison
@johndhancock
johndhancock / loop.html
Last active December 21, 2018 19:56
sample handlebar loop and helper function
<!-- this small piece of html would be inside a larger template that's being used to draw something, such as a post -->
<ul>
{{#each pills}} <!-- your each function called on an array that's part of your data object -->
<li>{{getPillText this}}</li> <!-- passing the value of your array to a helper function (first argument in this template tag -->
{{#/each}}
</ul>
@johndhancock
johndhancock / mapbox.js
Created December 10, 2018 19:30
mapbox cursor and popups
/*
================================================================================
CREATE POPUP CONTENT
Creates the content that populates the popup
================================================================================
*/
function createPopupContent(feature) {
// grab the id property from the feature we've selected
@johndhancock
johndhancock / esc-close.js
Created October 19, 2018 14:51
Esc key closing modal
document.onkeydown = function(evt) {
evt = evt || window.event;
if (evt.keyCode == 27) {
alert('Esc key pressed.');
}
};
<div class="subscribe-cta">
<h4>Looking for the next great video story?</h4>
<p>If you enjoy profiles of interesting Texans and video reporting such as this, please consider supporting dallasnews.com by subscribing today.</p>
<a href="https://www.dallasnews.com/offers/sign-up">Subscribe now</a>
</div>
@johndhancock
johndhancock / election-metadata-instructions.md
Last active May 14, 2018 14:57
Entering election metadata

Creating the election

In the admin (elections-admin.dallasnews.com/admin), go to elections > add election > setup election

Entering races

  • Log in at elections-admin.dallasnews.com
  • Choose election
  • Under Results Entry, click Edit metadata
  • Click Add Race
  • Fill out the following form
  • Jursidiction: Only required if it's not a federal or state government level race that the AP will not provide metadata for
@johndhancock
johndhancock / README.md
Created October 2, 2017 15:59 — forked from achavez/README.md
Development machine setup
@johndhancock
johndhancock / ooyala-overrides.scss
Created September 12, 2017 15:23
Style overrides for ooyala player in interactives
.video-block {
width: 55%;
margin: 4.8rem 0;
font-size: 15px;
img {
max-width: 170px !important;
max-height: 18px !important;
}
}
.video-wrapper {

Starting a django project from the command line

django-admin startproject <project name>


Starting up the django server

From within the app root directory:

python manage.py runserver 0.0.0.0:8000


POSTGRESQL COMMAND LINE COMMANDS

Starting up a postgres database

pg_ctl -D /usr/local/var/postgres start

creating a database. This needs to be done via the command line outside of python

createdb <databasename>

viewing a database

psql <databasename>