Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jczaplew's full-sized avatar

John J Czaplewski jczaplew

View GitHub Profile
<html>
<body>
<div id="hierarchy"></div>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.7.2/mustache.min.js"></script>
<script type="text/template" id="recursive-partial">
<ul>
{{#phyla}}
"buildTaxonHierarchy": function(data) {
var occurrenceTree = {"phyla": []};
// Some preproccessing
data.records.forEach(function(d) {
d.rank = (d.rnk) ? taxaBrowser.rankMap(d.rnk) : "Unknown";
d.itallics = (d.rnk < 6) ? "itallics" : "";
d.old_name = (d.tna.split(" ")[0] != d.idt) ? d.tna : "";
d.display_name1 = (d.tna === (d.idt + " " + d.ids)) ? d.tna : d.idt;
d.display_name2 = (d.tna === (d.idt + " " + d.ids)) ? d.tna : d.ids;
@jczaplew
jczaplew / README.md
Created February 25, 2014 04:45
Fun with PostGIS

Fun with PostGIS, or, how Kanye sees the world.

@jczaplew
jczaplew / index.html
Created May 6, 2014 18:46
Vanilla Responsive SVG
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<style>
#content {
margin:2%;
padding:20px;
border:2px solid #d0d0d0;
border-radius: 5px;
}
@jczaplew
jczaplew / screen_cheatsheet.md
Created May 12, 2014 21:49
GNU Screen Cheatsheet

GNU Screen Cheatsheet

Following the syntax of this tutorial C-a = Control + a

Command Description
screen Start screen
C-a c Create a new window
C-a n Switch to next window
C-a p Switch to previous window
@jczaplew
jczaplew / mysqldb_mavericks.md
Created May 14, 2014 19:12
Install MySQLdb on Mavericks
sudo su
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
pip install MySQL-python
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
@jczaplew
jczaplew / test.js
Last active August 29, 2015 14:03
JS Scopes
var test = {
a: function() {
console.log("function a");
},
b: function(a) {
console.log(a*a);
},
c: function() {
@jczaplew
jczaplew / index.js
Created July 15, 2014 16:54
Point on line
/* Largely borrowed from the excellent Turf.js
https://github.com/Turfjs/turf-distance/blob/master/index.js */
function distance(a, b) {
function toRadians(degree) {
return degree * Math.PI / 180;
}
var R = 57.2957795,
dLat = toRadians(b.lat - a.lat),
dLon = toRadians(b.lng - a.lng);
@jczaplew
jczaplew / tos.md
Created July 24, 2014 23:50
Terms of Use

Terms of Use: By using X, you acknowledge and agree that X and all of the data contained in X belongs exclusively to X Inc. and is protected by copyright and other law. X is provided solely for the personal, non-commercial use of current and prospective Aetna members and providers. Use of any robot, spider or other intelligent agent to copy content from X, extract any portion of it or otherwise cause X to be burdened with unwarranted high access or transaction activity is strictly prohibited. Aetna reserves all rights to take appropriate civil, criminal or injunctive action to enforce these terms of use.

@jczaplew
jczaplew / qgis.sh
Last active August 29, 2015 14:04
Install QGIS OS X
#! /bin/bash
cd ~
curl "http://www.kyngchaos.com/files/software/frameworks/GDAL_Complete-1.11.dmg" -o "GDAL_Complete-1.11.dmg"
hdiutil mount GDAL_Complete-1.11.dmg
sudo installer -pkg /Volumes/GDAL\ Complete/NumPy.pkg -target /
sudo installer -pkg /Volumes/GDAL\ Complete/GDAL\ Complete.pkg -target /
diskutil unmount /Volumes/GDAL\ Complete
rm GDAL_Complete-1.11.dmg