Friday, May 22, 2015

First open source contribution!

Our instructor at NSS has been having us concatenate our Bower dependencies for site deployment using a handy program called "bowcat" (Bower-concatenate..?). Check it out here:


and here:


Some confusion arose when we started including the Firebase package as a Bower dependency, however-- it took a while to get at the root of the problem, but it boiled down to: we'd been running sh scripts that ran bowcat with its --min option, which will concatenate minified versions of the dependencies it finds. Turns out that Firebase doesn't have a minified version, and so bowcat hadn't been including it in the concatenated file it was generating.

Npm packages are written in Node ("Node Package Manager"), and Node is Javascript. So hey, seemed like I could probably figure something out.

Four lines and a pull request later, and I've made my first open source contribution! I just had bowcat rerun its filename-gathering procedure sans the --min option if it wasn't coming up with any files for a particular package (it does this on a per-package basis).

It's pretty thrilling to have contributed something (albeit small, but gotta start somewhere) that really gets used by people. I hope that one day I'll be able to say that it was the first of many such contributions.

Thanks to AjayMT!

Tuesday, May 5, 2015

Raspberries

Sure enough, today's work involved making the stock page delete entries from both its table and the database that it uses to make the data persist.

Finished that part before lunch!

The rest of the time I worked on using regular expressions to check for bad user input, made some elements fade in/out, etc. All around a much better make-believe investment experience.

http://codepen.io/johnwquarles/pen/ZGbeOy

This one is actually at a different codepen URL from the last entry; I wanted to start working from a new copy in case I broke something. I should really make proper files and put these on github... will get on that soon.

In other news, I went to an introductory Internet of Things workshop tonight and learned to collect temperature/magnetic switch information using a Raspberry Pi, which I then (paid for and) took home! So I'll be looking to get into some interesting or perhaps just silly hardware stuff soon. Big props to Nashville's own Initial State and Jamie Bailey for putting on the workshop.

setting up


Bonus pic from Hack Tennessee:

Your very own Q, of the eponymous Dev Dive on the left, talented classmate James on the right.

Hack Tennessee 7

In addition to the aforementioned apps that I worked on last week and today, I also spent my weekend at Hack Tennessee. It was a tremendous experience and did a lot to make this all feel more "for real"-- I worked with employed developers and contributed to a complete Rails project that is now finished and on the web:

http://www.snacktn.com/
Many NSS students and former students were involved in its creation. The concept came from Ayumi Bennett, an NSS cohort 8 student (I'm cohort 9)-- it's a way to browse and learn about local foods made in Tennessee. The backend (Ruby on Rails) was handled by Robert Fryman and he also served as the project manager-- really knew his stuff, made sure that the rest of us were able to follow along with what was going on with the backend, and made absolutely sure that everyone had something to contribute to. Great experience working with him and the rest of the group.

I enjoyed working with Rails given that it was what I was studying before diving headfirst into all the frontend tech. at NSS (after which we'll do Node.JS); I'd hoped that I'd be able to remember enough to be useful, and ultimately, I was! I made the layout & buttons that appear when you click one of the four main buttons or "view subcategories"-- basically, wherever you see the blue boxes that grow a bit when you hover over them.

http://www.snacktn.com/


The big learning experiences for me were getting all the gems installed, working with postgresql and using git for a project with this many contributors. These were all pretty new to me and definitely things that I need to get familiar with. I also wrote html.erb files for the first time in quite a while, which took some time to remember but was ultimately quite straightforward.

Had a great time! The winner of the event was a virtual-reality psychedelic unicycle game. Which, I mean, was inevitable from the moment it was announced. Also its presentation was fantastic-- I don't remember the gentleman's name, but he had a Jobs-esque way of making me feel that I needed his product in my life.

Monday, May 4, 2015

App work

I'm really happy with how much work I'm getting to do; we've been going at a pretty good clip in class and have either made or iterated on a front-end web app about once per day.

My creations so far are the renamed ArMoleGeddon:


http://s.codepen.io/johnwquarles/debug/NqPoEo?

A weather app that makes a JSON request to the Weather Underground API to retrieve info for a particular ZIP code, or can detect the user's geolocation via the browser and include it in the JSON request instead of the ZIP:

http://s.codepen.io/johnwquarles/debug/ZGGQRj?

A stock application that I amused myself with by naming "Stocksbocks", etc. This one pulls quotes for particular stock symbols, and then pretends to let you buy shares while generating a table that tracks your imaginary investments. That was the first part-- today we needed to have the table save itself to a Firebase database and then re-write that data with each new pageload. So any stocks you "buy" will remain there unless I go in and delete the data through Firebase. Have fun! This was an interesting exercise in that the quantity attribute for each stock purchase doesn't come from the markitondemand (stock price) API-- it's entered in by the user, so in order to save *all* of the table's data to Firebase, I had to generate a new data object, include the quantity, and write it.

Which becomes a problem given that the writeTableRow function that I'd written wants to pull that quantity value from the text input HTML element, but we now need it to pull quantity from the data object written earlier and pulled from Firebase upon an intial pageload. Nothing too heavy, but it involved short-circuit evaluations in order to deal with edge cases (if there's no data in the database, there's no object to check for a quantity attribute and Javascript will throw an error; need to use && to make sure there's an object, and if there is, check for its quantity attribute) and to choose what kind of data we're writing (check for the presence of a data object passed in as an argument, using && as above; if we have it, use its quantity attribute, and if we don't (ie, it evaluates to falsey), it means that we're writing in info that the user has requested instead of loading/writing data from Firebase, and we should include/write the quantity as specified in the HTML input.

Then we changed all of the Javascript selectors and methods (that we could) to jQuery in order to learn more about jQuery.

Whew! In any case it all worked out, which you can verify below. Only thing remaining is to check for and catch user input errors in the quantity text input (it's already working for the stock symbol input). Oh, and if you make multiple purchases of the same stock, it doesn't combine them into a single line in the table. That would be good to add.

http://s.codepen.io/johnwquarles/debug/LVpVOG?
http://s.codepen.io/johnwquarles/debug/LVpVOG?