Skip to content

Instantly share code, notes, and snippets.


Andy Fowler andyfowler

View GitHub Profile
View gist:c753acb561ff337baaedd2701a9393c8
SELECT pilot_name
, DATEDIFF(NOW(), MAX(IF(instructor_name IS NOT NULL, schedule_end, 0))) as days_since_last_dual_flight
, SUM(hobb_duration) as hours_past_year
, SUM(landings) as landings_past_year
, COUNT(id) as flights_past_year
, SUM(IF( schedule_end > (NOW() - INTERVAL 180 DAY), hobb_duration, 0)) as hours_180_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 180 DAY), landings, 0)) as landings_180_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 180 DAY), 1, 0)) as flights_180_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 90 DAY), hobb_duration, 0)) as hours_90_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 90 DAY), landings, 0)) as landings_90_days
andyfowler / merge_post.feature
Created May 23, 2014
Nutshell REST API merge spec
View merge_post.feature
Feature: Merging entities
Given a Nutshell with an account
Scenario: Basic JSON API compliance
When the client requests POST /accounts/1-accounts/merge with the body:
{"accounts": ["336-accounts","337-accounts"] }
View gist:3a25f905e51308a71d7b
$response = $aboutmeApi->get();
$response->getPage(); // returns `Aboutme_Page` created from API response JSON
// no API consumer needs to know about AboutMe's API structure, only your own implemented methods.
// in testing
$page = Aboutme_Page::createFromResponse($yourfixture);
andyfowler / gist:10281760
Created Apr 9, 2014
Check if your RapidSSL cert is revoked in their OCSP server
View gist:10281760
# download the rapidssl intermediate bundle
curl > rapidssl-bundle.pem
# check if your (presumably revoked) cert is revoked via its OCSP server
# this OCSP url is also in your cert, in the Authority Information Access section
openssl ocsp -issuer rapidssl-bundle.pem -cert YOURCERT.crt -url
andyfowler / gist:10068879
Created Apr 7, 2014
testing a libssl update in vagrant for heartbleed
View gist:10068879
vagrant@vagrant:~$ openssl version -a
OpenSSL 1.0.1 14 Mar 2012
built on: Wed Jan 8 20:45:51 UTC 2014
platform: debian-amd64
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx)
compiler: cc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DOPENSSL_NO_TLS1_2_CLIENT -DOPENSSL_MAX_TLS1_2_CIPHER_LENGTH=50 -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
OPENSSLDIR: "/usr/lib/ssl"
vagrant@vagrant:~$ sudo apt-get update

Keybase proof

I hereby claim:

  • I am andyfowler on github.
  • I am andyfowler ( on keybase.
  • I have a public key whose fingerprint is C729 E43A BE22 52BA 67E8 08E5 D1E2 5574 B09F C6E9

To claim this, I am signing this object:

andyfowler /
Last active Aug 29, 2015
Frustrating landscape of PHP mocking

Why are PHP's mocking libraries so weak?


Kludgy, disgusting syntax.


Seems to have the most momentum, but I don't like its DSL, which seems more complex than 95% of cases need. Bad docs: a 1,600-line README?

View gist:5118546
class a {
protected $foo;
public function showFoo() {
echo $this->foo;
andyfowler / gist:5030607
Created Feb 25, 2013
vagrant box export hackage
View gist:5030607
# update vbox additions
sudo sudo mount /dev/sr0 /mnt
sudo /mnt/
sudo rm -rf /usr/src/vboxguest*
sudo aptitude purge build-essential
andyfowler / gist:3291314
Created Aug 8, 2012
3-second tapped song vs password
View gist:3291314

Back-of-napkin thoughts prompted by

3-second song clip, in taps

Say the typical song is 120 BPM.

( 120BPM / 60s = 2 beats per second) * 3 seconds = 6 beats (quarter-notes)

Biggest assumption is that 6 beats in 3 seconds @ sixteenth note resolution = 24 available notes of resolution