What is this?

Created by @davely

A realtime list of recent tweets that mention various Major League Baseball teams that automatically refreshes ever 30 seconds. By default, this searches for any any tweet that mentions one of the official Twitter accounts for an MLB team. There are additional options to filter by team and the script will search for mentions of the team, and in some cases certain players (e.g., Hunter Pence on the Giants and Yasiel Puig on the Dodgers).

Why did you do this?

One of my goals for 2015 was to learn more about coding and do more of it. As of late, I’ve been really focused on working with JavaScript. It follows up on an earlier project that I was working on (solving Sudoku puzzles using JavaScript).

This goal of this project was to rapidly build out a web app that could search and parse publicly available data (e.g., tweets!) for mentions of particular baseball teams while using various jQuery and JavaScript libraries. I could see this app having potentially wider uses beyond baseball such as returning the latest tweets from an event or hashtag.

Libraries and frameworks used
  • Skeleton - Used as a responsive boilerplate to rapidly build out the site and make sure it worked on both desktop and mobile devices.
  • bbclub-font - An open source project that displays scalable team logos from all 30 MLB teams.
  • jPushMenu - jQuery plugin to easily add the side menu that slides in from the left and allows users to choose a proper team.
  • Livestamp.js - jQuery plugin to provide auto-updating time ago text (e.g., posted 5 minutes ago)
  • Moment.js - Parse, validate, manipulate, and display dates that were returned from the Twitter API.
  • TwitterOAuth - Validate your developer token with Twitter and access its API through PHP.

Other helpful sources: