Skip to content

Instantly share code, notes, and snippets.

View monkeycycle's full-sized avatar

Michael Pereira monkeycycle

View GitHub Profile
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 / r-markdown-heads.R
Created May 16, 2018 17:09
Print markdown within r notebook code chunks
# Needs `, results='asis'` and two spaces before the trailing newline
```{r occupations_by_vismin.R, echo=TRUE, message=FALSE, warning=FALSE, results='asis'}
for(thing in list_of_things){
cat("\n###", thing, "\n")
cat(" \n")
}
```
@monkeycycle
monkeycycle / package.json
Created January 28, 2018 20:50
NPM build pipeline
{
"name": "npm builder",
"version": "1.0.0",
"description": "A basic npm build pipeline.",
"main": "index.html",
"author": "",
"license": "ISC",
"dependencies": {
"bourbon": "4.3.4",
"bourbon-neat": "2.0.0",
@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 / 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 / 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