Skip to content

Instantly share code, notes, and snippets.

View msbrime's full-sized avatar
Will code for coffee

Salis Braimah msbrime

Will code for coffee
View GitHub Profile
@msbrime
msbrime / bootstrap_modal_adapter.js
Last active November 2, 2016 09:03
A modal implementation with an adapter for Bootstrap
var Modal = (function () {
var adapter;
function init(modalAdapter) {
adapter = modalAdapter;
return {
@msbrime
msbrime / test.scala
Created November 2, 2016 09:05 — forked from jdesiloniz/test.scala
A Gist
val meaningOfLife = 42
@msbrime
msbrime / TrimmedFormRequest.php
Created July 25, 2017 16:14
A form request that trims the parameters that are sent to it
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
/**
* Description of AjaxValidatableFormRequest
*
* @author msalisu
*/
@msbrime
msbrime / AjaxValidatableRequest.php
Created July 25, 2017 16:17
An extension of TrimmedFormRequest.php.Makes requests validate only and does not submit after validation passes but rather returns a json response
<?php
namespace App\Http\Requests;
use Illuminate\Validation\ValidationException;
/**
* Description of AjaxValidatableFormRequest
*
* @author msalisu
*/
@msbrime
msbrime / SpreadSheetGenerator.php
Created July 25, 2017 16:20
A spreadsheet generator implementation that uses PHPEXCEL
<?php
namespace App\Library\Generators;
use PHPExcel\PHPExcel;
use PHPExcel\PHPExcel_IOFactory;
use PHPExcel\PHPExcel_Cell;
class SpreadSheetGenerator{
@msbrime
msbrime / ApiResponse.php
Last active July 25, 2017 16:25
A wrapper for guzzle http responses from an API
<?php
namespace App\Library\Response;
use GuzzleHttp\Message\Response;
class ApiResponse
{
/*
* The status code of a response represented as a single integer
* denoting the general status of the response
@msbrime
msbrime / Dispatcher.js
Created August 2, 2017 23:12
A general purpose event dispatcher
/** @constructor */
function Dispatcher(context, events) {
this.ctx = context;
this.events = events;
this.listeners = {};
}
/**
* Adds an event listener to an event
*
@msbrime
msbrime / getBrowserEvents.js
Created October 29, 2017 19:34
Get all events supported by a particular browser
function getBrowserEvents ()
{
var browserEvents = [];
for (var e in document) if (typeof document[e] !== "function" && e !== null && e.substring(0, 2) === "on") browserEvents[browserEvents.length] = e.substring(2);
return browserEvents;
}
@msbrime
msbrime / git_remove_residual_files_and_folders.sh
Last active September 11, 2018 21:04
Remove leftover files and folders when you switch your working branch
git reset --hard && git clean -f -d
@msbrime
msbrime / ratchet-dispatcher.js
Created March 23, 2019 13:24
A dispatcher for twbs/ratchet that fires events on page/route change
window.Dispatcher = (function(win){
var instance;
function init(){
var
callbackRegister = {},
pageCheck;