Skip to content

Instantly share code, notes, and snippets.

View err0r500's full-sized avatar

Matthieu Jacquot err0r500

View GitHub Profile
@err0r500
err0r500 / main.go
Last active May 24, 2024 02:37
gin gonic with jwt from auth0 (and CORS enabled)
package main
import (
"github.com/auth0/go-jwt-middleware"
"github.com/dgrijalva/jwt-go"
"gopkg.in/gin-gonic/gin.v1"
)
func main() {
startServer()
@err0r500
err0r500 / main.hs
Created August 31, 2018 12:27
Haskell monadic typeclass
module Main where
import Control.Monad.Identity
-- boostrap the conditions leading to 2 different implementations of the same business logic
main :: IO ()
main = do
-- use a monad instance as 1st parameter in order to choose the implementation
expectedCalledWithMaybeInstance <- putStrLn $ getFirstName Nothing "heyhey"
expectedCalledWithIOInstance <- putStrLn $ getFirstName (Identity 0) "hoho"
@err0r500
err0r500 / main.hs
Created September 4, 2018 13:30
monad stacking example
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
module Main where
import Control.Monad.Except
import Control.Monad.Reader
import Control.Monad.State
import Control.Monad.Writer
@err0r500
err0r500 / main.hs
Created September 4, 2018 19:18
monadic business logic
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
module Main where
import Control.Monad.Identity
data User = User
{ name :: String
, firstName :: String
@err0r500
err0r500 / main.hs
Last active September 5, 2018 12:51
business logic
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
module Main where
import Control.Monad.Identity
import Control.Monad.Trans.Either
import Control.Monad.Trans.Except
data User = User
@err0r500
err0r500 / codeKitchen3.tidal
Last active January 18, 2019 23:17
tidal patch made during Creative Code Paris - Code Kitchen #3 listen : https://soundcloud.com/err0r_500/creative-code-paris-code-kitchen-3
do
let mG = 1
let s1G = 0.8
let s2G = 0.6
let s3G = 0.8
let s1Striation = 50
let s3Striation = 250
let s1 = every 4 rev
$ every 2 (spread fast [2, 3, 1, 2] )
$ every 3 (# speed 4)
do
let s1 =
sometimes (degradeBy 0.9) $
sound "sn sn ~ ~ sn*3, ~ ~ sn*3/3 ~ ~"
let s2 =
rarely (jux (iter 4)) $
sometimes rev $
rarely (striate 3) $
rarely (striate 40) $
spread ($) [
type UnionFinder interface {
Union(p, r int)
Connected(p, r int) bool
}
// wqupc : Weighted Quick Union with Path Compression algorithm
type wqupc struct {
ids []int
w []int
}
type UnionFinder interface {
Union(p, r int)
Connected(p, r int) bool
}
// clean : Weighted Quick Union with Path Compression algorithm
type clean struct {
ids []int
weights []int
}
[global_config]
always_split_with_profile = True
borderless = True
focus = mouse
inactive_color_offset = 0.0
title_font = Fira Code 9
title_use_system_font = False
[keybindings]
close_term = <Super>w
go_down = <Super>j