Skip to content

Instantly share code, notes, and snippets.

View willwade's full-sized avatar
🌏
Working on dasher and a lot of Ace hardware projects

will wade willwade

🌏
Working on dasher and a lot of Ace hardware projects
View GitHub Profile
@willwade
willwade / ExtractMediaFromClicker.py
Created March 19, 2012 21:20
Extract embedded Media from Clicker 5 files
#!/usr/bin/env python 2.7
# Contact: Will Wade <[email protected]>
# Date: March 2012
"""
Read a clicker grid
Export in same folder all the embeded sounds, video and images
##Binary##
http://dl.dropbox.com/u/66960/Apps/ExtractMediaFromClicker5.zip
@willwade
willwade / switchphp.php
Created April 1, 2012 15:56
Switch PHP
################################################################################
# Setphp helps out in running Apache with either php4 or php5 and makes
# switching between these versions easy.
#
# Author: Bjorn Wijers <http://www.burobjorn.nl>
#
# I was inspired by this post
# http://www.entropy.ch/phpbb2/viewtopic.php?p=5842#5842
#
#
@willwade
willwade / rmm
Created April 1, 2012 15:58
rmm - remove to trash for the user instead of "delete"
#!/bin/sh
version="v0.0.0.5"
########################################################################
# rm v0.0.0.5 for use with Darwin-OSX ......
# by Gary Kerbaugh
# Send comments, bugs or money to [email protected]
#
# rm emulates the Gnu FileUtils rm except that it moves file to the
cat $1 | tr '\r' '\n'
find [^\!]*/* -type f -newer $1 -printf "%h\n"
@willwade
willwade / randomisation.php
Created April 29, 2012 12:12
Randomisation Script - used in Research study for WAMBLE
<?php
// OUTPUT HANDLING
$output = (isset($_GET))? $_GET['type'] : 'screen';
// Setup
$done = false;
$keys = array(2,4,6);
$blocks = array();
$j = 0;
@willwade
willwade / twitterWP.php
Created July 1, 2012 17:38
How to display the latest tweet in your wordpress site
#!/usr/local/bin/php.cli
<?php
/* to use.
1. Stick somewhere on your server.
2. Make sure the script can write to a file next to it (chmod 755 latest-tweet.txt)
3. Place into cron e.g.
*/15 * * * * /home/site/www/www/wp-content/themes/Moses/includes/twitter.php
4. Edit your footer (or anywhere) with this:
<?php echo file_get_contents(get_theme_root().'/Moses/includes/latest-tweet.txt'); ?></p>
@willwade
willwade / facebookfeed.php
Created July 3, 2012 22:45
Display the latest from a Facebook group rss feed. NB: Install app "group RSS"
<?php
/**
* trims text to a space then adds ellipses if desired
* @param string $input text to trim
* @param int $length in characters to trim to
* @param bool $ellipses if ellipses (...) are to be added
* @param bool $strip_html if html tags are to be stripped
* @return string
*/
function trim_text($input, $length, $ellipses = true, $strip_html = true) {
@willwade
willwade / ReduceFiddlingiOS.markdown
Created October 11, 2012 14:24
Reduce Fiddling on iOS

To reduce the "fiddling" opportunities on an iDevice look at these steps:

  1. Enable restrictions. Go to settings -> General -> Restrictions. Here you can allow/disallow a range of inbuilt applications such as the web browser, camera, iTunes installing – and most importantly – deleting apps.
  2. Move non-essential apps to a folder and put the folder on a page several empty pages deep. To move apps; press on hold on any app on the homescreen. Hold down till all the apps wobble and a small x appears at the top right of each app. Then drag apps to a new folder (you can do this by dragging one app ontop of another). To move apps – or a folder of apps – to a new screen drag the app to the right or left and keep your finger on the screen at the edge.
  3. It’s probably best to look at iOS 6; the new operating system for iPads and iPods. (For more info on this follow this link: http://wllw.de/Q1fzA1 )There is a feature in the new operating system that allows you to “lock” a user into an app and make the home button d
@willwade
willwade / ScrapeACEOxfordWebsite.py
Created November 4, 2012 22:57
Navigate through the old ACE Centre website. Download the HTML and Text content and associated images.
# Navigate through the old ACE Centre website. Download the HTML and Text content and associated images.
# Neat use of descendant-or-self that I stole from somewhere
import urllib
from lxml import etree
default_encoding = "utf-8"
import urllib2, urlparse, os, string
def aceox_html (html_text, page_encoding=default_encoding):
myparser = etree.HTMLParser(encoding=page_encoding)