Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Fitton ryanfitton

View GitHub Profile
@ryanfitton
ryanfitton / index.html
Created Jul 29, 2015
PHP Function: Get a file's last modification timestamp - FInal HTML - https://ryanfitton.co.uk/blog/php-function-get-a-files-last-modified-timestamp/
View index.html
<link rel="stylesheet" href="css/styles.cssstyles.css?v=1438124400">
@ryanfitton
ryanfitton / function.php
Last active Aug 29, 2015
PHP Function: Get a file's last modification timestamp - PHP Function - https://ryanfitton.co.uk/blog/php-function-get-a-files-last-modified-timestamp/
View function.php
<?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));
View index.html
<link rel="stylesheet" href="css/styles.css<?php echo lastModTimestamp("styles.css", "css/", true)); ?>">
@ryanfitton
ryanfitton / .htacess
Last active Aug 29, 2015
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/
View .htacess
# 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 Jul 22, 2015
Convert Reserved XML charecters to Entities
View function.php
<?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
View 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 Sep 26, 2014
Ubuntu Bash 'Shell Shock' vulnerability patch for Debian/Ubuntu systems
View command
#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 Sep 15, 2014
functions.php - Custom login
View functions.php
<?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 Aug 29, 2015
custom-login.css
View 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 Aug 24, 2014
ryanfitton.co.uk Navigation Menu Markup
View navigationMarkup.html
<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>
You can’t perform that action at this time.