Skip to content

Instantly share code, notes, and snippets.

View ilokano's full-sized avatar

Jasper Espejo ilokano

View GitHub Profile
@ilokano
ilokano / fn_admin.php
Last active December 11, 2017 14:01
My custom WordPress functions for admin
<?php
/**
* Custom admin functions for this theme
*
*
* @package Jasper_Espejo_Theme
*/
/**
<?php
/*
Plugin Name: Live Edit
Plugin URI: http://www.elliotcondon.com/
Description: Edit the title, content and any ACF fields from the front end of your website!
Version: 2.0.0
Author: Elliot Condon
Author URI: http://www.elliotcondon.com/
License: GPL
@ilokano
ilokano / ps.conf
Created July 31, 2016 09:52
Default pagespeed conf file for NGINX server, to be placed in http block. Save in /etc/nginx/conf.d/
pagespeed on;
pagespeed FileCachePath "/var/ngx_pagespeed_cache";
pagespeed FileCacheSizeKb 102400;
pagespeed FileCacheCleanIntervalMs 3600000;
pagespeed FileCacheInodeLimit 500000;
pagespeed LRUCacheKbPerProcess 8192;
pagespeed LRUCacheByteLimit 16384;
pagespeed EnableCachePurge on;
pagespeed MemcachedServers "127.0.0.1:11211";
pagespeed PreserveUrlRelativity on;
@ilokano
ilokano / gist:a184cfae20cfd9be080fffd708f011ed
Last active December 11, 2017 14:05 — forked from mwolff44/gist:abfc7848e5cfa35b8c6a
remove jetpack unwanted css - Wordpress
<?php
/*
MU Plugin: remove-jetpack-css
Plugin Name: WP Remove Jetpack CSS
Plugin URI: http://www.blog-des-telecoms.com
Description: Remove jetpack CSS
Version: 1.0
Author: Mathias WOLFF
Author URI: http://www.mathias-wolff.fr
License: GPLv3
@ilokano
ilokano / countryselect
Last active August 29, 2015 14:23
Country Select
<select id="country_international" class="country_international">
<option value="" selected="selected"></option>
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
<option value="Argentina">Argentina</option>
# Block by country
# The countries blocked below are Brazil, China, South Korea, Russia, Kazachstan, Ukraine
# Add to server{) block
if ($geoip_country_code ~ (BR|CN|KP|KR|RU|KZ|UA) ) {
return 444;
}
@ilokano
ilokano / wordpress.conf
Last active January 18, 2023 07:45
nginx settings for WordPress.
# https://codex.wordpress.org/Nginx
# Global restrictions configuration file.
# Deleted config for .htaccess, robots.txt, favicon restriction
# because they are already included in the default
# domain.conf created by ispconfig
# Block PHP files in uploads, content, and includes directory.
location ~* /(?:uploads|files|wp-content|wp-includes)/.*\.php$ {
deny all;
}
@ilokano
ilokano / agentblock.conf
Last active December 15, 2016 17:43
I place this inside /etc/nginx/conf.d
map $http_user_agent $bad_agent {
default 0;
"~*^[Ww]eb[Bb]andit" 1;
"~*^Acunetix" 1;
"~*^binlar" 1;
"~*^BlackWidow" 1;
"~^Bolt" 1;
"~*^casper" 1;
"~*^checkprivacy" 1;
"~*^ChinaClaw" 1;
@ilokano
ilokano / httpblock.conf
Last active December 15, 2016 17:55
I place this inside /etc/nginx/conf.d
#add to http {} block
map $http_referer $bad_referer {
default 0;
"~*event-tracking.com" 1;
"~*theguardlan.com" 1;
"~*free-share-buttons.com" 1;
"~*free-social-buttons.com" 1;
"~*buy-cheap-online.info" 1;
"~*free-social-buttons.com" 1;
"~*he-prod" 1;
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;