Skip to content

Instantly share code, notes, and snippets.


Brian Matovu mtvbrianking

View GitHub Profile
scrubmx / Application.php
Created Oct 25, 2017
Register custom model events in laravel 5.5
View Application.php
namespace App\Models;
class Application extends Model
* The attributes that should be mutated to dates.
* @var array
james2doyle / dd.php
Last active Oct 25, 2021
A implementation of "dump and die" (dd) for WordPress
View dd.php
if (!function_exists('dd')) {
function dd($data)
ini_set("highlight.comment", "#969896; font-style: italic");
ini_set("highlight.default", "#FFFFFF");
ini_set("highlight.html", "#D16568");
ini_set("highlight.keyword", "#7FA3BC; font-weight: bold");
ini_set("highlight.string", "#F2C47E");
View boost example of threads and interrupts.cpp
#include <boost/thread.hpp>
#include <iostream>
using namespace std;
void ThreadFunction()
int counter = 0;
mgirouard /
Created Jul 17, 2016
GuzzleHttp Exception Hierarchy
  • GuzzleException
    • SeekException
    • TransferException
      • RequestException ( RequestInterface ; ResponseInterface | null )
        • TooManyRedirectsException
        • ConnectException
        • BadResponseException
          • ServerException
          • ClientException
View ObjectListener.php
namespace Fry;
use JsonStreamingParser\Listener;
* This implementation allows to process an object at a specific level
* when it has been fully parsed
class ObjectListener implements Listener
mcaskill / Function.Array-Group-By.php
Last active Sep 7, 2021
PHP : Groups an array by a given key
View Function.Array-Group-By.php
if (!function_exists('array_group_by')) {
* Groups an array by a given key.
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
* Based on {@author Jake Zatecky}'s {@link array_group_by()} function.
* This variant allows $key to be closures.
tureki / json_encode-null-to-empty-string-1.php
Last active Mar 31, 2021
json_encode null to empty string.
View json_encode-null-to-empty-string-1.php
$value = array(
josephok / client.c
Last active Sep 6, 2018
a stream socket server & client demo
View client.c
** client.c -- a stream socket client demo
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
tdebatty / delete_older_than.php
Last active Oct 14, 2021
A simple PHP function to delete files older than a given age. Very handy to rotate backup or log files, for example...
View delete_older_than.php
* A simple function that uses mtime to delete files older than a given age (in seconds)
* Very handy to rotate backup or log files, for example...
* $dir String whhere the files are
* $max_age Int in seconds
* return String[] the list of deleted files