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();
  5. //get links
  6. $linksmatches=array();
  7. preg_match_all('#http://[a-z0-9._/-]+#i', $text, $linksmatches); //Links
  8. $smart['links'] = reset($linksmatches);
  10. //get users
  11. $usernamesmatches=array();
  12. preg_match_all('#@([a-z0-9_]+)#i', $text, $usernamesmatches); //usernames
  13. $smart['usernames'] = reset($usernamesmatches);
  15. //get hashtags
  16. $htagsmatches=array();
  17. preg_match_all('#\#([a-z0-9_-]+)#i', $text, $htagsmatches); //Hashtags
  18. $smart['htags'] = reset($htagsmatches);
  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 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
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
My Favourite MYSQL functions illustration

For the previous years I've been trying to point out the areas of my workflow that were taking most of my time to try to optimise them.

One of these areas was database interactions meaning the famous 'SELECT', 'INSERT', 'UPDATE' and 'DELETE' statements. When I was still discovering PHP, I spent far too much time hard coding every single database query. It was time consuming, but also very annoying.

Then, for a project, I discovered Zend, a powerful PHP framework. I loved the way it handled the queries, by having a database class with predefined methods for each interaction. The only problem was that Zend is far too bulky and complicated for simple projects.

After investigating if there were easier ways of achieving the same results, I am presenting here today a list of my favourites mysql functions, with their brief description and how you can use them. I hope that it will save you time in your future developments like it did for me.

Read more
@Bentoutif Il occupe tout le monde afin que pendant ce temps on parle moins des résultats moyens de l'OL. A la Mourinho. Et ça marche.20 Sep / 09:12