Skip to content

Instantly share code, notes, and snippets.

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

Matt Humphrey m4tthumphrey

🏂
Working...
View GitHub Profile
@m4tthumphrey
m4tthumphrey / Reader.php
Created April 16, 2014 16:18
Simple class to iterate a CSV file quickly, allowing the user to manipulate the value of each field
<?php
class Reader
{
protected $fields = [];
protected $filters = [];
public function read($file)
{
try {
<?php
require dirname(__DIR__) . '/vendor/autoload.php';
$chat = new \MyApp\Chat();
$app = new \Ratchet\App();
$app->route('/test', $chat);
$app->run();
@m4tthumphrey
m4tthumphrey / CronSchedule.php
Last active May 23, 2022 11:29
CronSchedule.php - Allows one to parse a cron expression into human readable text.
<?php
/*
* Plugin: StreamlineFoundation
*
* Class: Schedule
*
* Description: Provides scheduling mechanics including creating a schedule, testing if a specific moment is part of the schedule, moving back
* and forth between scheduled moments in time and translating the created schedule back to a human readable form.
*
* Usage: ::fromCronString() creates a new Schedule class and requires a string in the cron ('* * * * *', $language) format.
<?php
function remove_dir($dir)
{
$files = array_diff(scandir($dir), array('.','..'));
foreach ($files as $file) {
(is_dir("$dir/$file")) ? remove_dir("$dir/$file") : unlink("$dir/$file");
}
@m4tthumphrey
m4tthumphrey / gist:6764444
Last active December 24, 2015 07:29
Gitlab extra steps
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
sudo apt-get install libmysql-ruby libmysqlclient-dev
<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated with https://github.com/barryvdh/laravel-ide-helper
*
* @author Barry vd. Heuvel <[email protected]>
*/
exit('Only to be used as an helper for your IDE');
class App extends Illuminate\Support\Facades\App{
public function getUser($id)
{
$user = new UserVO($this);
$user->findByID($id);
return $user;
}
<?php
date_default_timezone_set('Europe/London');
$dayInterval = new DateInterval('P1D');
$startDate = new DateTime('2013-07-01');
$duration = null;
if (isset($_GET['duration'])) {
$duration = $_GET['duration'];
<?php
set_time_limit(0);
$fields = array(
'id',
'name',
'first_name',
'middle_name',
'last_name',
# Backup and Swap Files
.*.sw?
*.bak
*~
# Komodo
*.komodoproject
.komodotools
# PHPStorm