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
void function () { | |
const canvas = document.createElement('canvas') | |
canvas.width = document.documentElement.offsetWidth | |
canvas.height = document.documentElement.offsetHeight | |
canvas.style.position = 'absolute' | |
canvas.style.left = '0' | |
canvas.style.right = '0' | |
canvas.style.top = '0' |
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 {string} str | |
*/ | |
function str2num (str) { | |
const [m, e = ''] = str.split('e') | |
const [i, f = ''] = m.split('.') | |
let result = 0 | |
// handle int | |
let sign = 1 | |
for (let x of i) { |
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> | |
<style> | |
.flex-container { | |
background-color: blanchedalmond; |
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
window.onload = function () { | |
let names = Object.getOwnPropertyNames(window) | |
names = names.filter(x => !x.match(/^on/)) | |
names = names.filter(x => !x.match(/^webkit|^WebKit/)) | |
/** | |
* ---------------------------------- WHATWG --------------------------------------- | |
*/ | |
{ |
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 tweenFns = { | |
linear: (from, to, t, d) => from + (to - from) * (t / d) | |
} | |
/** | |
* only support "linear" timing-function | |
* duration unit is "ms" | |
* @param {HTMLElement} el | |
* @param {({prop: String, value: String, duration: Number})[]} list | |
*/ |
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
在我刚学习 `Rust` 的时候,我看过一遍 nll 的原文,那时候大概只能看懂一小部分。 | |
古语说,书读百遍其义自现,真的是一句真理。 | |
为什么通过反复读,有些不理解的地方就能理解就能想通了呢? | |
我觉得很大一部分原因是,你对它越来越熟悉了,你对它里面提到的概念越来越熟悉了。 | |
你读第一遍的时候,一个概念是什么,你还要费力地想一想, | |
读第二三遍的时候,你已经对这个概念建立了一种直觉, | |
因此你的思考能量(类似于精力吧,是有限的)就可以用在其他更关键的地方。 | |
我之所以想翻译这篇 RFC,原因之一是想锻炼一下自己的英文; |
This file has been truncated, but you can view the full file.
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
A MIDSUMMER-NIGHT'S DREAM | |
Now , fair Hippolyta , our nuptial hour | |
Draws on apace : four happy days bring in | |
Another moon ; but O ! methinks how slow | |
This old moon wanes ; she lingers my desires , | |
Like to a step dame , or a dowager | |
Long withering out a young man's revenue . | |
Four days will quickly steep themselves in night ; |