Skip to content

Instantly share code, notes, and snippets.

msgid "File extensions"
msgstr "副檔名"
msgid "Taxonomy settings"
msgstr "分類設定"
msgid "Cacheable"
msgstr "可快取"
msgid "Processor"
@yelban
yelban / leadingZero.js
Last active April 17, 2019 01:10
Simple leading zeros in JavaScript
function leadingZero(n, nod) {
if ((nod < 1) || (n.toString().length >= nod)) {
return n.toString();
} else {
return ('0'.toString().repeat(nod)+n).slice(-nod);
}
}
@yelban
yelban / osx.sh
Last active May 23, 2019 04:48
OSX CLI
# Recursively Remove ._ ( dot-underscore ) files
### osx
dot_clean -v .
### osx/linux
find . -name '._*' -type f -print -delete
# Recursively Remove .DS_Store
find . -name '.DS_Store' -type f -print -delete
@yelban
yelban / gist:22b9579364614e13331866020ed3b073
Created July 3, 2019 11:45 — forked from adeluccar/gist:d105299f2d5af55e3e96f9b989e7eb48
How to Flatten the History of a Git Repository Safely
git checkout --orphan future-master
git add -A  # Add all files and commit them
git commit
git branch -D master  # Deletes the master branch
git branch -m master  # Rename the current branch to master
git push -f origin master  # Force push master branch to github
git gc --aggressive --prune=all     # remove the old files
@yelban
yelban / git-tag-delete-local-and-remote.sh
Created July 4, 2019 09:03 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
# Block Adobe Activation
127.0.0.1 hl2rcv.adobe.com
127.0.0.1 t3dns.adobe.com
127.0.0.1 3dns-1.adobe.com
127.0.0.1 3dns-2.adobe.com
127.0.0.1 3dns-3.adobe.com
127.0.0.1 3dns-4.adobe.com
127.0.0.1 activate.adobe.com
127.0.0.1 activate-sea.adobe.com
127.0.0.1 activate-sjc0.adobe.com
@yelban
yelban / Simple .vimrc
Created December 26, 2019 01:26 — forked from sarah-j-smith/simple-vimrc
Simple .vimrc for Mac OSX
" Use spaces instead of tabs
set expandtab
" Be smart when using tabkey
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
update drupal core
rm -rf core vendor
rm -f *.* .[a-z]*
cp -R core vendor /path/to/your/drupal/directory
cp *.* .[a-z]* /path/to/your/drupal/directory
vi settings.php
$settings['update_free_access'] = FALSE;
@yelban
yelban / hosts
Created January 8, 2020 06:42 — forked from consti/hosts
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost