Skip to content

Instantly share code, notes, and snippets.

View qhwa's full-sized avatar

Qiu Hua qhwa

View GitHub Profile
@aanari
aanari / set-alacritty-default.sh
Last active October 16, 2024 18:35
Set Alacritty as Default Terminal Editor (Ubuntu)
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator $(which alacritty) 50
sudo update-alternatives --config x-terminal-emulator

Phoenix 1.4.x to 1.5.0 upgrade instructions

Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v on the command line.

Install the new phx.new project generator

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0
@slashdotdash
slashdotdash / README.md
Last active September 2, 2022 12:51
Commanded middleware to enrich commands during dispatch, such as calling an external API.

Commanded middleware for command enrichment

Usage

Add the EnrichCommand middleware to your command router:

defmodule MyApp.Router do
  use Commanded.Commands.Router
 
@rlipscombe
rlipscombe / exwx.exs
Created November 26, 2017 16:08
Using wxWidgets from Elixir
#!/usr/bin/env elixir
defmodule Canvas do
@behaviour :wx_object
@title "Canvas Example"
@size {600, 600}
def start_link() do
:wx_object.start_link(__MODULE__, [], [])
@bluethon
bluethon / git_proxy_socks5.sh
Created January 18, 2017 08:25
设置git使用socks5代理
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
@nflint
nflint / git-export-untracked-files.sh
Created May 13, 2016 20:00
Git command to export untracked files.
git ls-files --others --exclude-standard -z | cpio -pmd0 path/to/directory
git clean -d -f
# git ls-files: print a
# * null-delimited (-z) list of
# * untracked (--others)
# * non-ignored (--exclude-standard) files.
# cpio:
# * copy (-p)
# * files in a null-delimited list (-0)
@paulirish
paulirish / what-forces-layout.md
Last active November 15, 2024 16:45
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@luikore
luikore / chinese_num.rb
Last active September 29, 2022 07:50
To Chinese Number
# http://zh.wikipedia.org/wiki/中文数字
# http://china.younosuke.com/03_013.html
module ChineseNum
extend self
UPPER_ZERO = '零'
LOWER_ZERO = '〇'
UPPER_DIGITS = %w[壹 贰 叁 肆 伍 陆 柒 捌 玖].unshift nil
LOWER_DIGITS = %w[一 二 三 四 五 六 七 八 九].unshift nil
@shingchi
shingchi / Unicode中文和特殊字符的编码范围
Created January 6, 2015 06:39
Unicode中文和特殊字符的编码范围
根据Unicode5.0整理如下:
1)标准CJK文字
http://www.unicode.org/Public/UNIDATA/Unihan.html
2)全角ASCII、全角中英文标点、半宽片假名、半宽平假名、半宽韩文字母:FF00-FFEF
http://www.unicode.org/charts/PDF/UFF00.pdf
3)CJK部首补充:2E80-2EFF
http://www.unicode.org/charts/PDF/U2E80.pdf
@asaaki
asaaki / iex.sh
Created October 20, 2014 12:04
iex erlang vm args
# http://erlang.org/doc/man/erl.html
# --erl erlang VM attributes/flags
# +A 32 async-threads
# +K true kernel-poll if supported
# +P 524288 max number of simultaneous processes
iex --erl '+A 32 +K true +P 524288'