Skip to content

Instantly share code, notes, and snippets.

Huy Tr. huytd

Block or report user

Report or block huytd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@huytd
huytd / 2019.tmux.conf
Created Sep 27, 2019
My 2019 Tmux Config
View 2019.tmux.conf
# set -g default-terminal "xterm"
# set-option -ga terminal-overrides ",xterm:Tc"
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",*256col*:Tc"
set -g prefix C-x
unbind-key C-x
bind-key C-2 send-prefix
bind \ split-window -h -c '#{pane_current_path}'
View jquery-multiple-css-changes.md

Setting multiple CSS properties at once with jQuery doesn't batch

There's a trick that was suggested in a few articles on the internet, that whenever you should modify a lot of CSS properties, you should batch them in one call:

  // instead of this
  $('body').css('backgound-color', '#F00');
  $('body').css('width', 100);
  $('body').css('height', 300);
@huytd
huytd / k2pdfopt-params
Created Aug 20, 2019
k2pdfopt param for iPhone X
View k2pdfopt-params
k2pdfopt -om 0.15 -w 800 -h 1732 <file-name>
@huytd
huytd / vscode-espresso-custom.json
Created Jul 14, 2019
vscode-espresso-custom.json
View vscode-espresso-custom.json
"workbench.colorCustomizations": {
"sideBar.background": "#fafafa",
"activityBar.background": "#fafafa",
"statusBar.background": "#fafafa",
"tab.inactiveBackground": "#fafafa",
"tab.border": "#fafafa",
"editorGroupHeader.tabsBackground": "#fafafa",
"editorLineNumber.foreground": "#dddddd",
"editorCursor.foreground": "#6ab04c",
"diffEditor.removedTextBackground": "#F8E5E1",
@huytd
huytd / slack-arc-dark.css
Created Apr 17, 2019
Arc dark theme for Slack, with Threads screen fix
View slack-arc-dark.css
body { background: #404552; color: #d3dae3; }
a { color: #90939b; }
a:link, a:visited { color: #90939b; }
a:hover, a:active, a:focus { color: #90939b; }
hr { border-bottom: 1px solid #454c5c; border-top: 1px solid #404552; }
h1, h2, h3, h4 { color: #d3dae3; }
h1 a { color: #d3dae3; }
h1 a:active, h1 a:hover, h1 a:link, h1 a:visited { color: #d3dae3; }
.bordered { border: 1px solid #2a2f39; }
.top_border { border-top: 1px solid #2a2f39; }
View slack-style-join-left-message.js
const Join = 1;
const Leave = -1;
const JoinedAndLeft = 2;
const Rejoined = -2;
const toStatus = n => {
switch (n) {
case Join: return 'joined';
case Leave: return 'left';
case JoinedAndLeft: return 'joined and left';
@huytd
huytd / emacs.init.el
Last active Apr 17, 2019
Emacs config with no Evil
View emacs.init.el
;; Package configs
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives '(("org" . "http://orgmode.org/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
;; Bootstrap `use-package`
(unless (package-installed-p 'use-package)
@huytd
huytd / ffmpeg-compress-mp4
Created Dec 18, 2018 — forked from lukehedger/ffmpeg-compress-mp4
Compress mp4 using FFMPEG
View ffmpeg-compress-mp4
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
View keyboard-prototype.c
/* Snacky2x2 Keyboard Firmware
By @huydotnet
You must select Keyboard from the "Tools > USB Type" menu
Change Log:
- v2: Fixes debounce problem by adding key state checking.
Reset the debounce timer when key state changed.
- v3: Snap the processing to every 1 millisecond.
- v4: Implement a different debouncing algorithm.
REGISTER_DELAY is a time before key can be registered
at each frame. REPEAT_DELAY is a time before a new frame
@huytd
huytd / ripgrep-in-emacs.md
Created Nov 16, 2018 — forked from pesterhazy/ripgrep-in-emacs.md
Using ripgrep in Emacs using helm-ag (Spacemacs)
View ripgrep-in-emacs.md

Why

Ripgrep is a fast search tool like grep. It's mostly a drop-in replacement for ag, also know as the Silver Searcher.

helm-ag is a fantastic package for Emacs that allows you to display search results in a buffer. You can also jump to locations of matches. Despite the name, helm-ag works with ripgrep (rg) as well as with ag.

How

You can’t perform that action at this time.