Skip to content

Instantly share code, notes, and snippets.

View teefan's full-sized avatar
🏠
Working from home

Long Tran teefan

🏠
Working from home
View GitHub Profile
for f in `find . -regex '.*\.html\.erb'`; do echo "Converting $f" && html2haml $f > "${f%.erb}.haml" && rm $f; done
@teefan
teefan / url_slug.js
Created June 29, 2016 07:11 — forked from sgmurphy/url_slug.js
URL Slugs in Javascript (with UTF-8 and Transliteration Support)
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>

Keybase proof

I hereby claim:

  • I am teefan on github.
  • I am teefan (https://keybase.io/teefan) on keybase.
  • I have a public key whose fingerprint is 0CCB 86EA 8CA5 C8E2 CFE2 6664 4A99 FD80 6603 7FC7

To claim this, I am signing this object:

@teefan
teefan / vni2unicode.js
Created March 3, 2017 05:09
VNI to Unicode converter
function vni2unicode(text) {
let result = text;
let uniChars1 = ['Ấ', 'ấ',
'Ầ', 'ầ', 'Ẩ', 'ẩ', 'Ẫ', 'ẫ', 'Ậ', 'ậ', 'Ắ', 'ắ',
'Ằ', 'ằ', 'Ẳ', 'ẳ', 'Ẵ', 'ẵ', 'Ặ', 'ặ', 'Ế', 'ế', 'Ề', 'ề', 'Ể', 'ể',
'Ễ', 'ễ', 'Ệ', 'ệ', 'Ố', 'ố', 'Ồ', 'ồ', 'Ổ', 'ổ', 'Ỗ', 'ỗ',
'Ộ', 'ộ', 'Ớ', 'ớ', 'Ờ', 'ờ', 'Ở', 'ở', 'Ỡ', 'ỡ',
'Ợ', 'ợ', 'Ố', 'ố', 'Ồ', 'ồ', 'Ổ', 'ổ', 'Ỗ', 'ỗ',
'Ộ', 'ộ', 'Ớ', 'ớ', 'Ờ', 'ờ', 'Ở', 'ở', 'Ỡ', 'ỡ',
@teefan
teefan / image_type.sh
Last active June 19, 2018 05:26
Check file types of all files recursively osx terminal command line
find ./images -name "*.png" | xargs -Irepl file -I repl
@teefan
teefan / perl: warning: Setting locale failed.txt
Created September 28, 2018 10:37
perl: warning: Setting locale failed
export LANGUAGE="en_US.UTF-8"
echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale
alias gs='git status'
alias gm='git merge'
alias grb='git rebase'
alias gb='git branch'
alias gba='git branch -a'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gp='git pull'
alias gf='git fetch -p'
alias gc='git commit'
git config --global alias.co checkout
git config --global alias.cob 'checkout -b'
git config --global alias.f fetch
git config --global alias.fp 'fetch -p'
git config --global alias.a add
git config --global alias.c commit
git config --global alias.cm 'commit -m'
git config --global alias.ca 'commit --amend'
git config --global alias.pu pull
git config --global alias.p push
@teefan
teefan / Keychron Linux Function Key
Created May 8, 2022 10:14
Make Keychron Linux Function keys work
echo 0 | sudo tee /sys/module/hid_apple/parameters/fnmode
@teefan
teefan / gist:927b13d51801b2544e8f6ac1c6cf087b
Created July 19, 2022 14:33
Install Ruby on MacOSX SSL workaround flag
OPENSSL_CFLAGS=-Wno-error=implicit-function-declaration