Skip to content

Instantly share code, notes, and snippets.

View hthuong09's full-sized avatar

Thuong (Tyson) Nguyen hthuong09

View GitHub Profile
@hthuong09
hthuong09 / backup.sh
Created March 25, 2024 17:43
Quick backup restore mac
rsync -vaE --progress --delete-after --human-readable --relative \
--exclude node_modules \
--exclude .DS_Store \
# folder to backup
~/SoureCode \
~/.gnupg \
# data foldler
~/Library/Application\ Support/another-redis-desktop-manager \
~/Library/Application\ Support/com.tinyapp.TablePlus \
~/Library/Application\ Support/Postman \
@hthuong09
hthuong09 / introrx.md
Created January 22, 2023 05:00 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@hthuong09
hthuong09 / b64url-np.md
Created November 14, 2019 17:58 — forked from catwell/b64url-np.md
Decoding Base64-URL without padding

Decoding Base64-URL without padding

1) Add padding

Divide the length of the input string by 4, take the remainder. If it is 2, add two = characters at the end. If it is 3, add one = character at the end.

You now have Base64-URL with padding.

2) Translate to Base64

Keybase proof

I hereby claim:

  • I am hthuong09 on github.
  • I am hthuong09 (https://keybase.io/hthuong09) on keybase.
  • I have a public key whose fingerprint is 96DE 7A18 A99E D6AF 4B92 9263 E01D B409 6428 51D1

To claim this, I am signing this object:

@hthuong09
hthuong09 / flex.scss
Created October 14, 2017 01:37
Flex Learning
display: flex; // Inside will be flex item
// With flex block with can
// Horizontal align content
// Use on flex object (display: flex), affect to child flex-item
justify-content: flex-start; // (flex-start, flex-end, space-around, space-between, center)
// Vertical align content
// Use on flex object (display: flex), affect to child flex-item
align-content: stretch; // (stretch, flex-start, flex-end, space-around, space-between, center)
@hthuong09
hthuong09 / .c
Last active July 15, 2017 06:24
// Đây chỉ là gợi ý thôi nhé
// Đâu tiên thì bạn cần phải có 1 hàm flag, để kiếm tra ra lệnh ngừng
int stopFlag = 0;
// Sau đó bạn cần có hàm custom delay, hàm này sẽ làm việc là chia nhỏ delay ra, và kiểm tra trong lúc đó nếu lúc đó stopFlag không phải là 0 thì ngừng việc delay
// Hàm custom delay này bạn dùng trong những function đổi màu của bạn
void customDelay(int milisecond) {
int stopPeriod = 100; // thời gian kiểm tra giữa các lần
for(int i = 0; i < milisecond; i + stopPeriod) {
[alias]
# Add and remove all changes, note how this alias is calling another alias
addremove = !git r && git add . --all
# Show all of my configured aliases
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t => \\2/' | sort
# For when you made that commit a bit too early, amend
amend = !git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend
@hthuong09
hthuong09 / CapsToCtrlAndEscape.ahk
Created November 1, 2016 02:22
Remap caps lock to esc when click and ctrl when combine with other key
; Author: fwompner gmail com
#InstallKeybdHook
SetCapsLockState, alwaysoff
Capslock::
Send {LControl Down}
KeyWait, CapsLock
Send {LControl Up}
if ( A_PriorKey = "CapsLock" )
{
Send {Esc}
@hthuong09
hthuong09 / using_bind_method.js
Created September 28, 2016 06:11
Pass argument to setTimeout inside loop
/*
Syntax
fun.bind(thisArg[, arg1[, arg2[, ...]]])
Parameters
thisArg
The value to be passed as the this parameter to the target function when the bound function is called. The value is ignored if the bound function is constructed using the new operator.
Passed undefined = use original this
arg1, arg2, ...
Arguments to prepend to arguments provided to the bound function when invoking the target function.
Return value
@hthuong09
hthuong09 / gist:f9f124aef3cffa1b9aa723abfa1be4a6
Created September 26, 2016 01:57 — forked from maskit/gist:2252422
WebSocket traffic sniffer
(function () {
WebSocket.prototype._send = WebSocket.prototype.send;
WebSocket.prototype.send = function (data) {
this._send(data);
this.addEventListener('message', function (msg) {
console.log('>> ' + msg.data);
}, false);
this.send = function (data) {
this._send(data);
console.log("<< " + data);