Skip to content

Instantly share code, notes, and snippets.

View Flexicon's full-sized avatar
👻

Mike Repeć Flexicon

👻
View GitHub Profile
@Flexicon
Flexicon / OptionMonad.kt
Created May 6, 2024 19:55
A simple Option Monad implementation in Kotlin
package dev.flexicon.monads
sealed interface Option<out T> {
data class Some<T>(val value: T) : Option<T>
object None : Option<Nothing>
}
fun <T> some(value: T): Option<T> = Option.Some(value)
@Flexicon
Flexicon / async.js
Last active May 2, 2024 15:47
Showing how to handle thrown errors in Jest when testing asynchronous code
async function wontThrowErr() {
return 'ok';
}
async function mightThrowErr() {
throw new Error('oops');
}
module.exports = {
mightThrowErr,
@Flexicon
Flexicon / pass-slots.md
Created April 28, 2020 11:23 — forked from loilo/pass-slots.md
Vue: Pass Slots through from Parent to Child Components

Vue: Pass Slots through from Parent to Child Components

The Situation

  • We've got some components A, B and C which provide different slots.
    const A = {
      template: `<div><slot name="a">Default A Content</slot></div>`
    }

const B = {

@Flexicon
Flexicon / gist:553186aea385d04205af12a94876a0ba
Created September 22, 2018 15:42
Lazy load NVM (from reddit user sscotth)
declare -a NODE_GLOBALS=(`find ~/.nvm/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`)
NODE_GLOBALS+=("node")
NODE_GLOBALS+=("nvm")
load_nvm () {
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
}