Skip to content

Instantly share code, notes, and snippets.

View RexSkz's full-sized avatar
🥰

Rex Zeng RexSkz

🥰
View GitHub Profile
@RexSkz
RexSkz / el-option-test.html
Last active August 16, 2017 07:12
Too many events are emited when `el-select`'s option changed
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<script type="text/javascript" src="https://fiddle.jshell.net/js/babel/babel.js"></script>
<script type="text/javascript" src="https://fiddle.jshell.net/js/lib/dummy.js"></script>
<link rel="stylesheet" type="text/css" href="https://fiddle.jshell.net/css/result-light.css">
<style type="text/css">
@RexSkz
RexSkz / prism-javascript.js
Last active February 8, 2022 04:07
JavaScript file highlight for Prism.js (support function arguments)
// The prism.js library has already supported identifying function arguments according to:
// https://github.com/PrismJS/prism/pull/1446
// https://github.com/PrismJS/prism/pull/1722
// Please use the latest version instead.
@RexSkz
RexSkz / keybase.md
Last active November 10, 2022 11:38

Keybase proof

I hereby claim:

  • I am rexskz on github.
  • I am skywalker_z (https://keybase.io/skywalker_z) on keybase.
  • I have a public key whose fingerprint is 8204 043E 7986 B839 4040 B47C C45E EA5D FACD 1B70

To claim this, I am signing this object:

@RexSkz
RexSkz / nfa-match.go
Last active February 8, 2022 04:23
A simple code to show how NFA RegExp engine works.
package main
import (
"fmt"
)
func match(s string, rules []string, sIndex, ruleIndex int) bool {
if ruleIndex == len(rules) {
fmt.Println("match: success")
return true
@RexSkz
RexSkz / roses-are-red.js
Created August 16, 2019 08:30 — forked from mutoo/roses-are-red.js
Roses are read, violets are blue. Unexpected token { at line 32.
// inspired by https://twitter.com/nixcraft/status/1162020669242003456
console.log('Roses are red, violets are blue.');
@RexSkz
RexSkz / stringify.ts
Created February 8, 2022 03:57
JSON.stringify with depth limit
const stringify = (
obj: any,
replacer?: (this: any, key: string, value: any) => any,
space?: string | number,
depth = Infinity,
): string => {
if (!obj || typeof obj !== 'object') {
return JSON.stringify(obj, replacer, space);
}
const t = depth < 1