Skip to content

Instantly share code, notes, and snippets.

View tomjn's full-sized avatar
🎯
Focusing

Tom J Nowell tomjn

🎯
Focusing
View GitHub Profile
@tomjn
tomjn / gist:4996601
Last active December 14, 2015 00:09 — forked from anonymous/gist:4996553
<?php
if ( function_exists( 'contact_detail' ) ) {
$chair = contact_detail( 'chair' );
$address = contact_detail( 'address' );
}
@tomjn
tomjn / gist:5005743
Created February 21, 2013 16:05
csswizardry-grids example
<div class="grid">
<div class="grid__item one-whole lap-one-half desk-two-thirds">
...
</div>
<div class="grid__item one-whole lap-one-half desk-one-third">
...
</div>
<?php
/**
* Plugin Name: Deny Giant Image Uploads
* Description: Prevents Uploads of images greater than 3.2MP
* Author: TJNowell
* Author URI: http://tomjn.com
* Plugin URI: http://tomjn.com/164/clients-who-upload-huge-camera-photos-decompression-bombs/
* Version: 1.1
*/
@tomjn
tomjn / gist:5151708
Created March 13, 2013 12:41
Change the text of the local indicator
<?php
function indicator_helloworld( $indicator_text ) {
return 'Hello World!!!';
}
add_action( 'tomjn_indicator_text', 'indicator_helloworld' );
@tomjn
tomjn / gist:5151718
Created March 13, 2013 12:42
Change the local indicator colour
<?php
function indicator_colour( $indicator_colour ) {
return 'yellow';
}
add_action( 'tomjn_indicator_colour', 'indicator_colour' );
Have you tried using git to do that?
@tomjn
tomjn / shortcode.php
Last active December 16, 2015 09:09 — forked from r-a-y/shortcode.php
Always ommit trailing php close tags, indent correctly, and remove the IDE unfriendly shorthand
<?php
if ( ! function_exists( 'shortcode_exists' ) ) {
/**
* Check if a shortcode is registered in WordPress.
*
* Examples: shortcode_exists( 'caption' ) - will return true.
* shortcode_exists( 'blah' ) - will return false.
*/
function shortcode_exists( $shortcode = false ) {
global $shortcode_tags;
@tomjn
tomjn / auditor-twitter-followers.php
Last active December 16, 2015 22:49
A plugin that extends the auditor to track who in the Interconnect/IT offices has the most twitter users
<?php
/*
Plugin Name: Twitter Follower Audit Tracker
Plugin URI: http://interconnectit.com/products/the-auditor/
Description: Uses the auditor to track twitter follower counts, requires v1.63+
Author: Tom J Nowell, interconnect/it
Version: 1.1
Author URI: http://interconnectit.com
*/
@tomjn
tomjn / texcavate.lua
Last active December 17, 2015 11:49
Computercraft excavate that digs 2 levels at a time, working on a third
--[[
TExcavate by Tom J Nowell
A modified version of the excavate command, mines 3 layers of rock at a time, and keeps persistent variables
requires: http://www.computercraft.info/forums2/index.php?/topic/1195-132-yet-another-persistent-variables-api-uses-metatable/
]]--
os.loadAPI("apis/persistentVar") -- Only use this line if you copied the API in your computers apis folder
local state = persistentVar:new( "/vars_texcavate/" )
@tomjn
tomjn / treechop.lua
Created May 27, 2013 14:32
Computercraft tree farm chops down and grows a tree given saplings and bonemeal, place a chest underneath
local slots ={}
function plantTree()
turtle.select(1)
turtle.place()
end
function chopTree()
turtle.select(4)
turtle.dig()