Skip to content

Instantly share code, notes, and snippets.

View riophae's full-sized avatar

Fangzhou Li riophae

  • Beijing
View GitHub Profile
var 真 = true;
var 假 = !真;
function 如果(condation, then){
if(condation) then();
return {
否则: function(then){
if(!condation) then();
}
@ebidel
ebidel / mo_vs.proxy.js
Last active April 19, 2025 05:01
MutationObserver vs. Proxy to detect .textContent changes
<!--
This demo shows two ways to detect changes to a DOM node `.textContent`, one
using a `MutationObserver` and the other using an ES2015 `Proxy`.
From testing, a `Proxy` appears to be 6-8x faster than using a MO in Chrome 50.
**Update**: removing the `Proxy` altogether speeds up the MO to be inline with the Proxy.
This has something to do with how the browser queues/prioritizes Proxies over MO.
@fernandoaleman
fernandoaleman / clone-git-repo.txt
Last active January 8, 2025 09:51
How to clone git repo with all branches and tags
# Clone repo
git clone --mirror [email protected]/fernandoaleman/app.git app/.git
# Change into app directory
cd app
# Update git config
git config --unset core.bare
# Checkout master branch
@drexler
drexler / install.sh
Created May 24, 2018 16:03
Install Chrome under WSL
# assumes you have ubuntu-desktop installed which includes stock libpulse
sudo add-apt-repository ppa:therealkenc/wsl-pulseaudio
sudo apt-get update && sudo apt-get upgrade
# Download the stable or development Chrome .deb package - dev if you want headless functionality
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt -f install # probably
wget https://github.com/therealkenc/libudev-stub/releases/download/v0.9.0/libudev-stub-0.9.0-WSL.deb