Skip to content

Instantly share code, notes, and snippets.



  • Sydney, Australia
Block or report user

Report or block wafs

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
wafs / FindOrFail.ts
Last active Dec 23, 2018
Type safe FindOrfail implementation in typescript
View FindOrFail.ts
// Takes an array of data, then a comparator, then returns a function that will search for the item given some key
const finder = <T>(arr: T[]) =>
<K>(comparator: (key: K, item: T) => boolean) =>
(key: K) => arr.find(v => comparator(key, v));
// Wraps the input function to throw on undefined while keeping it type safe
const throwOnUndefined = <F extends Function>(f: F): F => {
return <any>function (...args: any[]): F {
wafs / jquery_overlay_demo.html
Created Jul 14, 2016
Jquery overlay that works with any obnoxious framework (so long as have no need to maintain the overlay's state)
View jquery_overlay_demo.html
#background-overlay {
cursor: zoom-out;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.75);
width: 100%;
height: 100%;
z-index: 1000;
wafs / Select2 + Bindjs helper
Created Oct 30, 2015
If you're trying to bind a select box and you have select2 implemented, you're gonna have a bad time. Do this and it should fix most things with select dropdowns.
View Select2 + Bindjs helper
// Helper for Select2, since bind.js uses input events and select2 uses onchange.
var inputChangeEvent = new Event('input');
$('select').on("select2:select", function(e){
wafs / BladeExtensionServiceProvider.php
Last active Nov 10, 2016
Set variables in blade without having them echo out
View BladeExtensionServiceProvider.php
<?php namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class BladeExtensionServiceProvider extends ServiceProvider {
* Bootstrap the application services.
You can’t perform that action at this time.