Skip to content

Instantly share code, notes, and snippets.

View enygma's full-sized avatar

Chris Cornutt enygma

View GitHub Profile
@enygma
enygma / keybase.md
Created March 21, 2014 00:43
keybase proof

Keybase proof

I hereby claim:

  • I am enygma on github.
  • I am ccornutt (https://keybase.io/ccornutt) on keybase.
  • I have a public key whose fingerprint is BA43 E518 8775 24EF ECC2 6831 D67D 8542 2535 DF94

To claim this, I am signing this object:

@enygma
enygma / gist:45253b0c9cf78a7f5aed
Created October 1, 2014 19:58
parallel with Guzzle
$url = '/wsapi/2.0/verify?'.http_build_query($params).'&h='.$signature;
// Make the connections in a pool
$pool = array();
$client = new \Guzzle\Http\Client();
foreach ($this->hosts as $host) {
$pool[] = $client->get('http://'.$host.$url);
}
$responses = $client->send($pool, array(
Late yesterday afternoon the PSR-9 and PSR-10 drafts were moved into master on the <a href="https://github.com/php-fig/fig-standards/" title="PHP-FIG Standards">php-fig/standards</a> repository, moving them along to the next step and to get the wider perspective of the main PHP-FIG group's opinions on it.
What are <b>PSR-9</b> and <b>PSR-10</b>, you ask? Here's a brief summary so far:
At the end of last year (2014) <i>Lukas Smith</i> <a href="https://groups.google.com/d/msg/php-fig/45AIj5bPHJ4/ThERB43j-u8J">made a proposal</a> to the PHP-FIG group for a standard that would make reporting security issues with PHP projects and libraries a much more structured thing. The general idea is that a standardized document (or documents?) in a project's repository would provide information about current and past security issues in a well-defined structure that could have some automated tooling around it. <a href="https://groups.google.com/forum/#!searchin/php-fig/security/php-fig/45AIj5bPHJ4/ThERB43j-u8J">Much discuss
Chriss-MacBook-Pro:laravel ccornutt$ composer require psecio/gatekeeper
Using version ^2.6 for psecio/gatekeeper
./composer.json has been updated
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for vlucas/phpdotenv == 1.1.1.0 -> satisfiable by vlucas/phpdotenv[v1.1.1].
@enygma
enygma / property auth library
Created September 26, 2015 14:33
Testing out the policy sets for the PropAuth library - not exactly where I want it to be yet (a little clunky) but getting there
<?php
require_once 'vendor/autoload.php';
use \Psecio\PropAuth\Enforcer;
use \Psecio\PropAuth\User;
use \Psecio\PropAuth\Policy;
use \Psecio\PropAuth\PolicySet;
//---------------------------
@enygma
enygma / gist:1245080
Created September 27, 2011 13:48
Pull the bandwidth graph data for a server
<?php
/**
* Pull the bandwidth graph data from the SoftLayer API via a custom graph config object
*
*/
$metrics = array();
$metric = new SoftLayer_Container_Metric_Data_Type(null);
$metric->name = 'url_uptime';
$metric->summaryType = 'publicIn';
@enygma
enygma / gist:1245075
Created September 27, 2011 13:45
Getting the raw graph data for a SoftLayer server
<?php
/**
* Pull the bandwidth data from the API by server's tracking object ID
*
*/
$soapClient = SoftLayer_Controller_Action_Helper_SoapClient::getSoapClient('SoftLayer_Hardware_Server', $deviceId);
$objectMask = new SoftLayer_Soap_ObjectMask();
$objectMask->metricTrackingObject;
@enygma
enygma / gist:1413370
Created December 1, 2011 03:45
Simple RSS feed creation for @PHPQuickFix
<?php
$jsonCacheFile = './quickfix.json';
$gimmieFeed = 'https://gimmebar.com/api/v0/public/assets/phpquickfix';
$wgetCmd = 'wget -O'.$jsonCacheFile.' '.$gimmieFeed;
// look for the cache file
if(!is_file($jsonCacheFile) || (is_file($jsonCacheFile) && filemtime($jsonCacheFile)<strtotime('-1 minute')) ){
// fetch the latest content from gimmiebar
exec($wgetCmd);
@enygma
enygma / gist:2205447
Created March 26, 2012 14:24
RESTful testing with Behat
Feature: Testing the RESTfulness of the Index controller
Let's see how RESTish this is
Scenario: Creating a new User
Given that I want to make a new "User"
And that the its "name" is "Chris"
And I request "/user/index.json"
And the response is JSON
And the response has a "userId" property
And the type of the "userId" property is numeric
{
"require": {
"behat/behat": ">=2.2.2",
"behat/mink" : ">=1.3.2",
"guzzle/guzzle": ">=2.0.1",
"fabpot/goutte": "*",
"behat/sahi-client": "*",
"alexandresalome/php-selenium": "*",
"facebook/php-webdriver": "*"
},