Skip to content

Instantly share code, notes, and snippets.

View chadluo's full-sized avatar
🟢
pls gib green

Chad Luo chadluo

🟢
pls gib green
  • Sydney
  • 00:48 (UTC +11:00)
View GitHub Profile
@chadluo
chadluo / README.md
Last active November 6, 2024 22:19
Manage Chrome tabs, a methodology

Main idea: use multiple windows and each for a particular project. Can leave one as a catch-all.

From top right menu > More Tools > Name Window..., name each window. Use certain symbols or formats to differ manually renamed windows from page original tabs.

The name isn't directly visible but will be shown in different scenarios:

  • on Mac, using Mission Control or App Exposé
  • on Windows, on taskbar or switch windows using Alt-Tab

When open new tabs, consider moving them to the corresponding window. Either by dragging or right click on the tab and choose Move Tab to Another Window.

@chadluo
chadluo / Web dev explained.md
Last active May 7, 2024 15:07
An oversimplified idea behind web development and tooling etc., like how did it come here

I remembered reading an article like this years ago but couldn't find it any more. I'd rather rewrite one myself.

Browsers

The term "Web" in most contexts refer to stuff happening in the browser or on the browser tech stack, for example when comparing different implementations of an app (platform native, containerized/VM or in a browser). Web apps can reach cross-platform easier than other tech stacks as most devices will have a browser, but they fall behind in performance and system API availability.

Browsers send requests to servers and receive text based HTML code represented various elements -- text, blocks, links to external resources like images & videos -- to render onto the viewport.

HTML supports semantic elements (bullet point lists, tables etc.) and basic styling (for example fgColor and bgColor), but people want better control and performance, so [CSS

@chadluo
chadluo / userscript.js
Last active November 16, 2022 06:48
Bitbucket Pull Request Comment Watch or something
// ==UserScript==
// @name Pull Request Comment Watch or something
// @namespace Violentmonkey Scripts
// @match https://bitbucket.org/*/pull-requests/*
// @version 1.0
// @author https://gist.github.com/chadluo
// @icon https://www.google.com/s2/favicons?domain=bitbucket.org
// @grant GM_addStyle
// ==/UserScript==
@chadluo
chadluo / userscript.js
Created August 31, 2021 06:19
Google search get favicon and hide http/https
// ==UserScript==
// @name Google search favicon
// @namespace http://tampermonkey.net/
// @author chadluo
// @match https://www.google.com/search*
// @grant none
// ==/UserScript==
'use strict';
@chadluo
chadluo / bitbucket-PR-syntax-highlight.js
Last active September 9, 2022 03:41
Bitbucket PR syntax highlight (actually just hljs wrapper but whatever)
// ==UserScript==
// @name Bitbucket PR syntax highlight (actually just a HLJS wrapper)
// @namespace http://tampermonkey.net/
// @version 0.1
// @description use HLJS to syntax highlight Bitbucket PR. see https://highlightjs.org/usage/
// @author Chad
// @match https://bitbucket.org/*/pull-requests/*
// @icon https://www.google.com/s2/favicons?domain=bitbucket.org
// @grant GM_addStyle
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js
@chadluo
chadluo / timestamps.md
Last active February 16, 2021 02:52
On timestamp formats

On timestamp formats

Scope

Timestamp: the instant when an event happened (or will happen), be it a server log, a comment, a commit, an email, start/end of CI build, publish time/last edited time of a video/blog post etc. Should not be long lasting events.

User: the people who refer to the timestamp to find when the event happened. The event may or may not be created by the user.

@chadluo
chadluo / README.md
Created August 17, 2020 07:05
Build easy_rust to PDF with Pandoc

easy_rust

Basic steps

  1. install texlive-full
  2. replace bare \n, \t with \n, \t
  3. $ pandoc -o easy_rust.pdf --pdf-engine=xelatex --metadata pagetitle="Easy Rust" README.md
@chadluo
chadluo / tweetdeck.css
Created August 6, 2020 01:18
Tweetdeck Stylus
html,
html.dark {
font-size: 16px;
}
html.dark .is-wide-columns .column {
width: 400px
}
html.dark .mdl.s-full {
@chadluo
chadluo / makefile
Last active December 12, 2023 05:05
resume template & builder
# usage:
# $ make
john_doe.pdf: resume.md
pandoc -o john_doe.pdf resume.md
resume.md:
sudo apt update
sudo apt install pandoc texlive-base texlive-latex-extra
echo "$$SAMPLE_MD" > resume.md
@chadluo
chadluo / Ties.java
Last active June 3, 2020 05:00
enumerate electoral college ties
import java.util.Set;
import java.util.stream.*;
public class Ties {
// https://en.wikipedia.org/wiki/United_States_Electoral_College#Current_electoral_vote_distribution
private static final String[] STATES = {
"AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA",
"KS", "KY", "LA", "ME", "ME-1", "ME-2", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NE-1",