Skip to content

Instantly share code, notes, and snippets.

View monkeycycle's full-sized avatar

Michael Pereira monkeycycle

View GitHub Profile
@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
@monkeycycle
monkeycycle / index.html
Last active May 10, 2017 21:17
names matching
<script>
var arrayOne = [{
"name": "Keny"
},
{
"name": "Sloane"
},
{
"name": "Elianna"
* {
box-sizing: border-box;
}
.clearfix:after {
visibility: hidden;
display : block;
font-size : 0;
content : " ";
clear : both;
@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 / .block
Created May 25, 2017 05:34 — forked from drzax/.block
Narrative Charts
license: mit
scrolling: true
height: 300
@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 / 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 / no-cache-heroku.sh
Created May 26, 2017 13:30
Rebuild on Heroku with no module caching
heroku config:set NODEMODULESCACHE=false
git commit -am 'rebuild' --allow-empty
git push heroku master
heroku config:unset NODEMODULESCACHE
@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 / 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()