I hereby claim:
- I am jeremeamia on github.
- I am jeremeamia (https://keybase.io/jeremeamia) on keybase.
- I have a public key ASCBfb8yAYogwzk5U3UqoPp1oPzXnIUTnCk-9QG7IeIJTQo
To claim this, I am signing this object:
<?php | |
/** | |
* Uses closures to execute a try...catch...finally group of statements. | |
* | |
* @param Closure $try Closure to execute as a try statement. | |
* @param array $catch Hash exception names as keys and closures (catch statements) as values. | |
* @param Closure $finally Closure to execute as a finally statement. | |
* @throws Exception If an excpetion is not caught. | |
*/ |
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
$s3 = Aws\S3\S3Client::factory($config); | |
$s3->registerStreamWrapper(); | |
$url = 's3://{$bucket}/{$key}'; | |
// Read CSV with fopen |
<?php namespace fn; | |
/** | |
* A constant representing an argument to leave a placeholder for when creating | |
* a partial function application. This value needs to be weird (note the use | |
* of null bytes) in order to be disambiguated from a normal argument. | |
*/ | |
const ANY = "\0*\0"; | |
/** |
<?php | |
/** | |
* A simple class for calculating holidays | |
* | |
* Able to calculate dates for holidays based on the stored derivations. | |
* Holidays other than Easter based on lunar cycles will not be able to be | |
* calculated. Work should be done to improve this with configuration abilities | |
*/ | |
class Holiday { | |
<?php | |
// These are just the basics for how to do this. Notes: | |
// - Not fully tested. | |
// - Not suitable for production. | |
// - May not work well if large ammounts of data. | |
// - Requires AWS SDK for PHP and http://php.net/manual/en/book.zip.php | |
require '/path/to/sdk-or-autoloader'; |
I hereby claim:
To claim this, I am signing this object:
<?php | |
function parse_slack_request(string $body): array | |
{ | |
if (empty($body)) { | |
return []; | |
} | |
if ($body[0] === '{') { | |
$data = json_decode($body, true); |
<?php | |
// Domain Classes | |
abstract class Domain { // Provides means to persist models and understand relationships | |
public function __construct(Database_Interface $database, Domain_Builder_Base $builder) {/* ... */} | |
public function find($unique_key) {/* ... */} | |
public function find_all($unique_key) {/* ... */} | |
public function save(Domain_Model $model) {/* ... */} | |
public function find_all_related_to(Domain_Model $model) {/* ... */} | |
/* ... */ |
<?php | |
class MutableMethodsObject | |
{ | |
protected $methods = array(); | |
public function addMethod($name, Closure $method) | |
{ | |
if (!is_string($name)) { | |
throw new InvalidArgumentException("Method name must be a string."); |
<?php | |
class Fn | |
{ | |
const SKIP = '…'; | |
protected $callable; | |
protected $fixedArgs = []; | |
public function __construct(callable $callable, array $fixedArgs = []) |