This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Util functions | |
var Util = { | |
loop: function (obj, callback) { | |
for (var x in obj) { | |
if (obj.hasOwnProperty(x)) { | |
callback(x, obj[x]); | |
} | |
} | |
return obj; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 0: save git-deploy-master somewhere in your $PATH and make sure it has execute permission. | |
# in master, commit your code | |
git commit -m "Updated website" | |
# Deploy to gh-pages | |
git deploy-master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
'''Breaks large tab-separated value files into smaller files''' | |
import argparse | |
def split_tsv(filepath, lines, limit): | |
header = [] | |
with open(filepath, 'r') as f: | |
# Assume there is header | |
header = f.readline().split() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i = 0; | |
function makeChartFromList(list) { | |
function consume ( data ) { | |
process(data); | |
i++; | |
if (i === list.length) { | |
$.Deferred().resolve(); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PGraphics gStuff; | |
int w = 400; | |
int h = 300; | |
void setup () { | |
size(w, h); | |
gStuff = createGraphics(w, h); | |
} | |
void draw() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let promise = ( func, ...args ) => { | |
return new Promise( ( resolve, reject ) => { | |
let callback = ( error, data ) => { | |
if (error) reject(error); | |
else resolve(data); | |
}; | |
args.push(callback); | |
func.apply(func, args); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wikipedia = require("node-wikipedia"); | |
const searchWiki = (term) => { | |
return new Promise( (resolve, reject) => { | |
wikipedia.page.data(term, { content: true }, (response) => { | |
if (!response) reject(null); | |
resolve(response); | |
}); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Oceanic Next Theme for RainbowJS (https://github.com/ccampbell/rainbow) | |
* | |
* Adaptation of Oceanic Next from | |
* https://github.com/voronianski/oceanic-next-color-scheme | |
* | |
* Usage: include this file in your HTML like this: | |
* <link rel="stylesheet" type="text/css" href="css/oceanic-next.css"> | |
* | |
* Anything transformed by RainbowJS will be automatically applied. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: | |
// node csv-converter.js input_path.json > output_path.csv | |
// | |
// Dependency: json-2-csv | |
if (process.argv.length < 3) process.exit(1); | |
var fs = require('fs'); | |
var json_2_csv = require('json-2-csv'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Processing 3.0.1 Python mode | |
# Original artist: https://medium.com/@GroundTruth/in-living-color-antarctica-s-vibrant-wildlife-under-the-sea-54ee6f09d662#.maye8r6ws | |
'''Sorts an image by rgb colour and draws them in gradient''' | |
bar_width = 50 | |
w = 1980 | |
h = 1366 | |
def setup(): | |
size(1980, 1366) |