
Stress HeadIf you've had a day like mine you'll appreciate this one-minute massage technique. Or you can just have a jolly good laugh at the comments.
Posted at 10:55 PM
Comments (0)
TrackBack (0)
More Banksy
Posted at 2:07 PM
Comments (0)
TrackBack (0)
Twitter badgeAs you can see from the right hand side, I now have a "Currently" section. This is basically a badge from Twitter that automatically updates when I do. If you've tried doing the same and haven't had any success using the code from the Twitter website, you're not alone. The Javascript code on the website uses .relative_created_at; instead of .created_at; like it should. Without fixing it, the date comes out as "undefined".
Even after amending that however, the date is in a less than desirable format. I used Jon Aquino's script and amended it to suit my needs. If you mess around with it you can do all sorts of things like link to individual statuses. All I wanted was to get rid of the list elements and just show one update at a time. You're free to nick my amended code if you like. Remember to change the user_timeline (in bold) to your own.
<script type="text/javascript">
var elapsedTime = function(createdAt) {
var ageInSeconds = (new Date().getTime() - new Date(createdAt).getTime()) / 1000;
var s = function(n) { return n == 1 ? '' : 's' };
if (ageInSeconds < 0) {
return 'just now';
}
if (ageInSeconds < 60) {
var n = ageInSeconds;
return n + ' second' + s(n) + ' ago';
}
if (ageInSeconds < 60 * 60) {
var n = Math.floor(ageInSeconds/60);
return n + ' minute' + s(n) + ' ago';
}
if (ageInSeconds < 60 * 60 * 24) {
var n = Math.floor(ageInSeconds/60/60);
return n + ' hour' + s(n) + ' ago';
}
if (ageInSeconds < 60 * 60 * 24 * 7) {
var n = Math.floor(ageInSeconds/60/60/24);
return n + ' day' + s(n) + ' ago';
}
if (ageInSeconds < 60 * 60 * 24 * 31) {
var n = Math.floor(ageInSeconds/60/60/24/7);
return n + ' week' + s(n) + ' ago';
}
if (ageInSeconds < 60 * 60 * 24 * 365) {
var n = Math.floor(ageInSeconds/60/60/24/31);
return n + ' month' + s(n) + ' ago';
}
var n = Math.floor(ageInSeconds/60/60/24/365);
return n + ' year' + s(n) + ' ago';
}
// Make date parseable in IE [Jon Aquino 2007-03-29]
function fixDate(d) {
var a = d.split(' ');
var year = a.pop();
return a.slice(0, 3).concat([year]).concat(a.slice(3)).join(' ');
}
function twitterCallback(obj) {
var html = '';
for (var i = 0; i < 1; i++) {
html += '' + obj[i].text + ' (updated ' + elapsedTime(fixDate(obj[i].created_at)) + ')';
window.aaa = obj[i].created_at;
}
document.getElementById('twitter_list').innerHTML = html;
}
</script>
<span id="twitter_list"></span>
<script type="text/javascript" src="http://www.twitter.com/t/status/user_timeline/2976491?callback=twitterCallback&count=1"></script>
Posted at 5:40 PM
Comments (6)
TrackBack (0)
You are here: SaimaSays.com. The original Saima Says site and blog.
Saima Says' Vox: my moblog, also featuring music/movie/book reviews
Saima Says "Greetings!": the place to buy unique greeting cards and gifts
My name's Saima and this is my weblog; a chronologically ordered collection of links, rants, stories and other random nonsense. If you're nosey, more information is available here. [Copyright notice]

Radio Silence (2)
Sif: I'm not old, I'll box y...
Saima: Mighty Boosh rocks! The...
Published Photographer - No doubt! (4)
Saima: I'd say vlookups are a ...
Sif: Not sure I thanked you ...
London to New York (4)
Sif: Yeah, it's for real, yo...
Anisa: It was me that showed M...

Fifth Element love (0)
The Four Ws (0)
Live Manta Birth (0)
Hogwarth's school opening (0)
Rihanna sells out... (0)
Blair's big adventure (0)
The Tate Moodern (0)
Tall folk wanted (0)
Islamic women priests (0)
Rise of London (0)


Tahira Iqbal
Anil Dash
Asifhecares
fudge it
heather powazek champ
The Nerd's Eye View
minor9th.com


CopyrightSaimaSays.com and the Saima Says logos are licensed under a Creative Commons License. This includes all content, design and images. If you steal my stuff, bad things will happen to you in this life and the next.
WarningTaking this site or me seriously will ultimately lead to social disorder and the disintergration of reality as we know it. Also, llamas may begin to rule the world. I like llamas. (Though I suggest you take the copyright notice seriously.)
DisclaimerI cannot be held responsible for the pure drivel on this site. It is usually written under the influence of chocolate and my love for llamas.
Powered by Movabletype