Skip to content

Instantly share code, notes, and snippets.

View mattsandersuk's full-sized avatar
🐝

Matt Sanders mattsandersuk

🐝
  • UK
View GitHub Profile
@mattsandersuk
mattsandersuk / wordpress_snippets.php
Last active January 17, 2020 17:45
Basic Wordpress snippets
<!-- CSS -->
/*
Theme Name:
Theme URI:
Author:
Author URI:
Version: 1.0
*/
<!-- Head -->
@mattsandersuk
mattsandersuk / basics-of-seo-external.md
Last active February 20, 2016 18:33
SEO Best Practice Guidelines

External SEO

External SEO is concerned primarily with how your website is being linked or referred to.

Backlink Profile

Your backlink profile plays a huge role in helping the search engine to understand the quality and trustworthiness of your site.

If a link is from a high quality website, it's likely to be seen as a vote of trust, likewise if the link or the linking website is of a low quality it can have a negative effect. So, with that in mind it's important to make sure where possible that your links are of as high quality as possible.

Links from external websites always play an important role in determining how valuable one website is in comparison to another. Where possible, it's recommended that any external links are altered to reference the new destination URLs. This will save a search engine having to go through a redirect before reaching their final destination, and can therefore mitigate negative effects of additional load speed, algorithmic damping, etc.

@mattsandersuk
mattsandersuk / auto-user-agent-email.php
Created July 7, 2014 22:06
Automatically populate email body with user agent string in mailto link.
<?php
$support_email = "help@example.com";
$browser = $_SERVER['HTTP_USER_AGENT'];
$email_subject = "Some email subject...";
$email_body = "<i>write message here</i><br><br><b>Please Keep</b> <br>" . $browser;
?>
<a href="mailto:<?php echo $support_email; ?>?subject=<?php echo $email_subject; ?>&body=<?php echo $email_body; ?>">Email Support</a></li>
<div id="address" itemscope itemtype="http://schema.org/Organization">
<ul itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<li class="boldcopyright" itemprop="name">Creare Communications</li>
<li itemprop="streetAddress">Boughton Leigh House</li>
<li itemprop="addressLocality">Rugby</li>
<li itemprop="addressRegion">Warwickshire </li>
<li itemprop="postalCode">CV21 1HL</li>
</ul>
</div>
@mattsandersuk
mattsandersuk / wordpress-db-connect.php
Last active August 29, 2015 14:10
Quick and dirty way to connect and display data from external DB in WordPress
<?php
/**
*
* Define DB
*
**/
// input credentials
$mydb = new wpdb('root','mysql','TABLENAME','localhost');
// select all columns
$rows = $mydb->get_results("SELECT *
@mattsandersuk
mattsandersuk / 503.php
Last active August 29, 2015 14:11 — forked from bavington/503.php
<?php
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Retry-After: Sat, 8 Oct 2011 18:27:00 GMT'); //How long before you estimate your website will be back.
?>
<!DOCTYPE HTML>
<html>
<head>
@mattsandersuk
mattsandersuk / js-bookmarklet-google-numberer.js
Created March 7, 2016 12:32
Google Search Result Numberer Bookmarklet
/**
*
* Google Search Result Numberererer
*
*/
// javascript:var%20elements%20=%20document.querySelectorAll(%27%23search%20div.g%27);var%20resultCount%20=%201;Array.prototype.forEach.call(elements%2C%20function(el%2C%20i){console.log(this);el.insertAdjacentHTML(%27beforebegin%27%2C%20%27%3Cspan%20style=%22color%3A%20red;%20font-size%3A%201.5em;%22%3EResult%20%23%27%20%2B%20resultCount%20%2B%20%27%3C/span%3E%27);resultCount%20%2B=%201;});
var elements = document.querySelectorAll('#search div.g');
var resultCount = 1;
Copy Soundcloud URLs - https://hydrogenaud.io/index.php/topic,91538.0.html | https://dl.dropboxusercontent.com/u/30782742/scrap/scrap.html
hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEg4ySyLhF0/GCaN82gbCeFuu0mZ/z8nN6ufq0filP1FY0Kp3BheWxvYWTFAvV7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTIwZTMyNGIyMmUxMTc0ZmM2MDlhMzdjZGEwNmMyNzg1YmFlZDI2NjdmY2ZjOWNkZWFlN2VhZDFmOGE1M2Y1MTU4ZDBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwZTMyNGIyMmUxMTc0ZmM2MDlhMzdjZGEwNmMyNzg1YmFlZDI2NjdmY2ZjOWNkZWFlN2VhZDFmOGE1M2Y1MTU4ZDBhIiwidWlkIjoiOWZhNTQxODgxYWQwNWFhNDQ0ZGMxYzlhZjlhZDNhMTkiLCJ1c2VybmFtZSI6Im1hdHRzYW5kZXJzIn0sInNlcnZpY2UiOnsibmFtZSI6ImdpdGh1YiIsInVzZXJuYW1lIjoibWF0dHNhbmRlcnN1ayJ9LCJ0eXBlIjoid2ViX3NlcnZpY2VfYmluZGluZyIsInZlcnNpb24iOjF9LCJjbGllbnQiOnsibmFtZSI6ImtleWJhc2UuaW8gZ28gY2xpZW50IiwidmVyc2lvbiI6IjEuMC4yMCJ9LCJjdGltZSI6MTQ5MDY0MTA2MCwiZXhwaXJlX2luIjo1MDQ1NzYwMDAsIm1lcmtsZV9yb290Ijp7ImN0aW1lIjoxNDkwNjQwNDk3LCJoYXNoIjoiOTI3ZWU1YmY0ZDRmMWZjN2NiYzE1MjIxZWIzZDhhY2Y2ZmVhYjIwOTU5MzVkOGM2ZTMyMjVlMmJkZjQ0NjIyYjg2YjIwNTdhZTQxNDMxYTg5ZTgxMWU1YThiZDU2NTNlNGNkMzdlNDhiNjAzZWJkNDM3ZTM5MDFlYjhiMmY3NmMiLCJzZXFubyI6OTgwODU0fSwicHJldiI6ImVlYTQwNzdmNWJjM2FjNDBmZjk4MWY1Mjkw
@mattsandersuk
mattsandersuk / sendToMailchimp.php
Created December 6, 2017 09:23
Send form data to mailchimp Raw
<?php
// ==========================================================================
// Mailchimp
// ==========================================================================
//
// Send user to mailchimp
// --------------------------------------------------------------------------
public function sendToMailchimp(Request $request)
{
// customer info