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
#Requires AutoHotkey v2.0 | |
LAlt::RCtrl | |
^e::Send "#1" | |
CapsLock & E::Send "{End}" | |
CapsLock & A::Send "{Home}" | |
CapsLock & c::Send "^z" |
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"> | |
<title>上下分层提高 Canvas 书写性能</title> | |
<style> | |
body, | |
html { |
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" /> | |
<title>Document</title> | |
</head> | |
<body> | |
<img hidden id="img" src="" /> |
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 blob = new Blob([skiaImage.encodeToBytes()], { type: 'image/png' }) | |
const imageUrl = URL.createObjectURL(blob); | |
const img = new Image(); | |
img.src = imageUrl; | |
document.body.appendChild(img) |
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 getOffset = el => { | |
const { | |
top, | |
left | |
} = el.getBoundingClientRect() | |
const { | |
scrollTop, | |
scrollLeft | |
} = document.body | |
return { |
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
// 运用正则去掉空格 | |
' s123s'.replace(/^(\s*)(.+)(\s*)$/, '$2') | |
// 日期操作 | |
const dataPattern = (str, format = '-') => { | |
if (!str) { | |
return new Date() | |
} | |
const dateReg = new RegExp(`^(\\d{2})${format}(\\d{2})${format}(\\d{4})$`) | |
const [, month, day, year] = dateReg.exec(str) |
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 curring = fn => { | |
const { length } = fn | |
const curried = (...args) => { | |
return (args.length >= length | |
? fn(...args) | |
: (...args2) => curried(...args.concat(args2))) | |
} | |
return curried | |
} |
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 listChunk = (list, size = 1, cacheList = []) => { | |
const tmp = [...list] | |
if (size <= 0) { | |
return cacheList | |
} | |
while (tmp.length) { | |
cacheList.push(tmp.splice(0, size)) | |
} | |
return cacheList | |
} |
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
class Http { | |
public static Inst(): Http { | |
if (null == Http._inst) { | |
Http._inst = new Http(); | |
} | |
return Http._inst; | |
} | |
private static _inst: Http; | |
public constructor() { |
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 SceneA = new Phaser.Class({ | |
Extends: Phaser.Scene, | |
initialize: | |
function SceneB() { | |
Phaser.Scene.call(this, 'sceneA'); | |
this.pic; |
NewerOlder