Introducing the Twitter Watch

The Watch is a list of curated quality links about web development. I've been maintaining it for a year now so I thought I would share the results with everyone as this will probably be useful to somebody else. I select the links from Twitter mostly based on their usefulness. They contain interesting reads, points of views, helpful scripts, articles, resources... Well plenty of things worth bookmarking when you are interested in web development.

Thank You for Downloading

I'm glad that you found my work useful. If you did, it might help some other people too. So why not helping me spread the word with a tweet? You could also buy me a coffee to thank me for my code and explanations if you prefer ;).
I hope you'll enjoy your download. Regards. Jeremy.

Visit the Watch page

A bit of history

In my previous site version, I used to post a monthly list of useful web development links found on Twitter. It was interesting but a bit tedious to maintain because I needed to get a picture of the link, write a short description (in two languages at the time), and post it in a particular administration module.

I realized this workflow wasn't ideal so I imagine an automated solution that would encourage me to tweet quality links that would automatically be saved in my module if they contained a url and a hashtag.

I already have a script that displays my latest tweets at the bottom of the site. I imagined taking this further to analyze the tweet and given they meet some particular requirements, save them in the database automatically.

How does it work?

I wrote a tweet analyser class in php. Its role would be to look for links, hashtags and usernames in a given tweet first, then if some of those elements are found, perform a given action with the tweet, the default action being a simple backup of the tweet in the database.

In more details

Run the analyzer on the tweet

  1. include_once(WP_THEME_ROOT.'/models/tweetAnalyser.class.php');
  2. $analyser = new tweetAnalyser();
  3. $analyser->analyseTweet($tweet); //$tweet being a tweet object returned by an API call

Analyze the tweet

  1. public function analyseTweet($tweet){
  2. $text = $tweet->text;
  3. $smart = array();
  4.  
  5. //get links
  6. $linksmatches=array();
  7. preg_match_all('#http://[a-z0-9._/-]+#i', $text, $linksmatches); //Links
  8. $smart['links'] = reset($linksmatches);
  9.  
  10. //get users
  11. $usernamesmatches=array();
  12. preg_match_all('#@([a-z0-9_]+)#i', $text, $usernamesmatches); //usernames
  13. $smart['usernames'] = reset($usernamesmatches);
  14.  
  15. //get hashtags
  16. $htagsmatches=array();
  17. preg_match_all('#\#([a-z0-9_-]+)#i', $text, $htagsmatches); //Hashtags
  18. $smart['htags'] = reset($htagsmatches);
  19.  
  20. $this->bk($tweet,$smart);
  21. }

Save the tweet

  1. public function bk($tweet,$smart){
  2. //Save the tweet in database
  3. }

We can then imagine plenty of outcomes from a class like this. For example, instead of just saving the tweet in the database, we could imagine saving it to delicious or reddit, send an email to someone, post it automatically to another twitter account, @reply to someone, post an image to instagram or flickr and so on! The ifttt service offers plenty of similar functionalities for example or inspiration, but the good thing with a custom script is that it allows you to integrate it better with your own system.

As an example, with my saved tweets, Iv've built the Watch page, that allows me to keep track of my tweeted links. I've also indexed those links so they can be searched via my site's search engine. Therefore, when I recall having seen a nice links about grunt but don't remember what the url was, I just use my site's search and it gives me everything I need.

So what are you going to do with your tweets? Let me know in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

Other Useful Resources

How to create your own rss feed illustration

RSS is a way of easily keep your site's readers up to date with your latest content. That's a reason why it is widely used by the famous blogs and big sites. Once someone subscribes to an RSS feed, he'll get a notification every time you post some new content to your site. It helps fidelizing your users, therefore improving your traffic. It is definitely worth implementing. This tutorial will guide throught the steps involved in the creation of your own RSS feed from scratch, and based on your site's existing platform.

Read more
How to make SEO friendly urls illustration

It's now quite common to swap the old url format containing file extensions and non explicit query strings by SEO friendly ones, only made of keywords and slashes, hence their name.

There are several techniques to do so, and I certainly do not have the pretention to say that this one is the best of all, but it is the one I use in personal projects as it works nicely, and it is robust and dynamic.

It makes use of an .htaccess file to rewrite the urls, of a php function to parse the given parameters, and a content manager to serve the appropriate content according to them.

Before we start I'd like to make a personal thanks to Josh Moont for his precious help.

Read more
How to turn any jQuery plugin into a WordPress one illustration

WordPress and jQuery are both very famous for their plugins. In the case of jQuery, plugins allow developers to extend the library's capacities in order to create beautiful effects. In WordPress, they allow anyone to benefit from the work of others, as they come under the form of a module that you can easily activate from within the administration interface, and start using right away.

Creating one of those modules is not that difficult, but if you are not familiar with their syntax, it could end up being a headache. There are many jQuery plugins that have been transferred into a WordPress one already, but what can you do when it is not the case? How do you do when you have found the perfect jQuery plugin for your latest site, but it is not yet available as a WordPress plugin?

In this tutorial, we'll see how you can easily create a WordPress plugin from a jQuery one. We'll review what a jQuery, or a WordPress plugin is actually made of, so we'll find the elements they both have in common. From there, we'll show how it leads us to perform some simple operations to allow us to benefit from our jQuery plugins in a WordPress template.

Read more
@NightVlewer obligé. Je n’aurais mm pas misé 30ct dessus. 😫24 Mar / 07:23