Skip to content

Instantly share code, notes, and snippets.

View meadsteve's full-sized avatar
🌲
stuff

Steve Brazier meadsteve

🌲
stuff
View GitHub Profile
@meadsteve
meadsteve / gist:4665196
Last active December 11, 2015 21:48 — forked from jazlalli/gist:4663914
var converter = (function () {
'use strict';
var romanNumeralsArray = [
{roman: 'I', number: 1},
{roman: 'V', number: 5},
{roman: 'X', number: 10},
{roman: 'L', number: 50},
{roman: 'C', number: 100},
{roman: 'D', number: 500},
@meadsteve
meadsteve / Selenium2Driver.php
Created August 20, 2013 08:11
Alteration of the Selenium2Driver file to allow selectOption to pick based on label as well as value.
<?php
namespace Behat\Mink\Driver;
use Behat\Mink\Session,
Behat\Mink\Element\NodeElement,
Behat\Mink\Exception\DriverException;
use WebDriver\WebDriver;
use WebDriver\Key;
@meadsteve
meadsteve / gist:8419414
Last active January 3, 2016 05:59
For when you need something. Anything in php.
<?php
class something implements \ArrayAccess, \Iterator
{
protected $loopable = true;
public function offsetExists($offset)
{
return true;
}
@meadsteve
meadsteve / eyesbleeding.php
Last active August 29, 2015 13:56
Totally legitimate ordinal number creator
<?php
function intToString($int) {
$first = 'second';
$second = 'third';
$third = 'forth';
$forth = 'fifth';
$dollarer = function ($count) { return ($count > 1) ? str_repeat('$', min($count - 1, 4)) : str_repeat('$', 5); };
@meadsteve
meadsteve / ouch.php
Last active August 29, 2015 13:56
Exception Looper - because it helps me relax
<?php
class ControlFlowception extends \Exception {}
class Breakception extends ControlFlowception {}
class Countception extends ControlFlowception
{
protected $count;
protected $max;
@meadsteve
meadsteve / password_needs_rehash.php
Last active August 29, 2015 13:56
using password_needs_rehash()
<?php
$stevesSecret = "pass123";
$hashOne = password_hash($stevesSecret, PASSWORD_BCRYPT, array("cost" => 4));
$hashTwo = password_hash($stevesSecret, PASSWORD_BCRYPT, array("cost" => 12));
echo $hashOne . PHP_EOL;
echo $hashTwo . PHP_EOL;
assert('$hashOne != $hashTwo', "The two hashes should be different");
@meadsteve
meadsteve / experiment.php
Last active August 29, 2015 13:56
Symfony events without statics
<?php
namespace MeadSteve\Eventing;
require_once "vendor/autoload.php";
use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyEventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use \Symfony\Component\EventDispatcher\Event;
@meadsteve
meadsteve / keybase.md
Created January 24, 2015 17:17
keybase.md

Keybase proof

I hereby claim:

  • I am meadsteve on github.
  • I am meadsteve (https://keybase.io/meadsteve) on keybase.
  • I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); }

To claim this, I am signing this object:

@meadsteve
meadsteve / example.js
Last active August 29, 2015 14:17
js-private-type-info
type_with_secrets = (function() {
var secret_type_number = 0;
var exported_type = function(){};
exported_type.prototype.increment_secret = function() { secret_type_number += 1;};
exported_type.prototype.get_secret = function() { return secret_type_number;};
return exported_type;
})();
@meadsteve
meadsteve / oops.js
Last active August 29, 2015 14:25
unicode vs javascipt coder sanity
var a‌a = "first assignment";
aa = "second assignment";
console.log(a‌a == aa);