Skip to content

Instantly share code, notes, and snippets.

Avatar

John J Czaplewski jczaplew

View GitHub Profile
View index.html
<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}}
View hierarchy.js
"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 Feb 25, 2014
Fun with PostGIS
View README.md

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

@jczaplew
jczaplew / index.html
Created May 6, 2014
Vanilla Responsive SVG
View index.html
<!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
GNU Screen Cheatsheet
View screen_cheatsheet.md

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
Install MySQLdb on Mavericks
View mysqldb_mavericks.md
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 Aug 29, 2015
JS Scopes
View test.js
var test = {
a: function() {
console.log("function a");
},
b: function(a) {
console.log(a*a);
},
c: function() {
@jczaplew
jczaplew / index.js
Created Jul 15, 2014
Point on line
View index.js
/* 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 Jul 24, 2014
Terms of Use
View tos.md

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 Aug 29, 2015
Install QGIS OS X
View qgis.sh
#! /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