Skip to content

Instantly share code, notes, and snippets.

View lordmatt's full-sized avatar

Matthew lordmatt

View GitHub Profile
@lordmatt
lordmatt / fetchfeed.php
Last active December 15, 2015 14:49
Feed Fetch: Fetches feeds and caches them for a few hours and returns them in handy dandy simpleXML objects.
<?php
/**
* Feed Fetch: Fetches feeds and caches them for a few hours.
*
* Copyright (C) 2007, 2013 Matthew Brown aka Lord Matt
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@lordmatt
lordmatt / NP_ItemLicense.php
Last active December 15, 2015 14:49
This is a fork of Graeme Cook's 0.1.0 ItemLicense plugin for NucleusCMSwhich can be found here: http://wakka.xiffy.nl/itemlicense_code The purpose of the fork is to make changes including depreciating all support for PHP4 and standardised on PHP5 style coding. Also it means that his code is available on github.
<?php
/**
* Apply a license of your choice to NucleusCMS blogs on an item-by-item basis.
*
* Copyright (C) ???? Graeme Cook, 2013 Matthew Brown aka Lord Matt
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@lordmatt
lordmatt / Nu Comment with ModValues
Created May 4, 2013 23:47
This is an SQL query that will return both the NucleusCMS comment but also the ModComment values all in one hit. This is as part of a side project to make certain comment related functions more sophisticated.
SELECT nucleus_comment.*,count(recordID) as votes,sum(score) as score, TopScore
FROM nucleus_comment
INNER JOIN nucleus_plugin_modcomments
ON nucleus_plugin_modcomments.commentid=nucleus_comment.cnumber
INNER JOIN
(
SELECT *
FROM (
SELECT commentid, COUNT( recordid ) AS freq, score AS TopScore
FROM nucleus_plugin_modcomments
<?php
/**
* Giving myself more functionality over this bit
*
* @author byrd
*
*/
class BetterXML extends SimpleXMLElement
{
/**

Creating PDF thumbnails in PHP

Install Ghostscript

Download and install right version of ghostscript. In my case my PHP was x86 architecture, so I download Ghostscript 9.14 for Windows (32 bit).

Enable ImageMagick

<?php
/**
* --------------------------------------------------------------
* Contact Form To Email Demo
* Copyright (C) 2015 Lord Matt <lordmatt.co.uk>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
<?php
/*
Matt's Word Bingo generator script.
Copyright (C) 2017 Matthew D Brown
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
<?php
/*
* Problem
* -------
*
* I needed a set of undefined size of card layouts on a 5x5 grid that were
* rotationally unique from each other. This data had to be as CSV lines in a
* file.
*
@lordmatt
lordmatt / WP-fun-with-headers.php
Created April 16, 2019 16:49
This is an example of doing silly things with headers in WordPress
<?php
/**
* This is an example of doing silly things with headers in WordPress
*
* @author Lord Matt <http://lordmatt.co.uk>
*/
function fun_with_headers(){