Skip to content

Instantly share code, notes, and snippets.

@TylerFisher
TylerFisher / gist:4028737
Created November 7, 2012 00:35 — forked from gotoplanb/gist:4028725
NPR 8-bit without audio
javascript:var%20s%3Ddocument.createElement(%27link%27)%3Bs.rel%3D%27stylesheet%27%3Bs.type%3D%27text/css%27%3Bs.href%3D%27http://jeremygilbert.com/extras/12FA-NPR-8Bit/css/app-8bit.css%27%3Bdocument.body.appendChild(s)%3B
@TylerFisher
TylerFisher / hosting-on-github.md
Last active December 5, 2024 22:41
Basic steps for hosting on Github

Hey there, apparently people are still using this Gist from 2013! It's out of date! Consult the Github docs.

Steps for Hosting a Website on GitHub

  1. Create a GitHub account on github.com.
  2. Download either [GitHub for Mac][1] or [GitHub for Windows][2], depending on your operating system. Open the app and log in using the account you just created.
  3. (On Mac): After you login, click advanced and make sure that your name and email are correct. Then, click "Install Command Line Tools", just in case you want to start using the command line later in life.
  4. Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the "Push to GitHub?" box is checked.
  5. Move your website's files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level
@TylerFisher
TylerFisher / index.html
Created April 23, 2014 15:02
Looping over a copytext spreadsheet to find jinja2 templates
{% for row in COPY.content %}
{% include "%s.html"|format(row.template) ignore missing %}
{% endfor %}
@TylerFisher
TylerFisher / slide.html
Created April 23, 2014 15:03
Slide template from Borderland
<div {% if row.data_panel %} data-anchor="{{ row.data_panel.lower() }}" {% endif %} class="slide {% if row.extra_class %} {{ row.extra_class }} {% endif %}" style="{% if row.color %} background-color: {{ row.color }}; {% endif %}" {% if row.image %} data-bgimage="{{ row.image }}" {% endif %}>
<div class="text full-block {% if row.text_background == 'yes' %} text-bg {% endif %}">
<div class="full-block-cell">
<div class="full-block-content">
{{ row.text }}
</div><!--full-block-content-->
</div><!--full-block-cell-->
</div><!--full-block-->
</div><!--slide-->
@TylerFisher
TylerFisher / code-structure.js
Created May 21, 2014 17:39
An example of good code structure for Unclass
// all variables I will use
var photosArray;
var photosArrayCounter;
var $visiblePhoto;
// all functions
var changePhoto = function() {
if ($(this).hasClass('next') && photosArrayCounter < photosArray.length) {
@TylerFisher
TylerFisher / LICENSE
Last active August 29, 2015 14:08
This code will refresh all users on your webpage upon deployment of a timestamp.json file to S3. We used this to deploy hotfixes on election night for elections.npr.org. It requires Fabric (a Python library for running tasks on the command line) and jquery-cookie.js, but could easily be refactored to not.
The MIT License (MIT)
Copyright (c) 2014 NPR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@TylerFisher
TylerFisher / LICENSE
Last active August 29, 2015 14:08
Our elections app relied on a 16x9 slide layout across all devices, regardless of the size of the actual screen. We wrote some tricky CSS and JavaScript to achieve this.
The MIT License (MIT)
Copyright (c) 2014 NPR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@TylerFisher
TylerFisher / LICENSE
Last active March 22, 2020 11:26
A basic library and example usage for JavaScript-based Chromecast apps, developed by NPR Visuals for elections.npr.org.
The MIT License (MIT)
Copyright (c) 2014 NPR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@TylerFisher
TylerFisher / tally.py
Created December 17, 2015 15:29
Sample agate-based script for tallying the results for the All Songs Considered listeners poll: http://www.npr.org/sections/allsongs/2015/12/16/459822811/poll-results-listeners-pick-their-favorite-albums-of-2015
import agate
data = {}
output = {}
"""
Converts all entries to lowercase for easier matching.
"""
def process_csv():
lowered_list = []
@TylerFisher
TylerFisher / april_7_lesson.md
Last active April 7, 2016 18:29 — forked from jeremyjbowers/april_7_lesson.md
The April 7th Class Lecture

April 7th Lesson

Now that we've all had a good face-to-face, we're going to accomplish two things today.

First, we're going to add a new route to your app.py that will let you see a single incident / detainee by clicking on a link from your home page.

Second, we're going to walk through how CSS works and discuss how you might use Materialize to clean up your site's design.

Update your app.py

Current state of your app.py