Skip to content

Instantly share code, notes, and snippets.

View ianchanning's full-sized avatar

Ian Channing ianchanning

View GitHub Profile
@ianchanning
ianchanning / row_toggle.js
Last active February 14, 2020 16:17
Pure JavaScript hierarchical table row toggling (plus older jQuery version too)
/**
* Hierarchical table rows object
*
* Pure JavaScript - but comes with a IE9+ warning
*
* @param {object} options tableSelector e.g. 'table'
* parentClass e.g. 'parent'
* collapsedClass e.g. 'hidden'
* childClassPrefix e.g. 'parentId'
* @type function
@ianchanning
ianchanning / svn_upgrade_wordpress.sh
Last active December 24, 2015 13:49
For upgrading WordPress when you've got a subversion installation. Backs up the database then upgrades WordPress to the specified version. A bit odd having subversion commands on github... but hey.
#!/bin/bash
# usage: svn_upgrade_wordpress.sh X.X.X
# http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion
# licence MIT
die () {
echo >&2 "$@"
exit 1
}
@ianchanning
ianchanning / ping.php
Created June 14, 2013 17:17
PHP Ping Packets
<?php
/**
* Ping a host using an IMCP packet
*
* N.B. This function must be called by an administrator / root user as socket_create requires this
*
* @param string $host domain
* @param integer $timeout seconds
* @return mixed False | Response time milliseconds
*