cd $(git rev-parse --show-toplevel)/.git/hooks/
wget https://gist.githubusercontent.com/gwokae/1e0f9ba24bda731971ea/raw/1a20f57102cc92d12be953c0c6cd156609b11d65/pre-commit
chmod a+x pre-commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 監理服務網 網路選號小助手 | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author @gwokae | |
// @match https://www.mvdis.gov.tw/m3-emv-plate/webpickno/queryPickNo* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=gov.tw | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name reactjs.org switch languages | |
// @version 0.1 | |
// @description keep the browseing path when switch language on reactjs.org | |
// @author Leonard Lin <https://github.com/gwokae>+ | |
// @updateURL https://gist.github.com/gwokae/77a896865deea912591092167ae3cb00/raw/reactjs.org.switch.lang.user.js | |
// @match https://*.reactjs.org/* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.sample = function(count = 1){ | |
let {length} = this; | |
if( count > length ){ | |
count = length; | |
} | |
return this.map( (item, idx) => { | |
return {item, rnd: Math.random()}; | |
}) | |
.sort( (a, b) => a.rnd - b.rnd ) | |
.slice( length - count ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
CURL upload command: | |
`curl -X POST -F file=@<path-to-file> http://<host-ip>:8000` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
// Settings | |
"passfail" : false, // Stop on first error. | |
"maxerr" : 100, // Maximum errors before stopping. | |
// Predefined globals whom JSHint will ignore. | |
"browser" : true, // Standard browser globals e.g. `window`, `document`. | |
"node" : true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://gorails.com/setup/ubuntu/14.04 | |
sudo apt-get update | |
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties | |
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev | |
curl -L https://get.rvm.io | bash -s stable | |
source ~/.rvm/scripts/rvm | |
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc | |
rvm install 2.1.2 | |
rvm use 2.1.2 --default |
Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024
sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node
Important: your node location may vary. Use which node
to find it, or use it directly in the command:
to boostrap my dev environment :D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// type 1 | |
function(foo){ | |
var bar = foo || global.defaultObject; | |
if(bar) bar.exec(); | |
} | |
// type 2 | |
function(foo){ | |
(foo || global.defaultObject) && (foo || global.defaultObject).exec(); | |
} |
NewerOlder