Skip to content

Instantly share code, notes, and snippets.

Bold Move makeitaboldmove

View GitHub Profile
@makeitaboldmove
makeitaboldmove / functions--example-wp_ajax_-wp_ajax_nopriv_-actions.php
Last active Sep 11, 2018
How To Create Custom WordPress Ajax Endpoint That Works For Both Admins and Visitors
View functions--example-wp_ajax_-wp_ajax_nopriv_-actions.php
<?php
// Add wp_ajax_ and wp_ajax_nopriv_ actions
add_action('wp_ajax_locations', 'wp_ajax_get_locations');
add_action('wp_ajax_nopriv_locations', 'wp_ajax_get_locations');
// Get locations function
function wp_ajax_get_locations(){
// Latitude and longitude (defaults to Dayton, Ohio)
$lat = isset($_POST['lat']) ? $_POST['lat'] : 39.758949;
@makeitaboldmove
makeitaboldmove / functions--wordpress-minify-class.php
Last active Sep 16, 2018
How to minify HTML using WordPress functions.php
View functions--wordpress-minify-class.php
<?php
/*********
*********
Minify
*********
*********/
class WP_Minify{
protected $compress_css = true;
protected $compress_js = false;
@makeitaboldmove
makeitaboldmove / nginx.conf (gzip_types)
Last active Sep 10, 2018
Speed up your website on an nginx server by adding modern gzip_types to nginx.conf in the http block
View nginx.conf (gzip_types)
##
# Gzip Settings
##
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_http_version 1.1;
gzip_disable "msie6";
gzip_static always;
@makeitaboldmove
makeitaboldmove / isMENA-function-example.php
Last active Sep 11, 2018
How To Detect Middle Eastern Users Using PHP
View isMENA-function-example.php
<?php
if(isMENA()){
echo '<img src="/images/mena-image.png" alt="MENA Image" />';
} else {
echo '<img src="/images/other-image.png" alt="Other Image" />';
}
@makeitaboldmove
makeitaboldmove / .htaccess (Speed Up WordPress)
Last active Nov 4, 2018
How to speed up your WordPress website hosted on Apache2 using htaccess
View .htaccess (Speed Up WordPress)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
<IfModule mod_deflate.c>
@makeitaboldmove
makeitaboldmove / Fresh Ubuntu, NodeJS, LetsEncrypt, Etc. Installation
Last active Sep 7, 2018
Fresh Ubuntu, NodeJS, LetsEncrypt, Etc. Installation
View Fresh Ubuntu, NodeJS, LetsEncrypt, Etc. Installation
# Update Ubuntu and Packages
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get upgrade -y
# Install NGINX
sudo apt-get install nginx -y
You can’t perform that action at this time.