Instantly share code, notes, and snippets.

# Jake Bathmanjakebathman

• Sort options
Created Feb 2, 2010
ascii art that's perfect for code comments
View gist:292907
 /* __ / _) .-^^^-/ / __/ / <__.|_|-|_| */ /*_/| =0-0=
Created Jun 28, 2010
Check if a file exists, with case-insensitive file name.
Last active Feb 16, 2020
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
View ICS.php

Created Aug 23, 2011
calculate the median of an array with javascript
View median.js
 function median(values) { values.sort( function(a,b) {return a - b;} ); var half = Math.floor(values.length/2); if(values.length % 2) return values[half]; else return (values[half-1] + values[half]) / 2.0;
Created Dec 27, 2011
Instant Server for Current Directory
View gist:1525217
 alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
Last active Feb 18, 2020
EU (European Union) country codes, ISO 3166-1 alpha-2. (This Gist is from 2012. Please see comments for updates.)
View eu_country_codes.rb
 # Note: VAT identification numbers for Greece use "EL", not "GR". COUNTRY_CODES_EU = %w[ AT BE BG CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE GB ]
Created Feb 22, 2012
Orthodromic distance using the Harversine formula in Python
View orthodromicdistance.py
 # -*- coding: utf-8 -*- import math def calculate_orthodromic_distance(pointA, pointB): """ Calculates the great circle distance between two points. The great circle distance is the shortest distance. This function uses the Haversine formula : - https://en.wikipedia.org/wiki/Haversine_formula
Last active Feb 22, 2020
compass bearing between two points in Python
View compassbearing.py
 # LICENSE: public domain def calculate_initial_compass_bearing(pointA, pointB): """ Calculates the bearing between two points. The formulae used is the following: θ = atan2(sin(Δlong).cos(lat2), cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong))
Created May 23, 2012
US State Names & Abbreviations as PHP Arrays
View us-state-names-abbrevs.php
 'ALABAMA', 'AK'=>'ALASKA', 'AS'=>'AMERICAN SAMOA', 'AZ'=>'ARIZONA', 'AR'=>'ARKANSAS',
Created Aug 22, 2012
things I wish github notified me about