Skip to content

Instantly share code, notes, and snippets.

Huy 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 / .gitconfig
Created Aug 4, 2016
Use neovim as diff tool
View .gitconfig
tool = vimdiff
prompt = true
[mergetool "vimdiff"]
cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
prompt = false
tool = vimdiff
View base16-ocean-mono.vim
" base16-vim (
" by Chris Kempson (
" Ocean scheme by Chris Kempson (
" This enables the coresponding base16-shell script to run so that
" :colorscheme works in terminals supported by base16-shell scripts
" User must set this variable in .vimrc
" let g:base16_shell_path=base16-builder/output/shell/
if !has('gui_running')
if exists("g:base16_shell_path")

;; Automatically generated
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(anzu-cons-mode-line-p nil)
huytd /
Last active Nov 16, 2019
Simple game engine using Canvas for Android - using for quick prototype or simple games
package com.gamarist.momoney;
import android.os.Bundle;
import android.R.integer;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
View org-journal-list.el
(defun read-journal (path)
(insert-file-contents (concat "~/notes/journal/" path))
(split-string (buffer-string) "\n" t)))
(defun read-first-three-lines (list)
(cond ((>= (length list) 4) (subseq list 1 3))
((>= (length list) 1) (nthcdr 1 list))
(t list)))
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}'

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 / 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 / d3-text-measure.js
Created May 6, 2016
Measure text size in pixels with D3.js
View d3-text-measure.js
function textSize(text) {
if (!d3) return;
var container ='body').append('svg');
container.append('text').attr({ x: -99999, y: -99999 }).text(text);
var size = container.node().getBBox();
return { width: size.width, height: size.height };
// Usage: textSize("This is a very long text");
huytd / vscode-espresso-custom.json
Created Jul 14, 2019
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",
You can’t perform that action at this time.