Skip to content

Instantly share code, notes, and snippets.

Jake Bathman jakebathman

Block or report user

Report or block jakebathman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@paulirish
paulirish / gist:292907
Created Feb 2, 2010
ascii art that's perfect for code comments
View gist:292907
/* __
/ _)
.-^^^-/ /
__/ /
<__.|_|-|_|
*/
/*_/|
=0-0=
@hubgit
hubgit / file-exists-ci.php
Created Jun 28, 2010
Check if a file exists, with case-insensitive file name.
View file-exists-ci.php
<?php
function file_exists_ci($file) {
if (file_exists($file))
return $file;
$lowerfile = strtolower($file);
foreach (glob(dirname($file) . '/*') as $file)
if (strtolower($file) == $lowerfile)
@jakebellacera
jakebellacera / ICS.php
Last active Feb 16, 2020
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
View ICS.php
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@caseyjustus
caseyjustus / median.js
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;
@JeffreyWay
JeffreyWay / gist:1525217
Created Dec 27, 2011
Instant Server for Current Directory
View gist:1525217
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@henrik
henrik / eu_country_codes.rb
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
]
@jeromer
jeromer / orthodromicdistance.py
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
@jeromer
jeromer / compassbearing.py
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))
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012
US State Names & Abbreviations as PHP Arrays
View us-state-names-abbrevs.php
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@maxogden
maxogden / readme.md
Created Aug 22, 2012
things I wish github notified me about
View readme.md

the new github notifications (https://github.com/blog/1204-notifications-stars) leaves me wanting more!

  • when someone comments on a gist that I either own or have also commented on
  • when someone comments on a commit (in a project that I'm not part of) that I have commented on
  • when someone makes a commit to a fork of one of my repos

notifications settings should let you choose whether or not to receive emails for the above things. there should also be a web UI that shows you a list of all comments/messages for the above scenarios. at the moment https://github.com/notifications only shows you github issue names which is less useful than showing the actual message (the old notifications page showed actual messages)

You can’t perform that action at this time.