This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sealed class Result<A, E> { | |
| fun <B> map(mapping: (A) -> B): Result<B, E> = | |
| when (this) { | |
| is Success -> Success(mapping(value)) | |
| is Failure -> Failure(reason) | |
| } | |
| fun <B> bind(mapping: (A) -> Result<B, E>): Result<B, E> = | |
| when (this) { | |
| is Success -> mapping(value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Requirements | |
| # You will need to have created a GitHub Access Token with admin:public_key permissions | |
| # Usage | |
| # chmod +x autokey-github.sh | |
| # ./autokey-github.sh <YOUR-GITHUB-ACCESS-TOKEN> | |
| # Reference |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GIT heart FZF | |
| # ------------- | |
| is_in_git_repo() { | |
| git rev-parse HEAD > /dev/null 2>&1 | |
| } | |
| fzf-down() { | |
| fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // set-up a connection between the client and the server | |
| var socket = io.connect(); | |
| // let's assume that the client page, once rendered, knows what room it wants to join | |
| var room = "abc123"; | |
| socket.on('connect', function() { | |
| // Connected, let's sign-up for to receive messages for this room | |
| socket.emit('room', room); | |
| }); |