Skip to content

Instantly share code, notes, and snippets.

@hothanhan
hothanhan / site-phalaionline
Created January 4, 2016 06:46 — forked from quangbahoa/site-phalaionline
site-phalaionline
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@hothanhan
hothanhan / site-phalaionline
Created January 4, 2016 06:40
site-phalaionline
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@hothanhan
hothanhan / BROWSERCACHING.txt
Created August 26, 2015 00:57
BROWSER CACHING
## LEVERAGE BROWSER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
@hothanhan
hothanhan / host.txt
Created August 11, 2015 02:15
host, localhost
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
@hothanhan
hothanhan / orderpost
Created August 9, 2015 04:43
get post order by date wordpress
Place code into theme functions.php or package into a plugin.
/**
* Sets up order post by date.
*
* @since 1.0.0
*/
function theworld_alter_query ( $query )
{
if ( $query -> is_main_query () && ( $query -> is_home () || $query -> is_search () || $query -> is_archive () ) )
@hothanhan
hothanhan / hackcss
Created July 13, 2015 02:09
hack css chrome, safari
/* hack css chrome */
#div{color:green;}
@media screen and (-webkit-min-device-pixel-ratio:0) {
#div{color:red;}
}
@hothanhan
hothanhan / transition
Created July 8, 2015 02:07
CSS transitions & media queries
body {
transition:all .2s linear;
-o-transition:all .2s linear;
-moz-transition:all .2s linear;
-webkit-transition:all .2s linear;
}
@hothanhan
hothanhan / dis-theme-edit
Last active August 29, 2015 14:22
Disable the Plugin and Theme Editor
Open your wp-config.php file and add the following constant:
/** Disable the Plugin and Theme Editor */
define( 'DISALLOW_FILE_EDIT', true );
@hothanhan
hothanhan / without fpt
Created April 23, 2015 02:10
Update WordPress Automatically Without Using FTP
/** sets up wordpress vars and included file. */
require_once(ABSPATH.'wp-settings.php');
/** Sets up 'direct' method for wordpress, auto update without FTP */
define('FS_METHOD','direct');
<?php $trimmed = wp_trim_words( $text, $num_words = 55, $more = null ); ?>
/*** Mô tả *************
$text
(string) (required) Text to trim
Default: None
$num_words
(integer) (optional) Number of words
Default: 55