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
| module Option = struct | |
| let bind (f : 'a -> 'b option) : 'a option -> 'b option = function None -> None | Some x -> f x | |
| let map (f : 'a -> 'b) : 'a option -> 'b option = function None -> None | Some x -> Some (f x) | |
| end | |
| module Stream = struct | |
| include Stream | |
| let map (f : 'a -> 'b) (strm : 'a Stream.t) : 'b Stream.t = | |
| Stream.from (fun _ -> |
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
| // ==UserScript== | |
| // @name Auto change settings for Wandbox | |
| // @namespace https://htsign.hateblo.jp | |
| // @version 0.3.3 | |
| // @description save settings for each languages | |
| // @author htsign | |
| // @include https://wandbox.org/* | |
| // @downloadURL https://gist.github.com/htsign/d06bc205c00b843aba52d18ebfb3310d/raw/settings-for-wandbox.user.js | |
| // @updateURL https://gist.github.com/htsign/d06bc205c00b843aba52d18ebfb3310d/raw/settings-for-wandbox.user.js | |
| // @grant none |
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
| public static class Option | |
| { | |
| public static Option<T> Create<T>(T? value) => value != null ? new Some<T>(value) : Option<T>.None; | |
| public static None<dynamic> None { get; } = new None<dynamic>(); | |
| } | |
| public abstract class Option<T> : IEquatable<Option<T>> | |
| { | |
| public static Option<T> None { get; } = new None<T>(); |
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
| // ==UserScript== | |
| // @name Hatena bookmark compatibility for InoReader | |
| // @namespace https://htsign.hateblo.jp | |
| // @version 0.4.0 | |
| // @description add Hatebu images for InoReader | |
| // @author htsign | |
| // @match https://www.inoreader.com/* | |
| // @match https://jp.inoreader.com/* | |
| // @downloadURL https://gist.github.com/htsign/f32a273d50f0f62b7d220140c5722cad/raw/hatebu-for-inoreader.user.js | |
| // @updateURL https://gist.github.com/htsign/f32a273d50f0f62b7d220140c5722cad/raw/hatebu-for-inoreader.user.js |
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
| using System; | |
| abstract class ItemBase | |
| { | |
| public abstract override string ToString(); | |
| } | |
| class IntItem : ItemBase | |
| { | |
| private readonly int value; | |
| public IntItem(int value) => this.value = 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
| export const MyStorage = (() => { | |
| const sym = Symbol(); | |
| return class MyStorage { | |
| constructor() { | |
| if (arguments[0] !== sym) { | |
| return new Proxy(new MyStorage(sym), { | |
| get(target, prop) { | |
| if (prop === 'length') return target.length; | |
| const v = Reflect.get(target, prop); | |
| return typeof v === 'function' ? v.bind(target) : target.getItem(prop); |
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 easymotion | |
| set ideajoin | |
| set surround | |
| set commentary | |
| set incsearch | |
| nnoremap [c :action GotoNextError<CR> | |
| nnoremap ]c :action GotoPreviousError<CR> |
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
| curl https://sh.rustup.rs -sSf | sh -s -- --profile default | |
| set -U fish_user_paths ~/.cargo/bin $fish_user_paths | |
| rustup completions fish > ~/.config/fish/completions/rustup.fish | |
| cargo install ripgrep | |
| cargo install bat | |
| cargo install exa | |
| cargo install fd | |
| sudo add-apt-repository ppa:longsleep/golang-backports | |
| sudo apt update |
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
| list(N, N, [N]). | |
| list(S, E, L) :- | |
| S < E, | |
| succ(S, X), | |
| list(X, E, L1), | |
| L = [S | L1]. | |
| list(S, E, L) :- | |
| S > E, | |
| succ(X, S), | |
| list(X, E, L1), |
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
| iterator chunked*[T](xs: openArray[T], size: int, yieldRest = true): seq[T] = | |
| var | |
| i: int | |
| let | |
| last = xs.high | |
| for j in countup(0, xs.len, size + 1): | |
| i = j | |
| if i + size > last: break | |
| yield xs[i .. i + size] |