MooTools TwitterGitter and Cookies
One of my MooTools plugins I use most is TwitterGitter. TwitterGitter is a small MooTools plugin I've created to fetch any number of tweets from an Twitter user's account. Since clients don't tweet very often, there's no advantage to pinging Twitter for a tweet every page load. To save Twitter a bunch of repetitive requests, I use cookies to save the latest tweet.
The MooTools JavaScript
var tweet = '';
if(!Cookie.read('latestTweet')) {
var myTwitterGitter = new TwitterGitter(init.twitterHandle,{
count: 1,
onComplete: function(tweets,user) {
tweets.each(function(tweet,i) {
if(tweet.text) {
Cookie.write('latestTweet',tweet.text, { duration: 1 });
tweet = tweet.text;
}
});
}
}).retrieve();
}
else {
tweet = Cookie.read('latestTweet');
}
Pretty simple: if the cookie is there and fresh, use the cookie's value as the tweet; if not, go get the tweet from Twitter. Of course the most optimal method of saving tweets is caching them server-side but if you use TwitterGitter, I recommend using cookies to avoid unnecessary pings to Twitter.
![Creating Scrolling Parallax Effects with CSS]()
Introduction
For quite a long time now websites with the so called "parallax" effect have been really popular.
In case you have not heard of this effect, it basically includes different layers of images that are moving in different directions or with different speed. This leads to a...
![CSS Animations Between Media Queries]()
CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during...
![Send Email Notifications for Broken Images Using jQuery AJAX]()
It's usually best to repair broken image paths as soon as possible because they can damage a website's credibility. And even worse is having a user tell you about it. Using jQuery and PHP, you can have your page automatically notify you of broken...
![CSS @supports]()
Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn't been available within CSS. What we end up doing is repeating the same properties multiple times with each browser prefix. Yuck. Another thing we...
Hey this is great. I have been using your twitter plugin for a while and was kinda forced to stop using it because twitter would block my site as a referer pretty often. That might solve this issue