Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

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 / 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';
View attractions-in-sf.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View route-data.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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

View sample-news-data.js
const NEWS_DATA = {"links":[{"body":"","id":988,"source":"medium.com","time":1540522920,"title":"Ứng dụng CSS variables để xây dựng tính năng dark theme","url":"https://medium.com/p/2796644ea1f2"},{"body":"<p>Dark theme, dark mode hay night mode,&#8230; là một tính năng khá thú vị. Mình hay chuyển theme (trình duyệt, IDE) về chế độ này. Vì đơn giản là trông nó có vẻ chuyên nghiệp và mang màu sắc bí ẩn &#8211; kiểu hacker ấy. Mà nói vậy chứ, thực ra mình để vậy cho đỡ chói mắt thôi. Không phải làm màu đâu nhé! À, thế bạn biết cách xây dựng nhiều theme cho một trang web không? Mình thì không chắc đâu. Nhưng sau khi tìm hiểu về CSS variable xong, mình đã nảy ra một ý tưởng. [&#8230;]</p>\n<p>The post <a rel=\"nofollow\" href=\"https://completejavascript.com/tao-dark-theme-voi-css-variable/\">Tạo Dark Theme với CSS Variable</a> appeared first on <a rel=\"nofollow\" href=\"https://completejavascript.com\">Complete JavaScript</a>.</p>\n","id":987,"source":"completejavascript.com","time":1540420240,"title":"Tạo Dark
View org-journal-list.el
(defun read-journal (path)
(with-temp-buffer
(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)))
You can’t perform that action at this time.