View Migration.sql
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
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |
View Center hero image
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
.hero{ | |
height:200px; | |
overflow:hidden; | |
display:flex; | |
align-items:center; | |
justify-content:center | |
} | |
.hero div{ | |
min-width:100%; display:flex; |
View Add prefix or suffix
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
#add prefix | |
rename s/'^'/'MyPrefix'/ * | |
#add suffix | |
rename s/'$'/'MySuffix'/ * | |
#numbered | |
n=1; for f in ./*.jpg; do mv "$f" $n.jpg; n=$((n+1)); done |
View Urlmask
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
<body style="padding:0; margin:0;height:100%;overflow:hidden"><iframe src="http://nodws.com" style="height: 100%;width:100% " allowtransparency="true" frameborder="0"></iframe></body> |
View Cache JSON.php
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
<?php | |
$cache = 'data.txt'; | |
if(date("Ymd", filemtime($cache)) < date("Ymd") || filesize($cache) < 1): | |
$data = get_data(); // do your thing | |
$file = fopen($cache,'w+'); | |
$text = is_array($data) ? json_encode($data) : $data; | |
fwrite($file, $text); | |
fclose($file); | |
else: | |
$file = fopen($cache,'w+'); |
View Partial page refresh
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
setInterval(function() { | |
$("#refresh").load(location.href+" #refresh>*",""); | |
}, 10000); // milliseconds to wait |
View .htaccess
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
#<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> | |
<ifModule mod_headers.c> | |
Header always set Content-Security-Policy "upgrade-insecure-requests;" | |
Header set Access-Control-Allow-Origin "*" | |
</IfModule> | |
<FilesMatch "^(wp-config|wp-settings|wp-trackback|wp-comments-post|xmlrpc)\.php$"> | |
Order allow,deny | |
Deny from all |
View WPConfig
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
define('td', get_bloginfo('template_directory').'/' ); | |
define('hd', esc_url(home_url( '/' ))); | |
//WPconfig | |
$path = ''; //No trail | |
$http = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; | |
define( 'WP_SITEURL', $http . $_SERVER['SERVER_NAME'] . $path ); | |
define( 'WP_HOME', $http . $_SERVER['HTTP_HOST'] . $path ); | |
define('DB_NAME', $_SERVER['RDS_DB_NAME']); |
View Clean.php
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
<?php | |
setlocale(LC_ALL, "en_US.utf8"); | |
function clean($txt){ | |
$txt= iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $txt); | |
$re = "/[^\\w.-]/"; | |
return preg_replace($re, "", $txt); | |
} |