Skip to content

Instantly share code, notes, and snippets.

View simonwheatley's full-sized avatar

Simon Wheatley simonwheatley

View GitHub Profile
@simonwheatley
simonwheatley / test-apns.php
Created November 4, 2011 11:42
APNS Tests
<!DOCTYPE html>
<html lang='en-us' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta charset='utf-8'>
<title>APNS TESTING 1…2…3…</title>
</head>
<body>
<?php
@simonwheatley
simonwheatley / class-gsa-for-wp-ms.php
Created January 3, 2012 16:10
GSA for WordPress Multisite
<?php
/**
* Handles most of the work.
*
* @package GSA for WordPress Multisite
* @author Simon Wheatley
**/
class GSAForWPMS extends GSAForWPMS_Plugin {
@simonwheatley
simonwheatley / Infinite Response Time Reporter
Created March 1, 2012 11:02
Uses Curl to get the response time for a webpage, also regexes out the page gen time (this last relies on WP Super Cache's "Dynamic page generated in X.XX seconds." HTML comment)
#!/bin/bash
# My script below is based on this one:
# http://unixbhaskar.wordpress.com/2010/11/12/measure-website-response-time-through-curl/
if [ -z $1 ]
then
echo "Please pass a URL to measure the response time for, e.g."
echo "sh infinite_response_time.sh http://google.com/ cookie1=123\;cookie2=abc"
exit
@simonwheatley
simonwheatley / scrape_tweets.rb
Created March 25, 2012 14:50 — forked from stefl/scrape_tweets.rb
Download all tweets from the twitter search API for a given search term (limited to their maximum of 1500)
#! /usr/bin/env ruby
search_term = ARGV[0]
if search_term
time = Time.now
directory_path = File.dirname(__FILE__) + "/tweets/" + search_term + "_" + time.to_i.to_s
FileUtils.mkdir_p(directory_path)
directory = Dir.new(directory_path)
(1..15).each do |i|
`curl "http://search.twitter.com/search.json?q=#{search_term}&rpp=100&page=#{i}&include_entities=true&result_type=mixed" > #{directory.path}/#{i}.json`
end
<?php
/*
Plugin Name: Ordered Post Tags – Template Tags & API
Plugin URI: https://gist.github.com/3217544
Description: Proof of concept plugin, not for production use. Provides template tags and an API for those functions. Won't work without Ordered Post Tags POC plugin.
Version: 0.1
Author: Simon Wheatley @ Code for the People Ltd
Author URI: http://codeforthepeople.com
*/
<snippet>
<content><![CDATA[
<div class='${1:updated}${2:error}'><p>$3</p></div>
]]></content>
<tabTrigger>adminnotice</tabTrigger>
</snippet>
@simonwheatley
simonwheatley / .gitignore
Created August 14, 2012 14:06
Applescript to register a URL protocol to open Netbeans
nbopen.app
@simonwheatley
simonwheatley / media-experiments.php
Created March 6, 2013 07:36
WP 3.5 Media Experiments – Learning by prodding things.
<?php
/*
Plugin Name: WP 3.5 Media Experiments
Description: Learning by prodding things.
Version: 0.1
Author: Simon Wheatley
Author URI: codeforthepeople.com
*/
// for debug : trace every event
// var originalTrigger = wp.media.view.MediaFrame.Post.prototype.trigger;
// wp.media.view.MediaFrame.Post.prototype.trigger = function(){
// console.log('Event Triggered:', arguments);
// originalTrigger.apply(this, Array.prototype.slice.call(arguments));
// }
// custom state : this controller contains your application logic
wp.media.controller.Custom = wp.media.controller.State.extend({
@simonwheatley
simonwheatley / cftp-wpcp-notice.php
Last active December 15, 2015 04:39
WP Cycling Project Notices
<?php
/*
Plugin Name: WP Cycling Project Notices
Plugin URI: https://gist.github.com/simonwheatley/5202993
Description: Adds notices above the WooCommerce cart and checkout for WP Cycling Project
Version: 1.0
Author: Code for the People
Author URI: http://www.codeforthepeople.com/
*/