現在幾點原理
- 安裝 node
- 新增一個資料夾放入
index.js
- 到資料夾下安裝
node-canvas
$ npm i canvas
<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(); |
<!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> |
#!/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 |
/* | |
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. |
// 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; | |
} |
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(() => { |
#!/bin/sh | |
# 還願機器人 | |
# 用法: | |
# $ chmod +x ./luxin.sh | |
# $ ./luxin.sh '陸心是誰創辦的?' | |
# { | |
# "type": "text", | |
# "data": "陸心青年服務團是由陸恭銘先生在1987年所創立。" | |
# } |
/* ==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") { |
>++++++[<+++++++>-] | |
++++++++++> | |
, | |
>++++++[<-------->-]< | |
[ | |
>+ | |
[ | |
>+>+<<- |
index.js
node-canvas
$ npm i canvas