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
function getUserIP() | |
{ | |
// Get real visitor IP behind CloudFlare network | |
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { | |
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; | |
$_SERVER['HTTP_CLIENT_IP'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; | |
} | |
$client = @$_SERVER['HTTP_CLIENT_IP']; | |
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; | |
$remote = $_SERVER['REMOTE_ADDR']; |
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
// -nm = no mangle | |
// -o = output filename | |
uglifyjs -nmo script.min.js script.js |
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
function screen_size() { | |
if (window.matchMedia('(max-width: 991px)').matches) { | |
$('body').removeClass('view-desktop'); | |
$('body').addClass('view-mobile'); | |
} else { | |
$('body').removeClass('view-mobile'); | |
$('body').addClass('view-desktop'); | |
} | |
} |
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
function clean_url($string) { | |
// Make lower case. | |
$string = strtolower( $string) ; | |
// Make alphanumeric. Remove all characters. | |
$string = preg_replace("/[^a-z0-9_\s-]/", "", $string); | |
// Clean multiple dashes and whitespace. | |
$string = preg_replace("/[\s-]+/", " ", $string); | |
//Convert whitespaces and underscore to dash. | |
$string = preg_replace("/[\s_]/", "-", $string); | |
return $string; |
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
%windir%\system32\bash.exe -cur_console:p |
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
$args = array( | |
'headers' => array( | |
'Authorization' => 'Basic ' . base64_encode( YOUR_USERNAME . ':' . YOUR_PASSWORD ) | |
) | |
); | |
wp_remote_request( $url, $args ); |
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
// download min from http://detectmobilebrowsers.com/ | |
// use like | |
if(jQuery.browser.mobile) { | |
$("body").addClass("screen-mobile"); | |
} | |
else { | |
$("body").addClass("screen-desktop"); | |
} |
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
git fetch, git checkout develop, git pull origin develop, git checkout your-feature, git merge develop |
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
#fromdos -- install tofrodos | |
find . -type f -exec fromdos {} \; | |
#dos2unix | |
find . -type f -exec dos2unix {} \; | |
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
// show php errors | |
error_reporting(E_ALL); | |
ini_set('display_errors', TRUE); | |
ini_set('display_startup_errors', TRUE); | |
// var dump | |
print '<pre>'; | |
var_dump(get_defined_vars()); | |
print '</pre>'; |
NewerOlder