Skip to content

Instantly share code, notes, and snippets.


Aaron Francis aarondfrancis

View GitHub Profile
View macro.php
Builder::macro('debug', function ($name = null) {
$name = $name ?? 'Untitled';
$sql = SqlFormatter::format($this->toBoundSql(), false);
$sql = htmlentities($sql);
$html = <<<EOT
View hashdrop
View NoDownMigrationsTest.php
namespace Tests\Unit\Style;
use Illuminate\Database\Migrations\Migrator;
use Illuminate\Foundation\Testing\RefreshDatabase;
use ReflectionClass;
use Tests\TestCase;
class NoDownMigrationsTest extends TestCase
View commitprint-ghe.js
(function ($$) {
// Open a console in your web browser and paste
// this entire script into it. This script doesn't
// phone home at any point, you have to do that
// manually. Still, give it a read.
// `Cmd + Opt + J` on Chrome
var user;
View gist:a4cf36bcf175b2e3aea3
{"params":{"TargetArn":"arn:aws:sns:us-west-2:954910203979:endpoint\/APNS\/Traxo_APNS_Prod\/49eed133-282d-3194-a526-2acdbba4585d","Message":"{\"APNS\":\"{\\\"aps\\\":{\\\"alert\\\":\\\"American Airlines Flight 2512 is on time for departure at 7:59 pm.\\\",\\\"content-available\\\":1,\\\"sound\\\":\\\"default\\\"},\\\"traxo\\\":{\\\"notification_uuid\\\":\\\"0aff976e-977a-452c-8eef-6fff59cc156c\\\",\\\"notification_key\\\":\\\"flight_departure_on_time\\\",\\\"notification_level\\\":\\\"success\\\",\\\"text\\\":\\\"{{ airline }} Flight {{ flight_number }} is on time for departure at {{ departure_time }}.\\\",\\\"plain_text\\\":\\\"American Airlines Flight 2512 is on time for departure at 7:59 pm.\\\",\\\"data\\\":{\\\"airline\\\":\\\"American Airlines\\\",\\\"flight_number\\\":\\\"2512\\\",\\\"air_segment_id\\\":\\\"1027796\\\",\\\"departure_time\\\":\\\"7:59 pm\\\",\\\"arrival_airport_code\\\":\\\"ATL\\\"},\\\"metadata\\\":{\\\"flight_number\\\":{\\\"value\\\":\\\"1027796\\\",\\\"type\\\":\\\"segment\\\"}}}}\"
View gist:a21f04d869d04a8e8c6a
"{\"APNS\":\"{\\\"aps\\\":{\\\"alert\\\":\\\"Delta Air Lines Flight 2537 will now depart from Gate 45 at 7:06 pm\\\",\\\"content-available\\\":1,\\\"sound\\\":\\\"default\\\"},\\\"traxo\\\":{\\\"notification_uuid\\\":\\\"f12718a8-30a4-47cb-b2b9-7165e6b2c48f\\\",\\\"notification_key\\\":\\\"flight_departure_gate_changed\\\",\\\"notification_level\\\":\\\"heads_up\\\",\\\"text\\\":\\\"{{ airline }} Flight {{ flight_number }} will now depart from Gate {{ departure_gate }} at {{ departure_time }}\\\",\\\"plain_text\\\":\\\"Delta Air Lines Flight 2537 will now depart from Gate 45 at 7:06 pm\\\",\\\"data\\\":{\\\"airline\\\":\\\"Delta Air Lines\\\",\\\"flight_number\\\":\\\"2537\\\",\\\"air_segment_id\\\":\\\"1025292\\\",\\\"departure_terminal\\\":\\\"B\\\",\\\"departure_gate\\\":\\\"45\\\",\\\"departure_time\\\":\\\"7:06 pm\\\",\\\"departure_time_zone_abbreviation\\\":\\\"EST\\\"},\\\"metadata\\\":{\\\"flight_number\\\":{\\\"value\\\":\\\"1025292\\\",\\\"type\\\":\\\"segment\\\"}}}}\",\"GCM\":\"{\\\"data\\\":{\\\"
View gist:5515245

for var in `env|cut -f1 -d=`; do
  echo "PassEnv $var" >> /app/apache/conf/httpd.conf;
touch /app/apache/logs/error_log
touch /app/apache/logs/access_log
touch /app/apache/logs/app_log
tail -F /app/apache/logs/error_log &
tail -F /app/apache/logs/access_log &amp;
aarondfrancis / gist:4323639
Created Dec 18, 2012
Inheritance in alloy?
View gist:4323639
var App = require('application');
exports.definition = {
config: {
"adapter": {
"type": "properties",
"collection_name": "someChildClass"
extendModel: function(Model) {
aarondfrancis / Chances of pulling 3 1984 coins
Created Feb 28, 2012
What are the odds of pulling 3 1984 quarters out of a pile?
View Chances of pulling 3 1984 coins
"Picked up 3 quarters from my spare change pile. They were all from 1984. What are the
chances?!?!" []
So first, we need to figure out how many quarters in any given pile should be dated 1984.
Let's say that there are 65 billion quarters in circulation at the moment [1] and that
there were 1.2 billion quarters minted in 1984 [2].
That means that 1.85% of the quarters in a given pile should be quarters with the date
1984. [1.2/65 = 1.85%]