Skip to content

Instantly share code, notes, and snippets.

View EastSun5566's full-sized avatar
🤔
Hmm

Michael Wang 汪東陽 EastSun5566

🤔
Hmm
View GitHub Profile
@EastSun5566
EastSun5566 / ui-class-debugger.user.js
Created June 20, 2025 06:39 — forked from stanley2058/ui-class-debugger.user.js
Highlight all `ui-` class on a web page
// ==UserScript==
// @name HackMD `ui-` classes highlighter
// @namespace http://hackmd.io/
// @version 0.1.2
// @description Show all `ui-` classes
// @author stanley2058, Yukaii
// @match https://hackmd.io/*
// @match https://local.localhost/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=hackmd.io
// @grant GM.getValue

How to install game-porting-toolkit (aka proton for macOS)

You also might wanna just use Whisky which does this automatically

This guide works on macOS 13.4+ using Command Line Tools for XCode 15 Beta!

What is this?

In the recent WWDC, Apple announced and released the "game porting toolkit", which upon further inspection this is just a modified version of CrossOver's fork of wine which is a "compatibility layer" that allows you to run Windows applications on macOS and Linux.

@EastSun5566
EastSun5566 / chunk.js
Created April 16, 2020 08:17
Creates an array of elements split into groups the length of size.
const chunk = (input, size) => input.reduce((arr, item, index) => index % size === 0
? [...arr, [item]]
: [...arr.slice(0, -1), [...arr.slice(-1)[0], item]], []);
@EastSun5566
EastSun5566 / pipe.js
Created April 11, 2020 15:53
Pipe function implement
const pipe = (...fns) => (param) => fns.reduce(
(res, fn) => (res.then && res.then(fn)) || fn(res),
param
);
@EastSun5566
EastSun5566 / History|-103ecb5b|entries.json
Last active January 17, 2023 14:01
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///Users/eastsun/Projects/url-shortener/server/src/db/redis.js","entries":[{"id":"mijG.js","timestamp":1673706970066}]}
@EastSun5566
EastSun5566 / scroll-to.js
Last active January 21, 2021 07:32
Simple smooth scroll with pure JavaScript
// To element
const scrollTo = (selectors) => {
document
.querySelector(selectors)
.scrollIntoView({ behavior: 'smooth' });
};
// To top
const scrollToTop = () => {
window.scroll({
@EastSun5566
EastSun5566 / try-catch-wrapper.js
Last active January 21, 2021 07:31
use async/await without try/catch
const request = async (url) => {
const res = await fetch(url);
if (!res.ok) throw new Error(res.statusText);
return res.json()
}
// 1. HOF
// HOF to add try/catch to async function
const catch = fn => async (...params) => {
@EastSun5566
EastSun5566 / logger.js
Last active October 9, 2020 08:37
Wrap console to disable in production
const isProduction = process.env.NODE_ENV === 'production';
// HOF to craete customized logger
const createLogger = fn => (...params) => {
if (isProduction) return;
fn(...params);
};
const debug = createLogger(console.log);
const error = createLogger(console.error);