New Twitter Last Read Tweet Bar Bookmarklet

Update: Twitter has now added this to the site and the bookmarklet below is no longer of any use.

Got the new Twitter?
Annoyed that when you click the bar that says ‘x new tweets’ you can’t find the last one you had already read?
Harry Bailey to the rescue.

Update: Now works in Chrome, Safari, Firefox. Anyone checked Internet Explorer?

Drag the following link to your bookmark bar, go to the Twitter page that’s annoying you, click the bookmarklet:

(function(){ $('head').append(''); setInterval(function() { var last_read = $('div.stream-item.last-read'); if(!last_read.length) { $('div.stream-item:first').addClass('last-read'); } else if(last_read.prev().length) { $('div.stream-item.marker').removeClass('marker').removeAttr('style'); last_read.removeClass('last-read').addClass('marker'); $('div.stream-item:first').addClass('last-read'); } }, 2000); }();

[carousel keywords=”twitter development” tag=”fetchit-21″]

Hide topics row in Postbox message view

I love Postbox. I talk about it a lot. However Postbox is trying to be more than a mail client and as part of that is attempting to sneak into the world of GTD with the inclusion of todos and topics.

Now call me old fashioned but I use Things for my GTD stuff and so don’t use todos or topics in Postbox.

“Not a problem really is it?” I hear you yell. Well no until you look at the amount of space the topic row of Message View takes up. Believe me on a small screen this matters:

Continue reading

Fancybox left and right key problem

When you use fancybox, it automatically adds listeners which stop any other use of the Esc, Left and Right keys on your keyboard. The just don’t work in forms etc inside Fancybox.

This isn’t such an issue with the escape key, but not being able to use the left and right, for example in text inputs, is a pain.

The changes below add an additional option to Fancybox called useNextPrev which you can set to false to stop Fancybox adding listeners to these keys. I haven’t included the escape key as I think it’s far less of an issue. Continue reading

MySQL Toggle a Fields Value

UPDATE `table_name` 
SET `field_name` = (SELECT CASE `field_name` WHEN 1 THEN 0 ELSE 1 END) 
WHERE `id_column` = 1

Or with text strings

UPDATE `table_name` 
SET `field_name` = (SELECT CASE `field_name` WHEN 'foo' THEN 'bar' ELSE 'foo' END) 
WHERE `id_column` = 1

More powerful jQuery getScript with cache control

If you love getScript as a shortcut method in jQuery, but you hate not being able to control whether the script calls from the browsers cache or not then you can override the built-in function with a new one which is backwards compatible, so it won’t break any of your old code, and allows you to choose true or false to caching.

Read the original post by Jamie Thompson (via Internet Archive)

(function($){
$.getScript = function(url, callback, cache){
	$.ajax({
			type: "GET",
			url: url,
			success: callback,
			dataType: "script",
			cache: cache
	});
};
})(jQuery)

[carousel keywords=”jquery” tag=”fetchit-21″]