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

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
How to easily integrate a PayPal Checkout with PHP illustration

PayPal is a renowned payment platform that allows you to accept online payments on your site, by taking care of all the money transactions for you. This transparency really is an appreciated quality that allows developers to integrate checkout solutions on merchant sites, by completely outsourcing the banking operations to PayPal.

Another good thing for developers is that the PayPal API is very versatile. It can be very simple if your needs are simple, or it can be very well customized to meet some more advanced needs such as complete shopping carts handling. On the other hand, I sometimes find this API not really user friendly as it works with forms, which fields are not always very intuitive. In other words, depending on the form you are building, you get a different service from PayPal.

In order to get a friendlier and also more generic solution, I wrote a PayPal manager in PHP. This tutorial will show you how you can benefit from this PHP class to integrate PayPal checkouts faster and in a much simpler way.

Read more
How to Create Native Admin Tables in WordPress illustration

WordPress list tables are a very common element of the WordPress admin interface. They are used by nearly all default admin list pages, and also often implemented by developers while writing plugins. However, creating one of those tables is not really an intuitive thing to do when you haven't done it before, and I've seen cases where people where trying to replicate one, with techniques such as using the WordPress CSS classes on personal markup, or even replicating the CSS from scratch.

In this article, we'll see how WordPress provides native functionality that can be used to generate some native admin tables. We'll have a look at a typical WordPress table and its different components, showing how it is possible to implement them the right way.

Read more
That's why I still use a mix of ES6 classes + jquery. That ticks all my criterias. Wondered if there was something more "modern" #lasttweet15 Sep / 10:34