Posts Tagged ‘Javascript’

We all know, by now, that Twitter limits its tweets to 140 characters. We’ve all got pretty good at limiting ourselves to 140 characters, but many overlook a hidden limit. This post outlines what that is and how we can avoid it.
Many users of Twitters are hoping that their followers will retweet (RT) their tweets. Twitter recently made a change to how these work, but in general, the following pattern is followed:
UserXYZ tweets: Hey... here's something that's fascinating UserABC tweets: RT @UserXYZ: Hey... here's something that's fascinating
User XYZ’s tweet was 42 characters. UserABC’s RT was 52 characters, i.e. 10 characters were added in order to RT.
Put another way, if UserXYZ creates a tweet that was longer than 130 characters, nobody would be able to RT it with modifying the original tweet. If you’re trying to get a specific message out to the world, you might not be happy with lots of people fiddling with it.
I’ve created a new Greasemonkey script which will help you with this. I’ve written about Greasemonkey plugins before and this is another Twitter helper. If you install the script, you will see the following change:
You can now see, next to the normal character countdown, a bracketed countdown. This is the number of characters that you have left, before a tweet can no longer be RTed without modification. In this example, you would be able to send the tweet (as you have 6 characters left), but Twitter users would have to remove 8 characters before they could RT your Tweet.
To use this, it’s simple:
- If you haven’t already, install Greasemonkey
- Install the ReTweetable Alert script
That’s it! As ever, your questions and comments are most welcome
I recently wrote about a script designed to generate Rotating Banners. The script works fine, but using JavaScript to present a user with links creates a few problems of its own:
- Google Analytics will not be able to track these external links (if, for instance, you’re using my Google Analytics for external links)
- Non-visual User Agents will not be able to access these links
- As a subset, Google will not be able to crawl these links and so associate your site with the sites those banners point to.
I was recently sent a script designed to take a series of advertising banners and rotate them on a page. By ‘rotate’, I mean display on banner in a designated position and then, after a certain period of time, replace it with another, and then another, and so on. To be fair to those who paid for the banners, each banner was chosen at random so that each new visitor to the site would see a different banner first, second, third, etc. After taking a look at it, I spotted some problems and decided to fix them.
Read the rest of this entry »
Tracking external links with Google Analytics is a great way to work out and why how people are leaving your site. This post describes a method for automatically tracking external links in a way that degrades gracefully in the absence of Javascript.
Read the rest of this entry »

The other day, the preDevCamp team published our ‘PreView’ map at http://predevcamp.org/preView.html. In this post, I’ll talk about how it was put together.
PreView is a combination of the Google Maps API and the Twitter API. Without wanting to shatter the mystique, I’m going to outline how I set about creating PreView.
Read the rest of this entry »
There is a lot of excitement in the mobile development world about the coming of the Palm Pre. Palm’s been doing pretty poorly of late, so the alternate prospects of abject failure (and bye, bye Palm) and glorious success (bye, bye iPhone) has get everyone all of a quiver. The thing is, I’m a big geek… I’m just excited about webOS.
Read the rest of this entry »

O’reilly release the first chapter of their new webOS book in the past few days and it has been a welcome island in a sea of tedious rumours. While others may wildly speculate on when the Pre will appear, at least we now have some idea of what it will be running.
Read the rest of this entry »

I saw @mhat’s tweet today about ‘What language should I learn‘ and it got me thinking about the times I’ve asked that question and how I might answer it. So, @mhat, I’m taking your tweet to be a challenge to write an unbiased and ‘unwrong’ post. To do this, I’m going to give you a history of the languages I have learned.
Read the rest of this entry »

Like a fair number of people, I have a number of Twitter identities. I have my personal identity (@dancrumb) as well as a number of shared identities that represent events or organizations in which I’m involved.
I use a number of clients to send out tweets, but all of these clients limit you to a single identity. If you want to user twitter.com to send out messages, you need to log in with the appropriate identity before you perform any Twitter functions.
Herein lies the problem. When you’re logged in to Twitter and you navigate to somebody’s Twitter page, there is no indication as to who you’re logged in as. The risk is that you could elect to follow or message someone, thinking you’re logged in as one identity, only to find that you’re logged in as another identity. I did precisely this, yesterday. As luck would have it, the person was my sister and I quickly spotted my mistake, but if you’re using Twitter as a major communication channel, you need to be very aware of which identity you’re tweeting with.
In order to address this, I’ve written a small Greasemonkey script. You can access it here. You’ll need to have the Greasemonkey plugin installed, of course.
Once the script is installed, you will be able to see who you’re logged on as, in the Twitter navigation bar at the top right-hand corner of the screen, at all times.
I hope you find it useful; I know from experience that I will…

As part of the preDevCamp 2009 site, I created a JavaScript TwitterFeed today.
A sample can be seen here. If you leave this page open, it will constantly update with all Twitter tweets that contain the word ‘twitter’. It will update once every 5 seconds and will contain no more than the 25 most recent tweets.
Installing this code into a page of your own is very simple. You will need the following:
- jQuery must be installed and you must include it in your webpage
- tweetFeed.js must be included in your webpage
- tweetFeed.css should be included, although the function will work without this file
- A <div> with an id of ‘tweets’ somewhere on the page
With all of those in place, it’s a simple case of instantiating the feed:
var tf = new TweetFeed(searchString,feedPeriod,feedLength);
- searchString
- This is the string that is used to generate the feed. The feed will contain all tweets containing this word
- feedPeriod
- Number of seconds between each refresh of the feed
- feedLength
- Maximum number of tweets to show. At the moment, this must be > 15 or else the feed doesn’t work properly.
All of the relevant code can be found by looking at the example, linked to above. Feel free to use this in any way you like. Comments are welcome




