Skip to content

Instantly share code, notes, and snippets.

☕️
Will code for coffee

Salis Braimah msbrime

☕️
Will code for coffee
Block or report user

Report or block msbrime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@msbrime
msbrime / add_time.js
Created Apr 2, 2019
Add days to a date in javascript. Can use in conjunction with `setHours` to get the exact time of a specific day
View add_time.js
function addDaysToDate(date,numberOfDays){
return new Date(
date.getTime() +
daysToMilliseconds(numberOfDays)
);
}
function daysToMilliseconds(days){
return days * 86400000
}
@msbrime
msbrime / ratchet-dispatcher.js
Created Mar 23, 2019
A dispatcher for twbs/ratchet that fires events on page/route change
View ratchet-dispatcher.js
window.Dispatcher = (function(win){
var instance;
function init(){
var
callbackRegister = {},
pageCheck;
@msbrime
msbrime / git_remove_residual_files_and_folders.sh
Last active Sep 11, 2018
Remove leftover files and folders when you switch your working branch
View git_remove_residual_files_and_folders.sh
git reset --hard && git clean -f -d
@msbrime
msbrime / getBrowserEvents.js
Created Oct 29, 2017
Get all events supported by a particular browser
View getBrowserEvents.js
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 / Dispatcher.js
Created Aug 2, 2017
A general purpose event dispatcher
View Dispatcher.js
/** @constructor */
function Dispatcher(context, events) {
this.ctx = context;
this.events = events;
this.listeners = {};
}
/**
* Adds an event listener to an event
*
@msbrime
msbrime / ApiResponse.php
Last active Jul 25, 2017
A wrapper for guzzle http responses from an API
View ApiResponse.php
<?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 / SpreadSheetGenerator.php
Created Jul 25, 2017
A spreadsheet generator implementation that uses PHPEXCEL
View SpreadSheetGenerator.php
<?php
namespace App\Library\Generators;
use PHPExcel\PHPExcel;
use PHPExcel\PHPExcel_IOFactory;
use PHPExcel\PHPExcel_Cell;
class SpreadSheetGenerator{
@msbrime
msbrime / AjaxValidatableRequest.php
Created Jul 25, 2017
An extension of TrimmedFormRequest.php.Makes requests validate only and does not submit after validation passes but rather returns a json response
View AjaxValidatableRequest.php
<?php
namespace App\Http\Requests;
use Illuminate\Validation\ValidationException;
/**
* Description of AjaxValidatableFormRequest
*
* @author msalisu
*/
@msbrime
msbrime / TrimmedFormRequest.php
Created Jul 25, 2017
A form request that trims the parameters that are sent to it
View TrimmedFormRequest.php
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
/**
* Description of AjaxValidatableFormRequest
*
* @author msalisu
*/
View test.scala
val meaningOfLife = 42
You can’t perform that action at this time.