Skip to content

Instantly share code, notes, and snippets.

View ryanfitton's full-sized avatar

Ryan Fitton ryanfitton

View GitHub Profile
@ryanfitton
ryanfitton / index.html
Created July 29, 2015 19:09
PHP Function: Get a file's last modification timestamp - FInal HTML - https://ryanfitton.co.uk/blog/php-function-get-a-files-last-modified-timestamp/
<link rel="stylesheet" href="css/styles.cssstyles.css?v=1438124400">
@ryanfitton
ryanfitton / function.php
Last active August 29, 2015 14:26
PHP Function: Get a file's last modification timestamp - PHP Function - https://ryanfitton.co.uk/blog/php-function-get-a-files-last-modified-timestamp/
<?php
//Get the file's last modified timestamp
function lastModTimestamp($filename, $filepath = NULL, $displayV = false) {
//Combine filepath and filename
$file = $filepath . $filename;
//If this file exists
if (file_exists($file)) {
//Get the filename's last modified date
$lastModDate = date("Y-m-d", filemtime($file));
@ryanfitton
ryanfitton / index.html
Last active August 29, 2015 14:26
PHP Function: Get a file's last modification timestamp - HTML - https://ryanfitton.co.uk/blog/php-function-get-a-files-last-modified-timestamp/
<link rel="stylesheet" href="css/styles.css<?php echo lastModTimestamp("styles.css", "css/", true)); ?>">
@ryanfitton
ryanfitton / .htacess
Last active August 29, 2015 14:25
This snippet is great to use if you have recently switched your Wordpress website over to HTTPS only. Paste this snippet into your .htaccess and overwrite the standard Wordpress code at the top of the file. https://ryanfitton.co.uk/blog/force-all-incoming-wordpress-http-links-to-https/
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
@ryanfitton
ryanfitton / function.php
Created July 22, 2015 11:31
Convert Reserved XML charecters to Entities
<?php
/*
Convert Reserved XML charecters to Entities
http://stackoverflow.com/questions/1132633/converting-to-amp-for-xml-in-php
*/
function xml_convert($str, $protect_all = FALSE) {
$temp = '__TEMP_AMPERSANDS__';
// Replace entities to temporary markers so that
@ryanfitton
ryanfitton / keybase.md
Created April 4, 2015 20:11
keybase.md

Keybase proof

I hereby claim:

  • I am ryanfitton on github.
  • I am ryanfitton (https://keybase.io/ryanfitton) on keybase.
  • I have a public key whose fingerprint is 25A2 D449 12AB E7E2 F37E A263 1FA8 09C4 CF42 7FE6

To claim this, I am signing this object:

@ryanfitton
ryanfitton / command
Created September 26, 2014 10:14
Ubuntu Bash 'Shell Shock' vulnerability patch for Debian/Ubuntu systems
#Test:
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
#Run:
apt-get update && apt-get install -y bash
@ryanfitton
ryanfitton / functions.php
Created September 15, 2014 07:45
functions.php - Custom login
<?php
/**
* Created September 2014
* @author Ryan Fitton
* @copyright Copyright (c) 2014, Ryan Fitton
*/
//Customer WordPress login styling
function custom_login_css() {
@ryanfitton
ryanfitton / custom-login.css
Last active August 29, 2015 14:06
custom-login.css
/*!
* Description: WordPress Custom Login
* Author: Ryan Fitton
* Author URI: http://ryanfitton.co.uk
* Version: 2014
*/
body.login {
background: #ad473b!important;
color: #484848!important;
}
@ryanfitton
ryanfitton / navigationMarkup.html
Created August 24, 2014 22:11
ryanfitton.co.uk Navigation Menu Markup
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-links">
<span class="sr-only">Toggle navigation</span>
<i class="fa fa-bars"></i>
</button>
<a class="navbar-brand" href="http://ryanfitton.co.uk"><img src="logo.png" alt="Ryan Fitton logo" /></a>
</div>