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 MyMath | |
| { | |
| public interface ITypeConverter<T, TResult> | |
| { | |
| TResult Convert(T value); | |
| } | |
| /// <summary><c>TResult.CreateChecked</c> を用いて型変換を行います。</summary> | |
| public readonly struct CheckedTypeConverter<T, TResult> : ITypeConverter<T, TResult> | |
| where T : INumberBase<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 YouTube Comment Username Reveals | |
| // @description add user name for comment | |
| // @namespace https://htsign.hateblo.jp | |
| // @version 0.3.12 | |
| // @author htsign | |
| // @match https://www.youtube.com | |
| // @match https://www.youtube.com/* | |
| // @match https://m.youtube.com | |
| // @match https://m.youtube.com/* |
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
| ;; -*- mode: fundamental; coding: utf-8 -*- | |
| ;; Mathmatical Alphanumeric Symbols dictionary for SKK system | |
| ;; | |
| ;; https://www.asahi-net.or.jp/~ax2s-kmtn/ref/unicode/u1d400.html | |
| ;; | |
| ;; okuri-nasi entries | |
| A /𝔸/ | |
| B /𝔹/ | |
| C /ℂ/ | |
| D /𝔻/ |
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 Bing | |
| // @namespace https://htsign.hateblo.jp | |
| // @version 0.0.3 | |
| // @description add Hatebu images for Bing | |
| // @author htsign | |
| // @match https://www.bing.com/search?* | |
| // @downloadURL https://gist.github.com/htsign/b2c913f28e4b8646d0b30c4170e7d34c/raw/hatebu-for-bing.user.js | |
| // @updateURL https://gist.github.com/htsign/b2c913f28e4b8646d0b30c4170e7d34c/raw/hatebu-for-bing.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
| let string_of_list ~to_string xs = | |
| "[" ^ String.concat "; " (List.map to_string xs) ^ "]" | |
| let string_of_opt ~to_string = | |
| function None -> "None" | Some x -> Printf.sprintf "Some(%s)" @@ to_string x | |
| let () = | |
| let print_optlist theme xs = | |
| let xs = OptionList.to_optlist xs in | |
| let lstr = string_of_list ~to_string:(string_of_opt ~to_string:string_of_int) xs in |
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 List = struct | |
| include Stdlib.List | |
| let hd_opt xs = try Some (hd xs) with Failure _ -> None | |
| end | |
| let char_list_of_string string = | |
| let rec aux acc idx = | |
| if idx >= 0 then |
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
| (* libraries definitions *) | |
| (* Haskell's Data.Function.on implementation in OCaml *) | |
| module Data : sig | |
| module Function : sig | |
| val on : ('b -> 'b -> 'c) -> ('a -> 'b) -> ('a -> 'a -> 'c) | |
| end | |
| end = struct | |
| module Function = struct | |
| let on bf f = fun x y -> bf (f x) (f y) |
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 List = struct | |
| include Stdlib.List | |
| let group_by (projection : 'a -> 'key) (xs : 'a list) : ('key * 'a list) list = | |
| let pairs = xs |> List.map (fun x -> projection x, x) in | |
| let rec aux acc = function | |
| | [] -> acc |> List.rev | |
| | ((k, _) :: _) as xs -> | |
| let ys, zs = xs |> List.partition (fun t -> fst t = k) in |
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
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.Objects; | |
| public class Pair<Left, Right> { | |
| private static final List<Pair<?, ?>> cache = new ArrayList<>(); | |
| public final Left left; | |
| public final Right right; | |
| private Pair(Left left, Right right) { |
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
| // required: FSharp.Control.AsyncSeq | |
| open FSharp.Control | |
| open System.Diagnostics | |
| open System.Drawing | |
| open System.Windows.Forms | |
| let inline initCollectionWithCtor< ^a, 'b, 'c when ^a : (member Add : 'b -> 'c)> items collection = | |
| let add xs x = (^a : (member Add : 'b -> 'c) (xs, x)) | |
| items |> List.fold (fun (xs : 'a) x -> add xs x |> ignore; xs) collection |
NewerOlder