25 Jan 2012

Simple, fuzzy, timesince function for use in Javascript

18 Sep 2009

Loading content from another domain using jQuery's load function

I was never aware before that you can not load content from external domains using jQuery's load function. I wanted to be able to load in a HTML stock ticker I had created into any website that I needed to display it on but could not. Here is the solution I came up with: I created a file "loadticker.php" and inside it put:
echo file_get_contents("http://www.myscript.com/path/to/file.php");
I put this file on the domain of every website I wanted to load the content to and set each page where I wanted to display the content to load the local file, "loadticker.php". More of a workaround than a solution. On the pages where I was already using PHP and I was loading in the ticker I skipped loading the file and just simply added:
echo file_get_contents("http://www.myscript.com/path/to/file.php");
Where I wanted to display the ticker.
12 Aug 2009

Preloading images without Javascript, using CSS instead

If I can find a way of using CSS for something I would normally do with Javascript, I will always go with CSS. It also usually works out easier and cleaner in CSS.

When displaying my 2 stage CSS buttons on a page I was working on, the second stage took a few moments too long to load, so I decided I wanted to preload those images using CSS.

Here is my solution...

The CSS:

img.preload { display: none; width: 1px; height: 1px; }

The HTML:

<img src="./path/to/image.jpg" alt="preloaded" class="preload" />

Just add the class preload to each image and you should be laughing.

Rick Vause's Space

Hi, I’m Rick Vause. I am a web developer that loves Python.

I have always been interested in technology and software. I am a keen supporter of a number of open source projects.

I am obsessed with my ideas and attempts to continuously better myself in both my work and leisure time. I am always learning and trying to improve as long as there is space left in my head. I often find interesting, new things (interesting and new to me, at least) that I share on my blog.

I also like music and art.

I once spent 2 months working on a self-portrait that turned out terrible so for the avatar portrait I turned to my better half, Klaudia.

If you have any questions, comments or wish to talk to me about a project you are working on, please contact me.

I also try to be social so you can find me on Twitter, Facebook and Last.fm.

Contributors

Rick Vause