Skip to content

Instantly share code, notes, and snippets.

View iShawnWang's full-sized avatar
🤗
2333

Shawn Wang iShawnWang

🤗
2333
View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active April 25, 2024 06:09
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@jinjier
jinjier / 250.csv
Last active April 22, 2024 13:55
JavDB Top 250 movies code list. [Updated at 2024/02]
1 LAFBD-41
2 SSNI-497
3 ABP-984
4 IPX-580
5 IPX-811
6 IPX-177
7 STARS-804
8 SMBD-115
9 ABP-968
10 ABF-017
@dhaneshgosai
dhaneshgosai / AppStoreUpdate.swift
Last active April 27, 2023 09:29
This Gist Class for Checking App Store version with local version.
//
// AppStoreUpdate.swift
//
// Created by CodeChanger on 03/11/19.
// Copyright © 2019 CodeChanger. All rights reserved.
//
import UIKit
enum CustomError: Error {
@iShawnWang
iShawnWang / useRouter.ts
Last active July 27, 2019 05:52
react-router backward hooks, support react-router 4.x | 5.x
import { __RouterContext as RouterContext, RouteComponentProps } from 'react-router'
import { useContext, useMemo, useCallback } from 'react'
import qs from 'qs'
import { Location } from 'history'
interface ParsedQuery {
[whatever: string]: any
}
export const useRouter = <T>(): RouteComponentProps<T> =>
@lqt0223
lqt0223 / json_parser.js
Created December 27, 2017 09:55
18 JSON parser
// This is a coding exercise of implementing a parser. Some minor parsing capabilities are not implemented.
// The algorithm are mainly from Douglas Crockford's 'https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js'
function json_parse(str) {
var i = 0
var ch = str[i]
// core function that recursively called to move forward scanning pointers and accept tokens
function next(c) {
if (c) {
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active April 11, 2024 15:02
React Native Bridging Cheatsheet
@webfrogs
webfrogs / shell.sh
Created March 30, 2017 02:55
Output swift function information whose compile time is large than 100ms
xcodebuild -workspace XXX.xcworkspace -scheme XXX clean build OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" | grep '^\d\{3,\}[.]\{1\}'
@dannypule
dannypule / json_to_csv.js
Created February 8, 2017 18:40
Export JSON to CSV file using Javascript
function convertToCSV(objArray) {
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
var str = '';
for (var i = 0; i < array.length; i++) {
var line = '';
for (var index in array[i]) {
if (line != '') line += ','
line += array[i][index];
@zmmbreeze
zmmbreeze / analytics.js
Last active April 23, 2024 02:14
GA的源码 analytics.js
(function() {
/**
* 记录方法使用情况的类
* @param {Array.<boolean>} umMap 初始的使用情况
*/
var UsageManager = function(umMap) {
this.umMap = umMap || [];
};
/**
* 记录新的使用情况
@QinMing
QinMing / .zshrc
Last active March 10, 2024 22:17
.zshrc (lazy loading shell functions)
# Copyright (c) 2016-2018 Ming Qin (覃明) <https://github.com/QinMing>
# Open source under MIT LICENSE.
lazy_load() {
# Act as a stub to another shell function/command. When first run, it will load the actual function/command then execute it.
# E.g. This made my zsh load 0.8 seconds faster by loading `nvm` when "nvm", "npm" or "node" is used for the first time
# $1: space separated list of alias to release after the first load
# $2: file to source
# $3: name of the command to run after it's loaded
# $4+: argv to be passed to $3