Skip to content

Instantly share code, notes, and snippets.

View wooki's full-sized avatar

James Rowe wooki

View GitHub Profile
@wooki
wooki / gist:1523301
Created December 27, 2011 11:02
Remount root file system in read/write mode in Ubuntu recovery mode
mount -o remount,rw /
@wooki
wooki / jimcode_get_thumnail
Created May 16, 2012 09:40
Wordpress function to get a thumbnail image filename from a different sized thumbnail or the the source
// utility for getting a thumbnail image from a different sized thumbnail image
// or the original. Assumes the size requested is auto generated
// eg. ..../2012/05/TSStAlbans-h1091-1024x750.jpg
// to../2012/05/TSStAlbans-h1091-300x200.jpg
//
// Or. ..../2012/05/TSStAlbans-h1091.jpg (source image)
// to../2012/05/TSStAlbans-h1091-300x200.jpg
//
// Add standard image sizes using add_image_size function and rebuild
// thumbnails when needed using AJAX Thumbnail Rebuild plugin.
@wooki
wooki / php_glob
Created July 31, 2012 10:09
Util function for a recursive filesearch using glob function
/****************************
*
* Util function for a recursive filesearch using glob function
*
****************************/
if ( ! function_exists('glob_recursive')) {
// Does not support flag GLOB_BRACE
function glob_recursive($pattern, $flags = 0) {
@wooki
wooki / gist:3424196
Created August 22, 2012 10:24
Glass Button in CSS
/*
* Original one http://snipplr.com/view/50166/, posted here so I don't lose it!
*/
a.button {
font-family: 'PT Sans', arial, serif;
color:#ffffff;
text-align:center;
font-size:24px;
font-weight:bold;
@wooki
wooki / Permissions for wordpress
Created March 20, 2013 12:25
Permissions for wordpress
# add your own user to the www-data group
sudo adduser yourusername www-data
# change ownership to www-data group and your user
sudo chown yourusername:www-data -R /var/www/site
# change permissions of files and folders
cd /var/www/site
find . -type d -print0 | xargs -0 chmod 0775 # For directories
find . -type f -print0 | xargs -0 chmod 0664 # For files
@wooki
wooki / gist:6319687
Created August 23, 2013 14:06
replace serialized urls in wordpress
################################
#
# Parse a Sql export from a Wordpress db
# and do a search and replace on URLS in
# serialised data while maintaining the
# correct string lengths
#
# e.g. look for stuff like...
# s:76:\"http://www.website.com/wp-content/uploads/2012/04/rest_img-150x142.png\";
#