Skip to content

Instantly share code, notes, and snippets.

View mccahan's full-sized avatar

Ryan McCahan mccahan

View GitHub Profile
@rcknr
rcknr / README.md
Created August 28, 2018 07:37
Laravel Custom Hasher

Laravel Custom Hasher

When you need to hash and check passwords using an algorithm other than supported bcrypt or argon there is an easy way to add a custom one. When I needed to use md5 for a legacy project I have tried to quickly google a solution and most I had found were based on creating a ServiceProvider which completely overrides builtin HashManager. The other way would be to extend it instead. So I have added a following into my AuthServiceProvider's boot() method:

$this->app->make('hash')->extend('md5', function() {
    return new Md5Hasher;
});
@marcelstoer
marcelstoer / debounce-with-tmr.lua
Last active December 7, 2019 06:05
NodeMCU debounce based on timer with GPIO pullup
-- inspired by https://github.com/hackhitchin/esp8266-co-uk/blob/master/tutorials/introduction-to-gpio-api.md
-- and http://www.esp8266.com/viewtopic.php?f=24&t=4833&start=5#p29127
local pin = 4 --> GPIO2
function debounce (func)
local last = 0
local delay = 50000 -- 50ms * 1000 as tmr.now() has μs resolution
return function (...)
local now = tmr.now()
@gre
gre / easing.js
Last active April 30, 2024 04:58
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {