Skip to content

Instantly share code, notes, and snippets.

Avatar

Ashley Pinner AshleyPinner

  • Poole, United Kingdom
View GitHub Profile
View Challenge-7.php
<?php
/*
Challenge 7: Snail print an array
Rules::
1. No Exceptions or PHP errors / warnings notices allowed
2. No redefining the test arrays.
3. Your function must be able to cope with n by n arrays as input
@AshleyPinner
AshleyPinner / gist:f2230ae8307e2f05149c
Created Oct 7, 2014
Rough replacement for cal_days_in_month for HHVM
View gist:f2230ae8307e2f05149c
if(!function_exists('cal_days_in_month')) {
function cal_days_in_month($calendar, $month, $year) {
return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}
if (!defined('CAL_GREGORIAN')) {
define('CAL_GREGORIAN', 1);
}
}
@AshleyPinner
AshleyPinner / test.php
Last active Aug 29, 2015
The fun of cygwin and /dev/urandom (See comments, possibly MinGW related)
View test.php
<?php
var_dump(is_readable('/dev/urandom'));
var_dump(passthru('head /dev/urandom'));
var_dump(PHP_OS);
?>
Sample output:
bool(false)
View gist:4ef171888a15c645a789b4c2ee43bb30
# fdisk -lu /dev/sdb
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
View Rough events.md
EventName Additional Info Example JSON
GameStart Always first event { "EventID": 0, "EventName": "GameStart", "EventTime": 0.048362601548433307}
View Turret & Inhib Identifiers.md

Blues Buildings:

Towers

TurretKilled Lane Position
Turret_T2_L_03_A Top Outer
Turret_T2_C_05_A Mid Outer
Turret_T2_R_03_A Bot Outer
Turret_T2_L_02_A Top Inner