Skip to content

Instantly share code, notes, and snippets.

Daniel Mason Gisleburt

Block or report user

Report or block Gisleburt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Gisleburt
Gisleburt / Vagrantfile
Last active Jun 14, 2016
WIP: Attempting to bring up rancher server + rancher host
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Install required plugins
system "echo We will need your root access"
system "sudo echo Thankies!"
required_plugins = %w( vagrant-hostsupdater )
required_plugins.each do |plugin|
system "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin
@Gisleburt
Gisleburt / TestCase.php
Created Oct 21, 2015
Adding a method to PhpUnits TestCase to get any method from another class and return a closure that will call it with the provided arguments
View TestCase.php
<?php
abstract class TestCase extends \PHPUnit_Framework_TestCase
{
/**
* Gets returns a proxy for any method of an object, regardless of scope
* @param object $object Any object
* @param string $methodName The name of the method you want to proxy
* @return \Closure
@Gisleburt
Gisleburt / CloudFormationTemplateValidator.php
Last active Aug 29, 2015
AWS Cloud Formation Precommit Validation
View CloudFormationTemplateValidator.php
<?php
/**
* Class CloudFormationTemplateValidator
* @example
* echo 'Validating Cloud Formation Templates'.PHP_EOL;
* $hook = new CloudFormationTemplateValidator();
* $files = array_slice($argv, 1); // Get a list of files from arguments
* $files = $files ?: $hook->getFilesRecursively('/^.+\.json$/i', getcwd()); // ...or recursively from the working dir
* if(!$hook->validateCloudFormationTemplates($files)) {
@Gisleburt
Gisleburt / pre-commit
Last active May 10, 2016
A pre-commit script for my PHP project for Git
View pre-commit
#!/usr/bin/php
<?php
// Based on code by raphaelstolt and buddhamagnet https://gist.github.com/raphaelstolt/588697
class PreCommitHook {
protected $green = "\033[0;32m";
protected $red = "\033[0;31m";
protected $reset = "\033[0m";
View keybase.md

Keybase proof

I hereby claim:

  • I am Gisleburt on github.
  • I am gisleburt (https://keybase.io/gisleburt) on keybase.
  • I have a public key whose fingerprint is 708F DF23 13E1 F651 A167 CB81 1E51 9AC2 539B 8E7E

To claim this, I am signing this object:

@Gisleburt
Gisleburt / FeatureContext.php
Created Apr 14, 2015
A possible method of E2E testing Aye Aye Api
View FeatureContext.php
<?php
namespace AyeAye\Tests\Behat;
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Behat\Tester\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Guzzle\Http\Client;
@Gisleburt
Gisleburt / AbstractBehatContex.php
Created Oct 17, 2014
Use Laravel's Artisan to set the fixtures for your tests
View AbstractBehatContex.php
class AbstractBehatContext extends MinkContext {
/**
* Slight hack to put beforeSuite code into beforeScenario
* @var bool
*/
protected static $databaseReady = false;
/**
* @BeforeScenario
@Gisleburt
Gisleburt / phanntomjs-driver.sh
Last active Aug 29, 2015
Starts / stops phantomjs webdriver on port 4444
View phanntomjs-driver.sh
#!/bin/bash
dir=$(pwd)
mkdir ~/phantomjs 2> /dev/null
cd ~/phantomjs
if [ -e "phantomjs.pid" ]
then
echo Stopping webdriver
@Gisleburt
Gisleburt / Cache.php
Created Sep 17, 2014
An extremely simple key/value file cache for PHP
View Cache.php
class Cache {
/**
* The name of the cache file
* @var string
*/
protected $cacheFile;
/**
* The cache data
@Gisleburt
Gisleburt / php-server.sh
Created Sep 16, 2014
Start / Stop the PHP server (using router.php) in the background
View php-server.sh
#!/bin/bash
if [ -e "server.pid" ]
then
echo Stopping server
kill `cat server.pid`
rm server.pid
cat error.log
else
echo Starting server
php -S localhost:8000 router.php >> server.log 2> error.log &
You can’t perform that action at this time.