Skip to content

Instantly share code, notes, and snippets.

View MattKetmo's full-sized avatar

Matt Ketmo MattKetmo

View GitHub Profile
@MattKetmo
MattKetmo / uuid-string.php
Last active August 29, 2015 14:13
Uuid representation
<?php
require __DIR__.'/vendor/autoload.php';
use Rhumsaa\Uuid\Uuid;
function printId(Uuid $uuid) {
$asString = $uuid->toString();
$base64 = preg_replace('/==$/', '', base64_encode($uuid->getBytes()));
@MattKetmo
MattKetmo / keybase.md
Last active October 6, 2017 08:28
keybase

Keybase proof

I hereby claim:

  • I am mattketmo on github.
  • I am mattketmo (https://keybase.io/mattketmo) on keybase.
  • I have a public key ASB-Y5EMoGxphAxm_9aRoVP4sLqkG_HSujckSoLmuvs2gAo

To claim this, I am signing this object:

@MattKetmo
MattKetmo / TagManager.txt
Last active August 29, 2015 14:01
TagManager
http://www.tagcommander.com/en/
http://ensighten.com/
http://www.opentag.qubitproducts.com/
https://www.google.com/tagmanager/
@MattKetmo
MattKetmo / lock.php
Created November 13, 2013 14:17
Playing with LiipProcessManager
<?php
// see https://github.com/liip/LiipProcessManager/
require __DIR__.'/vendor/autoload.php';
use Liip\ProcessManager\ProcessManager;
use Liip\ProcessManager\PidFile;
try {
$lock = new PidFile(new ProcessManager(), '/tmp/foobar');
@MattKetmo
MattKetmo / google-sign.php
Created October 9, 2013 08:16
Google Maps Sign URL
#!/usr/bin/env php
<?php
/**
* @see https://github.com/geocoder-php/Geocoder/blob/21e562a5ad595c6fee7a33ae90e0b42dc8866c23/src/Geocoder/Provider/GoogleMapsBusinessProvider.php#L82
*/
function signQuery($query, $privateKey)
{
$url = parse_url($query);
@MattKetmo
MattKetmo / logger-aware.php
Last active December 18, 2015 13:28
Inject logger in objects using dependency injection
<?php
require __DIR__.'/vendor/autoload.php';
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Monolog\Logger;
interface LoggerAwareInterface
{
@MattKetmo
MattKetmo / NullOutputCommand.php
Created October 24, 2012 21:54
Option --quiet in Symfony2 command
<?php
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
class NullOutputCommand extends Command
@MattKetmo
MattKetmo / FooCommand.php
Created September 7, 2012 11:46
[Console] Write into stdout and stderr
<?php
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Testcase: app/console foo > std 2> err
*/