Skip to content

Instantly share code, notes, and snippets.

View monkeycycle's full-sized avatar

Michael Pereira monkeycycle

View GitHub Profile
@monkeycycle
monkeycycle / .block
Created December 2, 2019 01:35 — forked from mbostock/.block
California Population Density II
license: gpl-3.0
height: 1100
border: no
After editing .gitignore to match the ignored files, you can do git ls-files -ci --exclude-standard to see the files that are included in the exclude lists; you can then do git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached to remove them from the repository (without deleting them from disk).
Edit: You can also add this as an alias in your .gitconfig file so you can run it anytime you like. Just add the following line under the [alias] section:
apply-gitignore = !git ls-files -ci --exclude-standard -z | xargs -0r git rm --cached
(The -r flag in xargs prevents git rm from running on an empty result and printing out its usage message.)
Now you can just type git apply-gitignore in your repo, and it'll do the work for you!
@monkeycycle
monkeycycle / gist:20655e4c4cfe1285fc1e6f3e296bc159
Created December 12, 2017 16:36 — forked from ahamez/flightradar24.py
Read data from flightradar24
#! /usr/bin/env python
import json
import time
import shelve
import urllib
import urllib.request
DB = 'flights'
API = "http://www.flightradar24.com/zones/full_all.json"
@monkeycycle
monkeycycle / tapered-intensity-curved_edges.R
Created June 20, 2017 19:38 — forked from dsparks/tapered-intensity-curved_edges.R
Beautiful tapered-intensity-curved edge network graph with ggplot2
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("sna", "ggplot2", "Hmisc", "reshape2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Empty ggplot2 theme
new_theme_empty <- theme_bw()
new_theme_empty$line <- element_blank()
new_theme_empty$rect <- element_blank()
new_theme_empty$strip.text <- element_blank()
@monkeycycle
monkeycycle / joyplot-atus.R
Created June 1, 2017 15:49 — forked from halhen/joyplot-atus.R
The daily grind - viz
library(tidyverse)
# data from https://www.kaggle.com/bls/american-time-use-survey
df.resp <- read_csv('../data/atus/atusresp.csv')
df.act <- read_csv('../data/atus/atusact.csv', col_types=cols(tustarttim = col_character(), tustoptime = col_character()))
df.sum <- read_csv('../data/atus/atussum.csv')
df.tmp <- df.act %>%
mutate(activity = case_when(trtier2p == 1301 ~ 'Exercise',
@monkeycycle
monkeycycle / signup.jade
Created May 26, 2017 00:41 — forked from robksawyer/signup.jade
A pretty basic registration form for KeystoneJS.
// @file signup.jade
// @path /templates/views/user/signup.jade
// @description Form that user sees when signing up.
//
extends ../../layouts/default
block intro
.container
h1= 'Sign up for Little B.O.M'
@monkeycycle
monkeycycle / README.md
Created May 25, 2017 05:37 — forked from drzax/README.md
d3 | Reusable slopegraph

Reusable slopegraph inspired/adapted from Ben Van Dyke's example into a reusable chart.

This slopegraph example shows the number of personal computers installed in a country per household. This includes desktop PCs and laptops, but excludes smartphones and terminals connected to mainframe computers. All figures are calculated using total number of Personal Computers and the Total Number of Households.

data source

@monkeycycle
monkeycycle / .block
Created May 25, 2017 05:34 — forked from drzax/.block
Narrative Charts
license: mit
scrolling: true
height: 300
@monkeycycle
monkeycycle / KeystoneApiExample.md
Created May 19, 2017 16:52 — forked from JedWatson/KeystoneApiExample.md
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@monkeycycle
monkeycycle / florida.csv
Created May 8, 2017 13:57 — forked from gka/florida.csv
bump chart tutorial, part 1
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
live_state born_state 1900 1910 1920 1930 1940 1950 1960 1970 1980 1990 2000 2012
Florida Alabama 0.0477 0.0484 0.0541 0.0508 0.0555 0.0554 0.0458 0.0344 0.0259 0.0197 0.0145 0.0102
Florida Alaska 0.0000 0.0000 0.0000 0.0000 0.0001 0.0000 0.0002 0.0004 0.0005 0.0005 0.0005 0.0008
Florida Arizona 0.0000 0.0000 0.0000 0.0001 0.0004 0.0003 0.0004 0.0007 0.0008 0.0011 0.0014 0.0015
Florida Arkansas 0.0007 0.0009 0.0021 0.0035 0.0024 0.0040 0.0040 0.0043 0.0032 0.0030 0.0025 0.0022
Florida California 0.0003 0.0003 0.0009 0.0006 0.0017 0.0032 0.0056 0.0074 0.0086 0.0104 0.0131 0.0141
Florida Colorado 0.0001 0.0001 0.0006 0.0004 0.0008 0.0008 0.0013 0.0017 0.0018 0.0024 0.0024 0.0026
Florida Connecticut 0.0018 0.0025 0.0018 0.0032 0.0043 0.0058 0.0076 0.0089 0.0106 0.0111 0.0112 0.0097
Florida Delaware 0.0002 0.0004 0.0010 0.0004 0.0005 0.0007 0.0009 0.0012 0.0013 0.0013 0.0013 0.0014
Florida District of Columbia 0.0004 0.0005 0.0005 0.0012 0.0011 0.0019 0.0036 0.0028 0.0035 0.0037 0.0035 0.0028