Skip to content

Instantly share code, notes, and snippets.

@brendonexus
brendonexus / .htaccess
Created December 13, 2018 20:35 — forked from mrl22/.htaccess
Maintenance Page
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^0\.0\.0\.0
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance.html [R=302,L]
</IfModule>
@brendonexus
brendonexus / change-wp-url.sql
Created October 9, 2018 08:30 — forked from thiagoeliasr/change-wp-url.sql
Change Wordpress URL via SQL
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');
@brendonexus
brendonexus / gist:ab0843c232748d37bae5f9f320e867ce
Created February 21, 2018 16:34 — forked from timonweb/gist:3165322
Code to catch all PHP errors which result in 500 Error Code. Include this snippet at the beginning of index.php file
<?php
define('E_FATAL', E_ERROR | E_USER_ERROR | E_PARSE | E_CORE_ERROR |
E_COMPILE_ERROR | E_RECOVERABLE_ERROR);
define('ENV', 'dev');
//Custom error handling vars
define('DISPLAY_ERRORS', TRUE);
define('ERROR_REPORTING', E_ALL | E_STRICT);
@brendonexus
brendonexus / .htaccess
Created January 17, 2018 15:20 — forked from mrl22/.htaccess
No more .php extensions
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# Return 404 if original request is .php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
@brendonexus
brendonexus / ftp-mirror.sh
Created November 20, 2017 11:24 — forked from mrl22/ftp-mirror.sh
Download entire website from FTP
USER=""
PASS=""
HOST=""
wget -m -nH ftp://$USER:$PASS@$HOST/public_html/ -P public_html --cut-dirs=1
@brendonexus
brendonexus / pagination.php
Created June 30, 2017 07:49 — forked from mrl22/pagination.php
Pagination that can be used on any website in bootstrap format
/**
* @param int $total Total number of records
* @param int $per_page How many records to display per page
* @param int $current_page Current page number
* @param string $link sprintf formatted string for page links $1 = page number
* @return string in html ul-li format
*/
function pagination($total, $per_page, $current_page, $link)
{
$boundry = 3; // How many pages to show around the current page
@brendonexus
brendonexus / bootstrap4.scss
Created December 16, 2016 12:53 — forked from mrl22/bootstrap4.scss
Bootstrap v4 SCSS Media Queries
$xl-down: "max-width: 9999px";
$lg-down: "max-width: 1199px";
$md-down: "max-width: 991px";
$sm-down: "max-width: 767px";
$xs-down: "max-width: 575px";
$xl-up: "min-width: 1200px";
$lg-up: "min-width: 992px";
$md-up: "min-width: 768px";
$sm-up: "min-width: 576px";
<?php
require '_config.php';
$twitteruser = 'webfwd';
$tweetexpire = 60 * 30; // Seconds
$tweetfile = DOCROOT.'/twitter.txt';
use Abraham\TwitterOAuth\TwitterOAuth;
if (!file_exists($tweetfile) || (time()-filemtime($tweetfile)) > $tweetexpire) {
$connection = new TwitterOAuth(
@brendonexus
brendonexus / style.scss
Last active October 15, 2019 11:27 — forked from mrl22/font-smoothing.css
Font smoothing
body {
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-webkit-text-size-adjust: 100%;
}