This file contains 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
MIT License | |
Copyright (c) [year] [fullname] | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
This file contains 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
/** | |
* Copyright 2021 Mmis1000 ([email protected]) | |
* | |
* Use of this source code is governed by an MIT-style | |
* license that can be found in the LICENSE file or at | |
* https://opensource.org/licenses/MIT. | |
*/ | |
/* | |
Selections: |
This file contains 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 Sane github dark theme text color | |
@namespace mmis1000.me | |
@version 0.0.4 | |
@license CC0 | |
@updateURL https://gist.githubusercontent.com/mmis1000/95f29ba3c7ff513536eb81ae52e11fb5/raw/GithubDarkThemePatch.user.css | |
@preprocessor stylus | |
@var select theme "Theme" ["near_white:Near White", "pure_white:Pure white", "whiter:Whiter"] | |
==/UserStyle== */ |
This file contains 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
/// <reference path="./weak-ref.ts" /> | |
// The finalizationRegistry must be keep alive or nothing will ever works | |
globalThis.finalizationRefs = globalThis.finalizationRefs || []; | |
let Tuple, Record; | |
{ | |
const valueSymbol = Symbol('value') | |
const LinkMap = new Map() |
This file contains 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 name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script> |
This file contains 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
/** | |
* @param {number} n | |
* @return {number} | |
*/ | |
var totalNQueens = function(n) { | |
var width = n | |
var total = 0 | |
function run(x, ltu, ltr, ltd) { | |
if (x >= width) { |
This file contains 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 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
var isChrome = (() => { | |
with ({}) { | |
var a = new ArrayBuffer(16) | |
new Float64Array(a)[0] = NaN | |
new Uint8Array(a)[0] = 1 | |
new Float64Array(a)[1] = new Float64Array(a)[0] | |
return new Uint8Array(a)[8] === 1 | |
} | |
}) |
This file contains 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
function unescape(str) { | |
return str.replace(/\\.|./g, (str)=>str.slice(str.length - 1)) | |
} | |
function format(template: string, obj: {[key: string]: string}) { | |
return template.replace(/\\.|\{(?:\\.|[^\}])+\}|./g, function (str) { | |
if (/^\{.+\}$/.test(str)) { | |
return obj[ | |
unescape(str.slice(1, str.length - 1)) |
This file contains 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
const camelToKebab = (string: string) => { | |
return string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); | |
}; | |
interface Callback { | |
(this: HTMLElement, newValue: string|null, oldValue: string|null): void | |
} | |
interface Transformer<T> { | |
fromAttribute(attr: string|null): T, |
NewerOlder