Skip to content

Instantly share code, notes, and snippets.

View ndarville's full-sized avatar

N. Darville ndarville

  • Europe
View GitHub Profile
@ndarville
ndarville / django-pagination.html
Created September 2, 2012 15:45
Django Pagination Code
{% if page.has_other_pages %}
<div class="pagination">
<!-- Older page -->
{% if page.has_previous %}
<a href="?page={{ page.previous_page_number }}" title="Go to the older threads.">&lt;&nbsp;Older</a>
{% endif %}
<!-- First page -->
{% if current_page > 4 %}
<a href="?page=1">1</a>&nbsp;&#8943;
@ndarville
ndarville / tweets.csv
Last active November 18, 2016 14:17
Current @GenFlynn tweets as of 2016-11-18 (followings at https://gist.github.com/ndarville/b43bbca49574474ab6faaa1a650fec77)
ID Posted at Screen name Text
796935275368878081 2016-11-11 04:39:10 +0000 GenFlynn THE BEST PEOPLE WE HAVE IN OUR COUNTRY SERVE OR HAVE SERVED IN OUR ARMED FORCES. THANK YOU ALL FOR STANDING WATCH. https://t.co/xi7JMCBKuK
796934785826508800 2016-11-11 04:37:13 +0000 GenFlynn THANK YOU VETERANS!!! RT AS OFTEN AS YOU CAN AMERICA THE BEAUTIFUL https://t.co/TfkdIQZqaK
796370406722637826 2016-11-09 15:14:35 +0000 GenFlynn Max - He’s been an @realdonaldtrump supporter from the beginning. Ya gotta love this picture. Go Max!!! https://t.co/IN7VQfmZJI
796242266553798656 2016-11-09 06:45:24 +0000 GenFlynn Thank you to all who sent me messages (good, bad & some really ugly 1's)...We R going to #MAGA and we are going to start winning again! RT
796240419726196739 2016-11-09 06:38:04 +0000 GenFlynn RT @GenFlynn: Just read the first paragraph. Teddy Roosevelt - The Man In The Arena @realDonaldTrump is this man. God Bless USA! https://t.co/MobktXt8e1
@ndarville
ndarville / README.md
Created July 6, 2016 13:22
Danske webforsider på dagen for Chilcotrapporten, 2016-07-06
@ndarville
ndarville / INSTALLATION.md
Last active March 29, 2016 02:38
News Genius-blocker

Just copy-paste the code to the bottom of your <body> tag in the HTML of the pages you don’t want to be annotated.

On Tumblr, go to https://www.tumblr.com/customize/yourblogname, click “Edit HTML”, and put the code at the bottom before the </body> tag. Here is what the bottom of my HTML at https://essays.tumblr.com looks like, using the default theme:

        {block:IfGoogleAnalyticsID}
            <script>
              (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
              (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
              m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
@ndarville
ndarville / download-bucket.yml
Last active January 11, 2016 10:15
s3_website.yml
max_age:
"*.csv": <%= 60 * 30 %>
"*.tsv": <%= 60 * 30 %>
"*.json": <%= 60 * 30 %>
"*": <%= 60 * 5 %>
gzip: true
gzip:
- .html
- .css
@ndarville
ndarville / README.md
Last active January 3, 2016 14:39
Majority chart

(This chart is a part of the d3-charts collection available [here][collection].)


This is a majority chart, my own tweak of a plain symmetry bar chart. It displays a vertical bar chart with each bar anchored around a common origin of 50%. The code was based on Mike Bostock's ["Bar Chart with Negative Values" chart][original], inspired by a [post][junk-charts] on Junk Charts, and was originaly used for an article I wrote, ["Women in Tech by the Numbers"][post], in which I explained the chart like so:

Just in case the chart needs explaining, each bar displays how the men outnumber the women---and vice versa. If a group of software engineers at a company is 90% male, the bars will display the differential of 40% from an even 50%.

Because the point of the chart is to display majorities, there is no point in showing the first 50% of a majority; it is completely redundant, when you can just show the percentage one side is ahead of the other.

@ndarville
ndarville / README.md
Last active December 31, 2015 02:09
The 2014 Budget in Context

This chart is a variation of my relative-budgets chart, part of the d3-charts collection available here.)


The data for the chart was based on this one from All in with Chris.

@ndarville
ndarville / README.md
Created November 28, 2013 19:58
Proportion Chart

Shows a bar divided into shares or proportions of a total value.

@ndarville
ndarville / README.md
Last active December 29, 2015 13:49
Finanslov 2014
@ndarville
ndarville / README.md
Last active December 29, 2015 09:09
Symmetric Stack Chart

(This chart is a part of the d3-charts collection available [here][collection].)


This is an symmetric stack chart with each bar anchored around a common origin. The code was based on Mike Bostock's ["Bar Chart with Negative Values" chart][original] and inspired by a [post][junk-charts] on Junk Charts.

Unlike the examples in the two links, the x axis of this implementation has a symmetric x-axis to ensure readers aren't [perceptually manipulated][perception] by one side taking up a larger, more imposing, share of the space than the other.

The main thing to have in mind when using this particular chart is that the order of your data rows matter; a part of the story this chart tells uses the vertical dimension, so embrace it. Usually, you'll see people use the chart for demographics with people divided by age or income, but there are plenty of other uses you'll realize soon enough.