'sandbox' tag

jQuery Random Colour Generator

6

I can’t remember the inspiration for this crazy thing, but I’m sure somewhere out there someone is looking for a random colour generator that is done in jQuery.

So if you’re feeling in the mood to have a randomly changing colour … this is the script for you! Essentially it’s just generating a random number between 0 and 255 for red, green, and blue. It then uses CSS to change the colour property of an element (that’s easily customizable by you).

So check out the demo.

Secret Santa Script

2

Every year my friends and I typically have a little “Secret Santa” (we call it “Secret Satan”, but that’s neither here nor there) — you know, where you are randomly pick a person’s name out of a hat and it becomes your job to buy a present for said person.

In previous years it was always easier because we were able to meet up to do the hat-selection. The past two years have not been so easy, due to conflicting schedules and what-not. Last year’s solution was to get someone’s mom to send out the emails.

This year I opted for a PHP-based solution. If you’re thinking “THAT’S AMAZING”, you are correct, it is amazing. Because of the rush I was in to make it, it’s not as user-friendly as it should be. There’s two things you need to do to get this working out of the box:

  1. Edit the array containing names and emails. This is the most critical part.
  2. When you first run the script it will be in no-email mode, so you can preview the how the script might work (remember, it’s random …). Change the $noemail variable to false for it to send emails. You will NOT see who is paired up with who after debug mode is turned off.

It randomly pairs people up, making sure not to pair up the same person twice, or pairing the same person. Then it sounds out the emails! It’s just that easy (I hope).

Edit: this has been updated as of December 2009.

Demo | Source (on Github)