Skip to content

Instantly share code, notes, and snippets.

View mrl22's full-sized avatar
💭
Always coding

Richard Leishman mrl22

💭
Always coding
View GitHub Profile
@mrl22
mrl22 / .htaccess
Last active August 29, 2015 14:17 — forked from sanusart/.htaccess
RewriteEngine on
RewriteRule .*\.git/.* - [F]
@mrl22
mrl22 / nginx.conf
Created July 5, 2016 13:18 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@mrl22
mrl22 / font-smoothing.css
Last active December 16, 2016 12:57 — forked from bearroast/gist:3880174
Font smoothing
body {
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-webkit-text-size-adjust: 100%;
}
@mrl22
mrl22 / functions.php
Created April 6, 2017 11:15 — forked from brendonexus/Wordpress current template hook
Wordpress current template hook
add_action('get_footer', 'show_template');
function show_template()
{
global $template;
if ($_SERVER['REMOTE_ADDR'] == 'ip_address') echo basename($template);
}
function your_custom_pagination() {
global $wp_query;
$total = $wp_query->max_num_pages;
if ( $total > 1 ) {
if ( !$current_page = get_query_var('paged') ) {
$current_page = 1;
}
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => '?paged=%#%',
@mrl22
mrl22 / user-create.php
Created October 30, 2017 12:51 — forked from brendonexus/user-create.php
Create WP User from file
<?php
//Put this file in the root and run from browser or command line to generate the user
require 'wp-load.php';
global $wpdb;
$prefix = $wpdb->prefix;
//Fill in all variables below
$name = '';
@mrl22
mrl22 / tanzhen.php
Created April 12, 2018 12:42 — forked from ivmm/tanzhen.php
<?php
/* ---------------------------------------------------- */
/* 程序名称: PHP探针-Yahei
/* 程序功能: 探测系统的Web服务器运行环境
/* 程序开发: Yahei.Net
/* 联系方式: info@Yahei.net
/* Date: 1970-01-01 / 2012-07-08
/* ---------------------------------------------------- */
/* 使用条款:
/* 1.该软件免费使用.
@mrl22
mrl22 / style.scss
Created October 30, 2018 14:48 — forked from brendonexus/style.scss
Margin/Padding mixins with media queries
//This is for bootstrap 4 - given the media queries. Can easily be changed for Bootstrap 3
$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";
@mrl22
mrl22 / function.php
Created November 20, 2018 12:19 — forked from brendonexus/function.php
Get WordPress Primary Category
// get primary category - must have Yoast SEO installed
function get_primary_category($post_id){
$term_list = wp_get_post_terms($post_id, 'category', ['fields' => 'all']);
foreach($term_list as $term) {
if( get_post_meta($post_id, '_yoast_wpseo_primary_category',true) == $term->term_id ) {
return $term;
}
}
}
@mrl22
mrl22 / style.scss
Last active February 21, 2019 12:42 — forked from brendonexus/style.scss
Bootstrap 3 SCSS Media Queries
$lg: "min-width: 1200px";
$md: "max-width: 1199px";
$sm: "max-width: 991px";
$xs: "max-width: 767px";
$lg-up: "min-width: 1199px";
$md-up: "min-width: 991px";
$sm-up: "min-width: 767px";
$xs-up: "min-width: 0px";