Skip to content

Instantly share code, notes, and snippets.

View m4tthumphrey's full-sized avatar
🏂
Working...

Matt Humphrey m4tthumphrey

🏂
Working...
View GitHub Profile

Keybase proof

I hereby claim:

  • I am m4tthumphrey on github.
  • I am m4tthumphrey (https://keybase.io/m4tthumphrey) on keybase.
  • I have a public key ASCPU08sRfv13I-0U4icO5HUvPchBubdlvdCuY6BOFnC4Qo

To claim this, I am signing this object:

<?php namespace ContractsBundle\Dbal\Types;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
class JsonSerializable extends Type
{
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return 'json';
<?php
// this should be called the first time 'manager' is resolved from the container
$container->get('manager')->registerPolicy(new Policy());
@m4tthumphrey
m4tthumphrey / cstatus.sh
Created August 14, 2015 13:29
Quick command for checking for dirty git repositories inside of a composer vendor directory. Move file somewhere in your path and run `cstatus <vendor name>` to get a list of any dirty repositories.
curdir=$(pwd)
vendor=$1
for f in $curdir/vendor/$vendor/*; do
[ -d $f ] && cd "$f" && output=$(git status --porcelain) && [ "$output" != "" ] && echo "$f" && echo "$output"
done;
<?php
//...
$called = false;
$manager->expire(function(FileType $type, Collection $collection) use (&$called) {
$called = true;
});
@m4tthumphrey
m4tthumphrey / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
module.exports = {
entry: './js/app.js',
output: {
filename: './js/bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'jsx?harmony'
render: function() {
var { className, ...other } = this.props;
var fulClassName = 'toolbox2-modal-content toolbox2-modal-' + className;
return (
<div className="toolbox2-modal-backdrop" onClick={this.handleBackdropClick} {...other}>
@m4tthumphrey
m4tthumphrey / ConcatAudioFilter.php
Last active September 5, 2020 07:17
php-ffmpeg concat audio filter - an incredibly simple filter to concat multiple audio files together. Should be easily tweaked to allow for videos too.
<?php
use FFMpeg\Media\Audio;
use FFMpeg\Format\AudioInterface;
use FFMpeg\Filters\Audio\AudioFilterInterface;
class ConcatAudioFilter implements AudioFilterInterface
{
private $files;
private $priority;
@m4tthumphrey
m4tthumphrey / streamed.php
Last active December 28, 2022 08:06
Laravel response macro for streamed responses with seeking support
<?php
Response::macro('streamed', function($type, $size, $name, $callback) {
$start = 0;
$length = $size;
$status = 200;
$headers = [
'Content-Type' => $type,
'Content-Length' => $size,