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
@asgrim
asgrim / opencfp.sql
Created January 13, 2015 08:47
Export talks from OpenCFP
SELECT
/* user */ users.id AS user_id, first_name, last_name, email, company, twitter, airport, url, transportation, hotel, info, bio,
/* talk */ talks.id AS talk_id, title, description, other, type, level, category, slides, desired, sponsor
FROM `talks`, `users`
WHERE talks.user_id = users.id
@asgrim
asgrim / .etc.opt.chrome.policies.managed.show_modal_dialog_policy.json
Created September 8, 2014 10:19
Temporary fix for Chrome removing showModalDialog (breaking OWA)
{
"EnableDeprecatedWebPlatformFeatures": ["ShowModalDialog_EffectiveUntil20150430"]
}
<?php
$flockHandle = fopen('/tmp/blah.lock', 'w');
if (!flock($flockHandle, LOCK_EX | LOCK_NB))
{
echo "Cannot get lock.";
die();
}
// do something
@media (min-width: 1100px) {
.site-header {
min-width: 230px;
min-width: 23rem;
width: 30%;
padding-left: 5%;
padding-top: 3rem;
position: fixed;
float: left;
max-width: 520px; /* <--- this should do the job :) */
@asgrim
asgrim / gist:3445d0977ca0d7839372
Created June 9, 2014 08:58
So apparently, this is what happens when you update Composer at the same moment as you're running a composer update...
update-deps:
[echo] Composer update
[exec] Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.
[exec] Loading composer repositories with package information
[exec] Updating dependencies (including require-dev)
[exec] e)
[exec] {
[exec] $this->addReason($rule->getId(), array(
[exec] 'rule' => $rule,
[exec] 'job' => $rule->getJob(),
<?php
// gumf at the top
class Foo extends AbstractActionController
{
public function someCommonLogic()
{
if ($something) {
return $this->redirect()->toRoute('someRoute');
}

Keybase proof

I hereby claim:

  • I am asgrim on github.
  • I am asgrim (https://keybase.io/asgrim) on keybase.
  • I have a public key whose fingerprint is 9561 1CC3 ABF3 B80A 0646 9529 A9FA 0974 0C21 7917

To claim this, I am signing this object:

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');