Automating the whole process instead of fixing the printer

This morning, my wife asked me to fix the printer so that she could print some forms. Sure, I could have spent a few minutes fighting with printer drivers and what-not, but I hate printing and printers – They seriously stab at my soul.

So my solution was to automate her whole process instead.


If you remember the MadLib notepads you had as a kid, then this will be very familiar to you.

Mad libs

MadLibs – shared under Fair Use

The premise is that you have a story with words cut out by type.

For example, “_______ (person in the room) is an excellent _______ (job / profession) who once _______ (verb) a/an _____ (noun) with his/her bare hands”

There would be a separate page with the following form, and while filling it out you can’t see how the words will fit into the final narrative shown above.

Person in the room   _________
Job / Profession _________
Verb _________
Noun _________

Once completed, the form might look like this…

Person in the room   George
Job / Profession fireman
Verb impaled
Noun shark

Then you transfer the words into the narrative from earlier and you get the unusual story of George the fireman who impales sharks.

George is an excellent fireman who once impaled a shark with his bare hands”


Since I was unsure of her internet access at the location of the event, I needed to build something that was completely self-contained and did not need internet access while it was running. She has a Mac, so slapping together a WPF app wasn’t a straightforward option without installing a VM.

I’ve been learning Node.js in my spare time (since @chimon1984 thinks it might catch on one day), so this was a perfect real-world scenario for me. I had about an hour to time-box the project and set off to code it up in my pajamas on a Saturday morning.

The technologies used are all free and very simple to install and get running with. I’m assuming Linux or OS X, but it could be made to run on Windows without many additional steps.

If you want to check out the code and try it yourself, hop on over to the GitHub where I’ve posted the code. Feel free to use it any way you like, as it has a standard MIT license and submit Pull Requests for improvements and updates. There’s a todo.txt section with things I might add to it as I have free time (whenever that mythical time might be).

Cherry picking commits with GIT

daftpunktocat-thomas
I have a project in which I’m maintaining both a beta and a release branch. Bugfixes need to be applied to both branches, except in cases where the bug has already been fixed in the release branch, in which case it would only need to be addressed in the beta branch.

Yesterday I ran into a case where I wanted to just merge a single commit from “beta” to “release” in order to apply a fix from “beta” directly to “release.”

It Kind of blew my mind how easy this was…

 
Mind Blown!


 

1. Find the commit you want to take from the source branch beta. In this case its hash was af19aadbcfa61d2d2816307044318d637d35cee5.

git log

2. Switch to the branch where you want to apply the commit.

git checkout release

3. Apply the commit from dev as a new commit of equivalent changes to the beta branch.

git cherry-pick af19aadbcfa61d2d2816307044318d637d35cee5

4. Resolve any merge conflicts(this may happen automatically if no conflicts)

git mergetool

5. Commit (this may happen automatically, I forget)

git commit

6. Push your changes to your GIT remote.

git push

Commit in beta [insert image a]

Commit in release [insert image b]

Charts and explanation stuffs

You can also string these together to apply more than one commit at a time, but that’s content for another post.

In addition to not imploding our universe into a parallel one with talking sheep, this just worked as expected. Slightly shocking…

Happy GITing.