Skip to content

Instantly share code, notes, and snippets.

@vlandham
vlandham / geojson_display.coffee
Created February 11, 2015 20:03
display geojson with d3
$ ->
width = 900
height = 900
projection = d3.geo.albersUsa().scale(1).translate([0,0])
path = d3.geo.path().projection(projection)
vis = d3.select("#vis")
.append("svg")
.attr("width", width)
#!/usr/bin/env python2
"""Script to download texts of a certain author from Project Gutenberg."""
from __future__ import absolute_import
from __future__ import print_function
from gutenberg.textsource import GutenbergEbooks
from gutenberg.corpus import SqliteCorpus
import logging
import re
@vlandham
vlandham / start_dplyr.R
Created February 3, 2015 00:02
dplyr start
require('dplyr')
require("ggplot2")
require('reshape2')
data <- read.table("~/Downloads/pp_3_body_bytes.txt")
names(data) <- c('bytes')
big <- filter(data, bytes > 20000)
sub <- filter(data, bytes < 20000)
p <- ggplot(sub, aes(x = bytes))
p + geom_histogram()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vlandham
vlandham / old_roads.css
Last active August 29, 2015 14:12
Streets only styling for Mapbox Studio
[class='motorway'] {
line-join:round;
line-color: @motorway_case;
#road { line-cap: round; }
#tunnel { line-dasharray:3,2; }
[zoom>=6] { line-width:0.4; }
[zoom>=7] { line-width:0.6; }
[zoom>=8] { line-width:1.5; }
[zoom>=9] { line-width: 1.75; }
[zoom>=10] { line-width:2; }
@vlandham
vlandham / index.js
Last active August 29, 2015 14:10
Gist from mistakes.io
// --------
// types
// --------
// falsy values
function is_false(value) { return !(value); };
is_false(false);
is_false(undefined);
is_false(undefined);
@vlandham
vlandham / gist:fc91ee2170af1fe759f8
Created June 7, 2014 04:16 — forked from anonymous/gist:831fdfa042057b85ebf0
processing for animated gif
void setup() {
size(500, 500);
smooth(8);
noStroke();
}
float t, tt, ht, x, y;
int N = 11;
float l = 24;
float sp = l*1.5;
@vlandham
vlandham / 0_reuse_code.js
Created June 2, 2014 13:46
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>[]</title>
<style type="text/css">
.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0;}
.clearfix:after{clear:both;}
.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;}
.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}
source target weight
sam tully 3
sam pat 8
sam kim 2
sam pris 1
roy pris 5
roy sam 1
tully sam 1
tully pris 5
tully kim 3