ThingyMaJig

Thingy Ma Jig is the blog of Nicholas Thompson and contains any useful tips, sites and general blog-stuff which are considered interesting or handy!

Connect

LinkedIn GitHub

Topics

announcement 25 apache 3 Apple 1 bash 8 code 7 cool 30 Days Out 8 Dark Basic Pro 4 design 12 doctor who 1 Drupal 74 E4600 1 EOS 400D 3 firefox 2 Flickr 3 free 21 games 5 geek 38 git 2 GreaseMonkey 1 hardware 7 Homebrew 1 How to 37 humour 5 iphone 1 javascript 1 jquery 1 K800i 6 k850i 4 lighttpd 3 linux 33 mac 9 miscellaneous 4 mobile phone 9 music 4 mysql 8 n73 1 n95 1 New Relic 1 Ogre3D 1 OS X 2 performance 3 photos 10 programming 40 Quicksilver 1 review 19 security 3 SEO 6 software 12 svn 2 technology 4 tip 7 tips 10 tv 3 video 3 vim 7 webdev 2 websites 33 wii 1 windows 1 YADS 10

Thingy Ma Jig

How to get Load AVG for remote server on loop

11 May 2011
bash linux How to

This handy script will allow you to get the current Load Average (loadavg) for a remote server over SSH. It will stream the result set back to you, which you can then pipe into a file if you need to.

This would be handy for monitoring the load of a server while stress testing, for example.

Nice Dates - A How To

10 May 2011
Drupal How to

I've had several people ask me recently how I managed to get the nice date effect on my blog headers. It's quite simple really. All you need is:

  • An Image - A background image (a CSS Sprite) which contains the days, months and years.
  • Some HTML - A VERY basic HTML template.
  • Some CSS - To align the image sections.
  • A PHP Snippet - A Drupal preprocess function.

Batch Revert Views

16 February 2011
Drupal code tips

Isn't it a pain when you have dozens of Views setup and they are all marked as "overridden" because you just pulled in an updated feature file from somewhere. Features doesn't always notice when the Views on your site aren't up to date.

The following snippet (which you should use with caution) will batch "delete" (or Revert, once the view is in code) all Views which are marked as Overridden. This took a few seconds to run on our development machine.

Entity Encode Text Using PHP

07 February 2011
code programming

Ever needed to Entity Encode a block of text (maybe to partially protect it from spam bots or just hide/obfuscate the content?). I did. It’s pretty easy.

If it’s just basic Entity Encoding, you can always use htmlentities - however this only does the “important” characters such as quotes, ampersands and angle brackets.

Gravikill

05 February 2011

GraviKill started out as an experiment with the effect of a gravity field on a moving item. When I found you could get really cool sling-shots from the formula, I thought "What if I tried to fire something from A to B but it got effected by pushes and pulls in between?"… and thus GraviKill was born!

Thingy Ma Jig - Now brought to you by Drupal 7

16 January 2011
Drupal How to code tips

So, Drupal 7 is out. Have you heard? It was a bit of a quiet launch really. ;-)

When it came to upgrading by blog, I decided (eventually) that I needed to do a cleanup as the Database had been upgraded from 4.7, to 5 and then to 6 - with many modules added and removed in between. New year, new drupal, new blog (kinda)!

New Drupal Site: Rate My Christmas Tree

09 December 2010
Drupal websites YADS cool announcement

Ever wondered if your Christmas Tree is really any good? Well last weekend I decided to make a website for this purpose. It's just a bit of fun really! You login using your Facebook credentials (using Facebook Connect) and can create Chrismas Tree posts by linking to Flickr or Facebook photo's. You can then vote on your favourite tree's in an "A vs B" type match. If you like the sound of this and fancy something a bit festive, please give it a go and let me know if you have any thoughts! Head over to Rate My Christmas Tree :-)

Fixing Dos Line Endings

25 November 2010
tips linux How to geek code Drupal

Sometimes, when you're running coder on a module, you'll get a lot of errors complaining about Windows line endings. This is because you should set your editor to use Unix Line endings to be consistent with all developers. See the Drupal Coding Standards for more details.

Below is a handy bash script which will help you batch convert many files from DOS to Unix line endings.

MySQL: How to upper-case words

30 September 2010
tips programming mysql How to code

 I recently needed to clean up a MySQL Table which contained people's names. Upon searching the MySQL commands, I was surprised to find there was no equivalent of PHP's ucfirst or ucwords. There were commands to convert entire strings into upper or lower case, but not just the first letter.