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

Creating a simple image gallery with PHP & jQuery illustration

An image gallery is a very common feature for a website to have. It is an efficient way to nicely present a set of pictures. With the increasing popularity of JavaScript plugin, image galleries are nowadays implemented with rich features, effects, and transitions, in order to emphasize the given content.

When you wish to create a picture gallery, there are several steps involved in the process. In this tutorial, we will see how you can set everything up, and then add, remove, or edit pictures in your gallery, in a simple and dynamic manner. Finally, we will explain how we can setup the jQuery lightbox plugin in order to work with our pictures.

What are the benefits of this solution? This methods is sooo easy to setup, but still achieves quite a lot. Little efforts, great rewards. You only have to put your images in a folder, and give that folder path to the class. You also tell the class how big you want your pictures to be, and it handles all the hard work for you. Just by calling a method, you can see your gallery on the page. So if you are looking for a fast and convenient way to put an image gallery on a site, read on.

Read more
How to create an Ajax, validated form illustration

Even on some very famous websites and blogs based on the WordPress platform, such as Smashing Magazine or Webdesigner Depot for example, the comment forms are not checked prior to submission. Which means that if the user hits the submit button without actually filling any information, he is redirected to the famous error: "Error: please fill the required fields (name, email).".

Thanks to jQuery and its plugins, it is possible to change the way those forms are handled, in order to obtain slick effects, and an overall better user experience.

In this tutorial, we'll associate the validation plugin, and the form plugin, to get a contact form that is validated before submission, and submitted via ajax. Why don't you give it a try?

Read more
Standardizing development environments with Vagrant illustration

This is the first article of a series in which we'll explain our development process industrialisation. We'll describe how we went from a team of individuals doing things together but artisanally, to a more industrial and qualitative approach. This first topic talks about how we standardized our development environments with Vagrant.

Read more
@marcelpociot @botman_io Sure, I've got big plans. Do you think I should hold until the botman 2 release? (When wou… https://t.co/gPNvCY7Hzu20 Jul / 09:54