Skip to content

Instantly share code, notes, and snippets.

View shanahanjrs's full-sized avatar

John Shanahan shanahanjrs

  • Raleigh, NC
View GitHub Profile
class Ccy(object):
# Not needed, if you need the name use `Ccy().__class__.__name__`
#__class__ = "class Ccy"
# dictionary with key, value pairings of a currency and it's respective euro value
# This is a class variable, usable by all instances of this class
# If any instance mutates this (changes it) then all other instances will also be effected...
__toEuro = {"EUR": 1, "GBP": 1.14, "USD": 0.81}

Keybase proof

I hereby claim:

  • I am shanahanjrs on github.
  • I am johnshanahan (https://keybase.io/johnshanahan) on keybase.
  • I have a public key ASCMLMJG_RCN1QPGRWZscz1DLHhBTVRKQNjaBQWbeRxAewo

To claim this, I am signing this object:

@shanahanjrs
shanahanjrs / bootstrapTemplate.php
Created September 16, 2015 04:21
Bootstrap template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="<DESCRIPTION>">
<!-- font -->
@shanahanjrs
shanahanjrs / isPrime
Created July 2, 2015 04:44
PHP primality checker.
function isPrime($n) {
if ( $n < 2 ) { return false; }
if ( $n == 2 || $n == 3 ) { return true; }
if ( $n%2 == 0 || $n%3 == 0 ) { return false; }
$sqrtN = sqrt($n) + 1;
for ($i=6; $i<=$sqrtN; $i+=6) {
if ( $n%($i-1) == 0 || $n($i+1) == 0 ) { return false; }
}
@shanahanjrs
shanahanjrs / array_key_compare
Created July 2, 2015 03:13
Compare api input array keys to array with list of required keys
// Takes an input array and compares it to an
// array of required keys and makes sure they match.
$input = [ 'john' => '20',
'matt' => '19',
'mark' => '16',
'dad'=> '40' ];
$required = [ 'john', 'matt', 'mark', 'dad', 'ryan' ];
$inputkeys = array_keys($input);
@shanahanjrs
shanahanjrs / README.md
Last active August 29, 2015 14:15 — forked from nikcub/README.md