Skip to content

Instantly share code, notes, and snippets.

View hbackman's full-sized avatar

Hampus Backman hbackman

  • SafetyAmp
  • United States
View GitHub Profile
@hbackman
hbackman / http-basic-auth.php
Created September 9, 2021 17:50
PSR Compliant Basic Auth Decode
<?php
/**
* Get the HTTP Basic Auth information from the request.
*
* @param ServerRequestInterface $request
*
* @return array
*/
function getBasicAuth(ServerRequestInterface $request): array
@hbackman
hbackman / .vimrc
Created May 3, 2021 14:07
My personal vim configuration
set encoding=utf8
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=/usr/local/opt/fzf
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
@hbackman
hbackman / hbackman.zsh-theme
Last active May 3, 2021 14:08
My personal Zsh theme
# Based on Evan's prompt
PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~ \$(git_prompt_info)%{${fg[blue]}%}#%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}<"
ZSH_THEME_GIT_PROMPT_SUFFIX="> %{$reset_color%}"
@hbackman
hbackman / colors.php
Created January 5, 2021 17:23
PHP Functions to Convert Hex to RGB & HSL
<?php
function rgb($hex)
{
[$r, $g, $b] = sscanf($hex, "#%02x%02x%02x");
return [$r, $g, $b];
}
function hsl($hex)
@hbackman
hbackman / CacheServiceProvider.php
Created June 12, 2020 18:38
Laravel 7.x Database Cache Locking for 6.x
<?php
namespace App\Providers;
use App\Cache\DatabaseStore;
use Illuminate\Cache\CacheManager;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
class CacheServiceProvider extends ServiceProvider
{