Skip to content

Instantly share code, notes, and snippets.

View fitzage's full-sized avatar

Matthew Fitzsimmons fitzage

View GitHub Profile
@fitzage
fitzage / truncate.php
Last active October 9, 2015 08:37
Kirby plugin to truncate by number of words and preserve tags. Works with Kirby v2.
<?php
function truncate($input, $numwords, $padding="")
{
$output = strtok($input, " \n");
while(--$numwords > 0) $output .= " " . strtok(" \n");
if($output != $input) $output .= $padding;
// Original PHP code by Chirp Internet: www.chirp.com.au
// Please acknowledge use of this code by including this header.
$opened = array();
@fitzage
fitzage / lastnotfuture.php
Created April 11, 2013 21:16
Kirby plugin to pull a specified number of posts either from a specific category, tag, or just in general that are the latest ones excluding any posts that are in the future. The date format is set for my blog post date format, but you can modify it to fit your needs. Use either a 'category' or 'tag' option to specify a category or tag, and use …
<?
function latestnotfuture($articles, $options=array()) {
global $site;
$defaults = array(
'category' => '',
'num' => '1',
'dateformat' => 'Y-m-d H:i',

Keybase proof

I hereby claim:

  • I am fitzage on github.
  • I am fitzage (https://keybase.io/fitzage) on keybase.
  • I have a public key ASCnBqQ6NkuBoCyI-VxknLarbG521-xL_OYtijCCUd-pWQo

To claim this, I am signing this object: