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 Student = struct | |
| type t = { id: int; name: string; } | |
| let init (id, name) = { id = id; name = name; } | |
| end | |
| ;; | |
| let alice = Student.init(0, "Alice") | |
| (* val alice : Student.t = {Student.id = 0; name = "Alice"} *);; | |
| let () = Printf.printf "Hello, %s\n" alice.name |
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
| <pre><code id="output"></code></pre> | |
| <script> | |
| // https://stackoverflow.com/a/59925724 | |
| if (/^file:\/\/\//.test(location.href)) { | |
| let path = './'; | |
| let orig = fetch; | |
| window.fetch = (resource) => ((/^[^/:]*:/.test(resource)) ? | |
| orig(resource) : | |
| new Promise(function(resolve, reject) { | |
| let request = new XMLHttpRequest(); |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Webkit Selector List Bug</title> | |
| </head> |
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 | |
| # usage: | |
| # # if you install youtube-dl locally | |
| # $ type youtube-dl | |
| # youtube-dl 是 /usr/bin/youtube-dl | |
| # $ bash sync.sh | |
| # | |
| # # if you use youtube-dl by docker alias | |
| # $ type youtube-dl |
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
| /* | |
| In JavaScript, objects can be used to serve various purposes. | |
| To maximise our usage of the type system, we should assign different types to our objects depending | |
| on the desired purpose. | |
| In this blog post I will clarify two common purposes for objects known as records and dictionaries | |
| (aka maps), and how they can both be used with regards to the type system. |
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
| // ref: https://t.me/JavaScriptTw/52631 | |
| function sum(...args) { | |
| const total = args.reduce((p, c) => p + c); | |
| const sumFunc = sum.bind(null, total); | |
| sumFunc.valueOf = () => total; | |
| return sumFunc; | |
| } |
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 AbortController from "abort-controller" | |
| import { AbortSignal } from "abort-controller" | |
| import { AbortablePromise } from "." | |
| var controller = new AbortController() | |
| function sleep (signal: AbortSignal, time: number) { | |
| return AbortablePromise(signal, function (resolve, reject, handleCancel) { | |
| var id = setTimeout(resolve, time) | |
| handleCancel(() => { |
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/sh | |
| # 還願機器人 | |
| # 用法: | |
| # $ chmod +x ./luxin.sh | |
| # $ ./luxin.sh '陸心是誰創辦的?' | |
| # { | |
| # "type": "text", | |
| # "data": "陸心青年服務團是由陸恭銘先生在1987年所創立。" | |
| # } |
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
| /* ==UserStyle== | |
| @name Patchouli 自訂樣式 | |
| @namespace https://github.com/FlandreDaisuki | |
| @version 4.2.0-alpha | |
| @description Patchouli 自訂樣式 | |
| @author FlandreDaisuki | |
| @var color illust-title-visited-color "拜訪過的連結顏色" #FF0000 | |
| ==/UserStyle== */ | |
| @-moz-document domain("pixiv.net") { |
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
| >++++++[<+++++++>-] | |
| ++++++++++> | |
| , | |
| >++++++[<-------->-]< | |
| [ | |
| >+ | |
| [ | |
| >+>+<<- |