Skip to content

Instantly share code, notes, and snippets.

View dangh's full-sized avatar
🤖
I may be slow to respond.

Dang dangh

🤖
I may be slow to respond.
View GitHub Profile
@dangh
dangh / README.md
Last active September 6, 2023 19:35
Prominent tab color for Firefox container

firefox container tab color

  1. Go to about:config, enable these flags:
    • toolkit.legacyUserProfileCustomizations.stylesheets
    • layout.css.color-mix.enabled
  2. Go to about:support, look for profile folder.
  3. Add the CSS below to chrome/userChrome.css inside the profile folder.
<!--
Put this file in ~/Library/LaunchAgents/com.example.KeyRemapping.plist to
automatically remap your keys when macOS starts.
See https://developer.apple.com/library/archive/technotes/tn2450/_index.html for
the key "usage IDs". Take the usage ID and add 0x700000000 to it before putting it
into a source or destination (HIDKeyboardModifierMappingSrc and
HIDKeyboardModifierMappingDst respectively).
-->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
# install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
export PATH="$HOME/.cargo/bin:$PATH"
# clone crossfont and alacritty
git clone --depth 1 https://github.com/alacritty/crossfont.git
git clone --depth 1 https://github.com/alacritty/alacritty.git
# patching
sed -i '' -E 's/(set_allows_font_smoothing|set_should_smooth_fonts)\(true\)/\1(!use_thin_strokes)/' crossfont/src/darwin/mod.rs
@dangh
dangh / group_has_transient_sheet.md
Last active July 9, 2021 05:33
Prevent Sublime Text 3 close window on Command+W

Installation for ST3

curl -L https://gist.github.com/dangh/ffe9a735f441451f6e0c20f7e1e7c8f9/raw/group_has_transient_sheet.py -o "$HOME/Library/Application Support/Sublime Text 3/Packages/User/group_has_transient_sheet.py"

Usage

Add key binding to your .sublime-keymap

function abortableAsync(generator) {
return ({
[generator.name](...args) {
let halt = false;
try {
return () => { halt = true; };
} finally {
(async() => {
let g = generator.call(this, ...args);
let value, done, err;
công thức: chia ngày thành 3 khung thời gian: 7am -> 17pm, 17pm -> 24pm, 0am -> 7am
tính tổng {số giờ} * {hệ số} của mỗi khung thời gian
7am -> 17pm
{số giờ} = nếu bắt đầu trước 17pm : 17 - giờ bắt đầu (input)
ngược lại không tính (zero)
= if(AH40<17,17-AH40,0)
@dangh
dangh / machine.js
Last active July 30, 2019 07:11
Generated by XState Viz: https://xstate.js.org/viz
let booking = new Machine({
context: {
paymentState: 'new'
},
initial: 'new',
states: {
new: {
on: {
PAYMENT_NEW: 'paying',
PAYMENT_CHARING: 'paying',

Keybase proof

I hereby claim:

  • I am dangh on github.
  • I am dangh (https://keybase.io/dangh) on keybase.
  • I have a public key ASDA3BIwCpFrFRdxfbDy8EKXYjuFyRg80azOpRAHoxk4bAo

To claim this, I am signing this object:

@dangh
dangh / SketchSystems.spec
Last active December 26, 2018 09:02
Configure CAP
Configure CAP
Instruct user to power on device and scan QR code
cancel -> Exit
Init
valid QR code -> Instruct user to connect wifi
wrong QR code -> Inform user about wrong QR code
Inform user about wrong QR code
OK -> Instruct user to power on device and scan QR code
Instruct user to connect wifi
Trying to connect
@dangh
dangh / SketchSystems.spec
Last active December 26, 2018 18:16
Configure RE
Configure RE
Instruct user to power on device and scan QR code
cancel -> Exit
Scan QR
valid QR code -> Check CAP
wrong QR code -> Inform user about wrong QR code
Inform user about wrong QR code
OK -> Instruct user to power on device and scan QR code
Active
Check CAP