Underscore example:
_.each([1, 2, 3], function(num) { alert(num); });
import processing.opengl.*; | |
String[] lines; | |
void setup() | |
{ | |
size(1024,768, OPENGL); | |
lines = loadStrings("CO.dat"); | |
noLoop(); | |
} |
import processing.opengl.*; | |
HashMap<String, String> date = new HashMap<String, String>(); | |
HashMap<String, String> license = new HashMap<String, String>(); | |
HashMap<String, Integer> zip = new HashMap<String, Integer>(); | |
float[][] ziplookup = new float[100000][2]; | |
int[] zipbucket = new int[100000]; | |
void setup() | |
{ |
name|id | |
1911 United|C00508200 | |
50 State Strategy|C00502633 | |
9-9-9 FUND|C00504241 | |
Accountability 2010|C00489641 | |
AFL-CIO Workers' Voices PAC|C00484287 | |
Alaskans Standing Together|C00489385 | |
America for the People|C00497081 | |
America Get Up|C00494278 | |
America Votes Action Fund|C00492520 |
var Sankey = function(opts) { | |
this.opts = opts; | |
this.el = $("#" + this.opts.el); | |
this.graphsReady = 0; | |
this.graphWidth = this.el.width(); | |
}; | |
Sankey.prototype.initPaper = function() { | |
this.paper = Raphael(document.getElementById(this.opts.el)); | |
}; |
This script for Google Spreadsheets allows you to generate slugs for your data such as might be used for creating unique urls.
Use it like this!
# | A | B | C |
---|---|---|---|
1 | a | b | slug |
2 | foo | baz bing | =slugify(A2:B4) |
3 | bar | BAZ | |
4 | FOO | baz-bing |
# Sometimes yosemite crashes with a gunicorn server up | |
# and when it comes back up there is a python process blocking port 8000 | |
# kill that process with this function | |
# http://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac | |
function killport() { | |
lsof -i TCP:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9 | |
} |
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.
brew install ffmpeg
apt install ffmpeg
var http = require("http"); | |
var https = require("https"); | |
var { SourceMapConsumer } = require("source-map"); | |
var fs = require("fs").promises; | |
var path = require("path"); | |
var fetch = function(address) { | |
return new Promise(function(ok, fail) { | |
var parsed = new URL(address); | |
var remote = parsed.protocol == "http:" ? http : https; |