Hack Day
This month at CareGuide, our engineering team dedicated a single, full-day to Hack Day. What is hack day you say?
Siri says:
A hackathon (also known as a hack day, hackfest or codefest) is an event in which computer programmers and others involved in software development and hardware development, including graphic designers, interface designers and project managers, collaborate intensively on software projects.
The intent of Hack Day was to allow our team to be creative, to experiement and explore. It also gave us the opportunity to work with colleagues we wouldn't typically work with. It was a great excercise to see what we could come up with when we were given freedom of direction.
Here's what we did.
JavaScript Module Support
Project Collaboration Between Aron and Lakhveer
Today, the state of the art in JavaScript is to use an advanced build tool that can manage a modular codebase. Ideally using Babel and the ES6 module syntax.
However, CareGuide's codebase up until now had been using the Rails Asset Pipeline along with Sprockets and CoffeeScript to simply concat all the JS, and rely on hanging global objects in the window
namespace.
This has a few problems. For one, you need to maintain a list of JS files that need to be in a specific and fragile order. Secondly, it's quite hard to know if a given section of code is dead. You have to rely on searching the codebase for this, which can be error-prone. Lastly, modules with nice clean APIs are much easier to test.
To accomplish this, Aron implemented Webpack. Webpack enables modules using multiple approaches (we care about CommonJS and ES6).
To enable backwards compatibility with the existing codebase, we configured the CoffeeScript loader and the Babel loader. For backwards-compatibility with the global namespace, we used Webpack's imports-loader like so: require('imports?this=>window!./old_file.coffee');
In this way the old CoffeeScript codebase and co-exist with a new Babel-based modular codebase.
Slack + Hubot
Project by Ed
Your favourite chat robot, Hubot, puts the standard Slackbot to shame. Hubot for us adds more interesting gif support for extra meme-tasitc humour, cleaner integrations for setting up stand up alarms, and a bunch of other fun things. Best of all, we can write our own integration middleware, such as being able to query how many new users we have.
I see many more little programs written for our Slack + Hubot robot. Being able to move cards around in Trello, comment on Pull Requests on GitHub, Hubots easy programmability allows for all these and more, limited by our imagination and time. I'd like to think of Slack + Hubot as a CLI tool, and move it's usefulness beyond us nerds in engineering.
Also, you should probably check out: Hubot + Pugs
Custom 404 Pages
Project by Natasha
My favorite thing about web development, is the ability to add tiny crafted experiences through out a site that delight the user in unexpected ways.
The 404 page is a commonly overlooked example. It's purpose is to convince users to remain on your site if they've mistakenly typed in the wrong url or if the page simply has been misplaced. By providing users with a header and footer navigation, you're increasing the chance of them remaining within the site and finding what they're looking for.
404 pages don't have to be boring.
Our Sitter.com 404 page
Heroku, Trello, and the Great Linter
Project Collaboration Between Jin and Chris
For our hack-day projects Chris and I worked on a way to manage Trello using git commit’s and PRs. We found a few solutions in the form of apps written to handle git web hooks. The one we chose to use was hook-to-trello, a node app which parses the commit messages sent in a git web hook for a Trello list name and card number. We cloned the repo and created a Heroku instance to run it on. After adding Trello and Git tokens to the app it was set up to handle commit’s out of the box.
Now comes the hard part. Trying to figure out how we could modify this app to do the same sort of action for PR’s. After spending way too much time on this, and looking at Ed’s work with Hubot I decided it would make more sense to instead add onto an existing Hubot script instead of using this stand alone app.
In the time remaining to us, Chris and I worked on setting up git-lint which would add a pre-commit hook to lint all modified files.
Overall, it was a fun day to break away from our schedule list of to-dos. We'll definitely try this again in the upcoming months.