Skip to content

Instantly share code, notes, and snippets.

View stephenfrank's full-sized avatar

Stephen Frank stephenfrank

View GitHub Profile
@stephenfrank
stephenfrank / Currency.php
Created March 7, 2019 16:54
A PHP array of currency names, codes and symbols. Symbols based on https://github.com/bengourley/currency-symbol-map/blob/master/map.js
<?php
class Currency
{
static $currencies = [
'ALL' => [
'name' => 'Albania Lek',
'symbol' => 'L',
],
'AFN' => [
@stephenfrank
stephenfrank / gist:7053148
Last active February 22, 2020 11:04
Chatting to an SMTP server with ReactPHP
<?php
require "vendor/autoload.php";
use React\Promise\Deferred;
$loop = React\EventLoop\Factory::create();
$stream = @ stream_socket_client('tcp://gmail-smtp-in.l.google.com:25', $errNo, $errStr, 10);
$connection = new React\Socket\Connection($stream, $loop);
@stephenfrank
stephenfrank / commits.php
Last active December 18, 2015 01:29
Iterates directories and prints the commit log for a specified time period
#!/usr/bin/php
<?php
date_default_timezone_set('Africa/Johannesburg');
define('PROJECT_GLOBS', "/webserver/www/*");
define('GITROOT', "/dev");
define('AUTHOR', 'stephen');
if (! isset($argv[1])) {
exit("
@stephenfrank
stephenfrank / WhereExistsRelatedClosureTest.php
Last active December 15, 2015 11:49
WhereExistsRelatedClosureTest
<?php
class WhereExistsRelatedClosureTest extends TestCase {
public function testBelongsToMany()
{
$users = User::whereExistsRelated('roles', 3)->get();
$this->assertEquals(count($users), 1);
@stephenfrank
stephenfrank / horizontal-stepbox.js
Created March 22, 2013 07:27
horizontal-step-box
$(function () {
if ($('#stepBox').length === 0) {
return;
}
var stepBox = $('#stepBox');
var stepBoxWidth = stepBox.width();
stepBox.find('.step-item').width(stepBoxWidth);