This file contains hidden or 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
## 掛載 rewrite module | |
sudo a2enmod rewrite | |
sudo service apache2 restart | |
修改 /etc/apache2/sites-available/default | |
<Directory /var/www/> | |
Options Indexes FollowSymLinks MultiViews | |
# changed from None to FileInfo | |
AllowOverride FileInfo | |
Order allow,deny |
This file contains hidden or 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
mongo 進入 Command Line | |
use <dbname> 使用特定db | |
show collections 顯示所有collections | |
db.<collection>.find() 顯示 collections 下所有的 document | |
db.<collection>.drop() 刪除 collections |
This file contains hidden or 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
# Enable GZIP | |
<ifmodule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
</ifmodule> | |
# Expires Headers - 2678400s = 31 days | |
<ifmodule mod_expires.c> |
This file contains hidden or 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
if( /Android|webOS|iPhone|iPod|iPad|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { | |
// some code.. | |
window.location.href = "to mobile site url"; | |
} |
This file contains hidden or 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
var basketModule = (function() { | |
var basket = []; | |
return { | |
addItem: function(values) { | |
basket.push(values); | |
}, | |
getItemCount: function() { | |
return basket.length; | |
}, |
This file contains hidden or 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
db.Zhengzhou.aggregate([ | |
{ $match: { ModifiedTime: { $gt: ISODate("2015-07-01T00:00:00.000Z"), $lt: ISODate("2015-07-02T00:00:00.000Z")}, DeviceResponseTime: { $ne : 0 } } }, | |
{ | |
$project: { | |
date : { $dateToString : { format: "%Y-%m-%d", date: "$ModifiedTime" }}, | |
DeviceResponseTime: 1 | |
} | |
}, | |
{ | |
$group: { |
This file contains hidden or 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
# 停止所有 container 並且 remove | |
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) | |
# 用 image 執行 container | |
sudo docker run -idt <image> | |
-d flag which tells Docker to run the container in the background. | |
# 執行 container 並且印出 env | |
docker run --rm --name <name> <image> env |
This file contains hidden or 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
Ctrl+Alt+V (Refactor | Extract Variable) | |
Ctrl+D in the editor duplicates the selected block or the current line when no block is selected. | |
If the cursor is between the parentheses of a method call, pressing Ctrl+P brings up a list of valid parameters. | |
Ctrl+Shift+Backspace (Navigate | Last Edit Location) | |
Use Ctrl+Shift+F7 (Edit | Find | Highlight Usages in File) to quickly highlight usages of some variable in the current file. | |
Use F3 and Shift+F3 keys to navigate through highlighted usages. |
This file contains hidden or 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
http://stackoverflow.com/questions/23464157/cant-start-or-stop-php-fpm-on-ubuntu | |
/usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/php-fpm.conf |
This file contains hidden or 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
# 匯入 | |
mysql -u <user> -p <password> <database> < <sql_filename> | |
# 匯出 | |
mysqldump -u <user> -p <password> <database> > <sql_filename> | |
# 新增使用者 | |
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass'; | |
# 加上權限 |