Programming and general geekiness.

Posts tagged ‘christmas’

Computer model

After having sprained my wrists on Christmas Eve I’ve only just managed to start typing again :-) . The above was a Christmas present that my dad made for me. From what I can gather it was made from scrap metal before spray painted silver. The CDs on the desk are made from sequins and I think that it took him a few hours.

Random Christmas decorations and origami

Over the past few days I’ve been taking occasional breaks from programming to make random origami and paper Christmas decorations for absolutely no reason whatsoever. The first is a relatively simple origami star that has been made from 6 post it notes:

I can’t claim I made this one (members of my family did) but I quite like the Tux (not intentional, I just saw it and thought it looked like Tux) on our Christmas cake:

The following was a something-hedran that I made this afternoon. It is made from thirty post it notes and is around ten centimeters high. It took me a couple of hours because it kept falling apart:

Paper iPhone snowflakes

Its Christmas time and I have a bad habit of making paper snowflakes. This year I’ve been exploring different snowflakes (I came across a load of 3D ones and Star Wars faces) before getting an idea. Why not make a snowflake with something symmetrical. Like the iPhone. Because no one else has been as sad as me I had to create the template myself:

All you have to do is print out the above template and fold a square piece of paper like this:

You then just use the template to create the snowflake. Note that on the bottom there is a charging lead. Here is what the finished snowflakes look like:

Writing out Christmas cards

Every year I write out my Christmas cards and I quite pleased to say that I managed to write out all of mine today. I also devised a really simple way of choosing who to send them to and how to write them out as quickly as possible. I sent Christmas cards to the following people:

  • Family
  • Close friends
  • People that have sent/given me a card already – I may add people at a later date
  • Friends that are somewhere between friends and acquiescent

When I had to write the cards out I used the following method:

  • Make a list of everyone that I was going to send a card to and randomize it so that different people get a different card
  • Write ‘To’ in the top left hand corner of each card
  • Write ‘From Thomas’ in the bottom right corner of each card
  • Add the names to the top left of each card
  • If the card doesn’t already have a message in it add ‘Merry Christmas and an awesome new year’
  • Take each card and write an envelope for it (or use a printed label of the address) and put the card in the envelope
  • Once the above task is completed, seal each envelope

I found that this method was highly efficient. Merry Christmas everyone!

Falling snowflakes with CSS3 and JavaScript

I’ve been doing some work on my Christmas Countdown site to add a snowflake falling effect. I had seen other scripts on the internet but they all looked a little slow and I wanted to use CSS3. All I’ve done is create snow.js with the following code:

count = 30;
var docHeight = Math.max(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.documentElement.offsetHeight), Math.max(document.body.clientHeight, document.documentElement.clientHeight));
var docWidth = Math.max(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), Math.max(document.body.offsetWidth, document.documentElement.offsetWidth), Math.max(document.body.clientWidth, document.documentElement.clientWidth));
function snowflakes()
{
 for (var i = 0; i < count; i++)
 {
 document.write("<div id=\"snowflake" + i + "\" style=\"position:absolute;z-index:1001; top:" + (-docHeight * 2 * Math.random()-50) + "px; left:" + (Math.random()*(docWidth-10)) + "px;background-color:white;width:10px;height:10px;border-radius:10px;transition:all 1s linear;-webkit-transition:all 1s linear;-o-transition:all 1s linear;-moz-transition:all 1s linear;\"> </div>"); 
 }
 setInterval("move()", 500);
}
function move()
{
 for (var i = 0; i < count; i++)
 {
 var top = parseInt(document.getElementById("snowflake" + i).style.top.replace("px", "")) + 5 + (Math.random()*10);
 if (top < docHeight - 10) document.getElementById("snowflake" + i).style.top = top + "px";
 else document.getElementById("snowflake" + i).style.opacity = "0";
 }
}

This effect works relatively well. To launch it add the following to the end of the body:

<script type="text/javascript" src="snow.js"></script>
<script type="text/javascript">snowflakes()</script>

On my site I’ve blocked it from coming up in IE because the transition won’t work (I’ve used PHP to do this) but it definitely works in Chrome, Firefox, Opera and Safari with Firefox offering the smoothest animation. If you find that you need more snowflakes just increase the count variable at the top of the file however you have to consider the performance of users’ computers.

Christmas is actually here

I am generally a bit of a scrooge in the run up to Christmas however this year I have actually managed to be relatively happy about the whole thing. Not sure why. The main reason that I am beginning to feel like it is actually Christmas is because I have finally written up my Christmas Card list (I’am going to write them out like a production line – write the Tos, then the Merry Christmases, then the sign offs and then people’s names) and I have been Christmas shopping – although I’ve just ended up in the Apple Store so it doesn’t really count.

Every store nearby has got Christmas decorations up (some of them have gone a bit OTT) but Apple have been more subtle and switched the staff into Red shirts and set up the Express Shopping lane already; there’s a massive stack of iPads off to my right.

I don’t know if I’ve mentioned this before but it is actually relatively easy to find the draw string bags in the Apple Store because at the back facing end of each table of goodies there are slots that the staff pull them out from. In this Apple Store there are definitely larger bags further back and the small ones are at the front with the iPhones and iPods.

My Christmas countdown website

Every year I produce a Christmas countdown website for the fun of it. This year I have done something similar that uses HTML5 and JavaScript to produce a nice and simple countdown. You can view it here. If you would like to upload images for the slideshow, please click here. I intend to add audio in the future.

Follow

Get every new post delivered to your Inbox.