Skip to content

Instantly share code, notes, and snippets.

View JetLua's full-sized avatar
🍉

JetLu JetLua

🍉
View GitHub Profile
export function pureObject(o: unknown) {
if (!isObject(o)) return false
const ctor = o.constructor
if (ctor == null) return true
const prot = ctor.prototype
if (!isObject(prot)) return false
if (!Object.prototype.hasOwnProperty.call(prot, 'isPrototypeOf')) return false
@JetLua
JetLua / wx.d.ts
Last active April 15, 2021 03:15
微信小游戏 TypeScript 声明文件
declare module wx {
module cloud {
function downloadFile(opts: Callback<{
fileID: string
config?: {
env: string
}
success: (opts: {
tempFilePath: string
}) => void
const {prototype: {toString}, keys} = Object
const a = {
name: 'JetLu',
other: {age: 12, gender: 0, alias: 2}
}
const b = {
name: 'JetLu',
other: {age: 12, gender: 0, alias: 2}
#define NUM_OCTAVES 3
precision highp float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec4 inputSize;
uniform float t;
/***
* ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐
* │Esc│ │ F1│ F2│ F3│ F4│ │ F5│ F6│ F7│ F8│ │ F9│F10│F11│F12│ │P/S│S L│P/B│ ┌┐ ┌┐ ┌┐
* └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ └┘ └┘ └┘
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ ┌───┬───┬───┬───┐
* │~ `│! 1│@ 2│# 3│$ 4│% 5│^ 6│& 7│* 8│( 9│) 0│_ -│+ =│ BacSp │ │Ins│Hom│PUp│ │N L│ / │ * │ - │
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ ├───┼───┼───┼───┤
* │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │{ [│} ]│ | \ │ │Del│End│PDn│ │ 7 │ 8 │ 9 │ │
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ ├───┼───┼───┤ + │
* │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │: ;│" '│ Enter │ │ 4 │ 5 │ 6 │ │
@JetLua
JetLua / random.js
Last active February 18, 2019 15:31
let seed = 1
function seededRandom(max = 1, min = 0) {
seed = (seed * 9301 + 49297) % 233280;
let rnd = seed / 233280.0;
return min + rnd * (max - min);
function sort<T>(list: Array<T>, cmp?: (a: T, b: T) => number) {
const {length} = list
if (length < 2) return list
cmp ??= (x, y) => (x as unknown as number) - (y as unknown as number)
let unit = 1
let results = [] as Array<T>
while (length > unit) {
export default class Layout extends PIXI.Container {
static GRID = 2
static VERTICAL = 1
static HORIZONTAL = 0
#added = false
constructor(option = {}) {
const {
gap,