Skip to content

Instantly share code, notes, and snippets.

View asgrim's full-sized avatar
😈
Doing evil things, probably. Sorry...

James Titcumb asgrim

😈
Doing evil things, probably. Sorry...
View GitHub Profile
275ms (opcache + stat off + super)
280ms (opcache + stat off)
280ms (opcache + stat on + super)
295ms (opcache + stat on)
380ms (super)
410ms (nothing)
@asgrim
asgrim / AbstractForm.php
Last active January 3, 2016 10:49
Why doesn't the `ValidatorManager` service get injected into the `ValidatorChain` by default so that validators can easily be configured in module.config.php without having to configure the whole form in there also?
<?php
namespace My\Form;
use Zend\Form\Form as ZendForm;
use Zend\InputFilter\InputFilterProviderInterface;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorAwareTrait;
abstract class AbstractForm
@asgrim
asgrim / github.php
Last active December 31, 2015 17:29
<?php
$client = new \Github\Client();
$clientId = '...';
$clientSecret = '...';
$client->authenticate($clientId, $clientSecret, \Github\Client::AUTH_URL_CLIENT_ID);
$client->api('user')->repositories('edgroup');
<?php
$browscap = new BrowscapPHP($cacheDir);
$browscap->remoteIniUrl = 'http://browscap.org/stream?q=Full_PHP_BrowsCapINI';
$browscap->remoteVerUrl = 'http://browscap.org/version';
$browscap->getBrowser($ua);
if (is_null($lastError))
{
$lastError = error_get_last();
if (null === $lastError || $lastError['message'] == '')
{
return false;
}
}
$errors = array(E_ERROR, E_USER_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, E_STRICT);
Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; NOOK BNRV200 Build/ERD79 1.4.3) Apple WebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko)
VPNGate/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/DD460D
Mozilla/4.0
Huawei/1.0/HUAWEI-G7300 Browser/Opera MMS/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Opera/9.80 (MTK; U; en-US) Presto/2.5.28 Version/10.10
CaptiveNetworkSupport-277 wispr
Mozilla/5.0 (compatible; aiHitBot/2.8; +http://endb-consolidated.aihit.com/)
SAMSUNG-GT-E2252/E2252DDLG2 NetFront/4.2 Profile/MIDP-2.0 Configuration/CLDC-1.1
AT-AS40SE Linux/3.0.13 Android/4.0.4 Release/04.10.2013 Browser/AppleWebKit534.30 Profile/MIDP-2.0 Configuration/CLDC-1.1 Mobile Safari/534.30 Android 4.0.1;
LG-C395/V10e Obigo/Q7.3 Profile/MIDP-2.1 Configuration/CLDC-1.1
Requested: 281 UA: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Requested: 72 UA: Mozilla/5.0 (Windows NT 6.1; rv:25.0) Gecko/20100101 Firefox/25.0
Requested: 60 UA: Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)
Requested: 47 UA: Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0
Requested: 44 UA: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Requested: 35 UA: Mozilla/5.0 (Windows NT 6.0; rv:25.0) Gecko/20100101 Firefox/25.0
Requested: 30 UA: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b
Requested: 28 UA: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0
Requested: 20 UA: Mozilla/5.0 (MSIE 9.0; Windows NT 6.1; Trident/5.0)
Requested: 20 UA: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko Firefox/11.0
@asgrim
asgrim / provider.php
Created September 9, 2013 13:54
SSO idea (don't use this - it's not secure, it's just an academic idea)
<?php
require_once('shared.php');
$user = 'james';
$sig = generateSignature($user);
sleep(1);
<?php
namespace My\Logger;
use Psr\Log\LoggerInterface;
trait LoggerAwareTrait
{
/** @var \Psr\Log\LoggerInterface */
protected $logger;
;;; Provided courtesy of https://browsers.garykeith.com
;;; Created on Monday, July 29, 2013 at 10:22 PM UTC
;;; Keep up with the latest goings-on with the project:
;;; Follow us on Twitter <https://twitter.com/browscap>, or...
;;; Like us on Facebook <https://facebook.com/browscap>, or...
;;; Collaborate on GitHub <https://github.com/GaryKeith/browscap>, or...
;;; Discuss on Google Groups <https://groups.google.com/d/forum/browscap>.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Browscap Version