Partial Application With Ember Getter and Setter

There is a more functional approach available for the Ember get and set methods that you may have seen or even been using, get(this, 'item') instead of this.get('item') and set(this, 'item', value) instead of this.set('item', value). When I first saw this I too wanted to write code like that in my Ember projects, after all, no one is immune to the touch of JS FP fever right? So I destructured the Ember namespace, pulled get and set into the current scope and… the end. Hope you enjoyed this article and thanks for… What? Oh you expected more did’t you? If you don’t think this article should end here then good, neither do I. Let’s take this functional syntax for get and set and give them a little extra whompff. (whompff being partial application, one of the “side-effects” of JS FP, and I won’t make anymore jokes like that I promise).

When we’re done, we’ll create a decorator function that will allow us to decorate any namespace with our Ember.get and Ember.set partial application functions. So we will be able to bring these custom utilities into any namespace, even the global namespace. If that doesn’t appeal to your good natured programming sensibilities then the decorator function can just as easily be destructured to any namespace, after all it will simply return a POJO (plain old JavaScript Object). The POJO can destructure exactly the same way as you would the Ember object in the first example below. Yeaya! Something for everybody!

import Em from 'ember';
// This is ES2015 destructuring here:
const {get, set} = Em;
// which is analogous to this:
const get = Em.get,
set = Em.set;

// Which allows us to make calls like this:
let veryAble = get(this 'inventorium');

Before getting to how we’ll customize get and set, let’s discuss quickly the pros and cons of using ES2015 destructuring (above) to lift the default implementations of these functions out from within the Ember namespace. It’s a perfectly fine choice to make, just not one I’m fond of using because it requires boilerplate at the top of any modules which make use of the get and set functions and management of those statements might become tedious.

Besides that fact I don’t want to remember to drop in destructured assignments for get and set to each file and baking those statements into my files doesn’t feel good for me personally either. Lastly, JSHint will complain wherever the get or set functions are destructured but not used within a module, spamming ye ole’ "components/super-elem.js: line 4, col 8, 'get' was defined but never used" and then what? Add some ugly inline suppressor /* jshint unused:vars */ to silence the beast? No, not on something so ubiquitous.

Continue reading to learn more ...

Review of "Grokking Algorithms: An Illustrated Guide for Programmers and Other Curious People"

Recently I read the book “Grokking Algorithms: An illustrative guide for programmers and other curious people” by Aditya Y. Bargava and published by Manning in 2016. I never read a book before checking the inside cover to see the print edition, year and publisher. The year isn’t overly critical for an introductory book into algorithms, especially one that doesn’t focus heavily on implementation. However the publisher is always important and Manning Publications delivers top quality technical reads which was the first reason I decided the book might be worth my while.

The second reason I peeked into “Grokking Algorithms: An Illustrated Guide…” was that my brain hurt, I had been working long hours writing code and felt spending more hours reading code for recreation wouldn’t be beneficial. I’d wanted to learn something useful with wide applications, reasonably new to me, challenging enough to hold my interest while also being quickly picked up and easily put down without requiring too much prerequisite knowledge. I’m demanding of my books as you too should be. I saw “Grokking Algorithms: An Illustrated Guide…” and I grabbed it with the intention of jumping to a chapter from the latter half of the book, maybe bouncing around a bit and taking in some cute illustrations. I had assumed it wouldn’t hold much more value aside from entertaining me while offering glimpses into future topics which might lead to books meeting the reading requirements above and filling time until I found that better read. I didn’t think the phrase “a picture is worth a thousand words” would hold true with illustrations in a technical book. I stand here now corrected, my assumptions all erroneous and having been withdrawn.

MA Web Developers Second Meetup (Sept 10th 2016)

Second Meetup of MA Web Developmers Water View Village, Framingham MA.

Ready for another day of code and community?

You’ve been invited! .. and also you and you and you! The next meeting of the MA Web Developers has been scheduled for Saturday September 10, 2016 from 1pm - 7pm in the awesome community room at Water View Village, Framingham MA. As before, this meetup is free and we welcome any web developers who can make the journey to drink coffee, write code, and become part of our little group.

A couple reccomendations before arriving to the meetup on September 10th would be to remember your GitHub username or email so that you choose to, you can easily access and collaborate on code with other members. If you haven’t already joined the group on, why don’t you go do that now? It’s free. If your new to web development then you might also want to join the FreeCodeCampers meetup group which was started by another one of our members and is going to be hosted in the same location (on a different day). Here’s the link to the MetroWest FreeCodeCampers Meetup Group and here is the link to this events group, the MA Web Developers.

Local Hackathon Milford MA

Web Development Hackathon at the Milford, MA Town Library.

Are you interested in web development? Would you enjoy a day building code and networking with other developers?

You are invited! There will be a day long hackathon held Monday July 25, 2016 from 2pm - 8pm in the Granite Quary room at the Milford, MA Town library. This opportunity to is free and open to New England web developers of any age and skill level. It doesn’t matter if you’ve been programming many years or if you recently your first print "Hello World!", anyone interested in developing together with other web devs from New England and who wants to get out of the July heat for a day is encouraged to come join us!

This group has been created with support and guidance from the awesome people at The group currently has participants who have attendeed Python and JavaScript courses offered through Udacity’s web development nanodegree catalog. If your just learning to write code, Udacity designs courses in hand with many top tier companies such as Google, GitHub and AT&T (just to name a few). Udacity offers up to date learning paths which you can watch at their website for free!. You don’t have to be a student or a member of Udacity to be apart of this group. This meetup is a non-profit group and encourages any local web devs who want to network new people, write fun code and enjoy an interesting day of hands on learning at the library.

Unlimited Private Repos for All Premium Github Accounts

This is some pretty cool news. GitHub now has granted unlimited private repos for any paid member. This is so awesome. If your already paying your account will automatically be adjusted to the changes so if your like me and have had to upgrade your account to accommodate your private repos I’m sure you’ll be happy to know you should have a lower Github bill this month.

Those of you who have not ever gotten the dreaded message when creating a new private repo that you were going to have to pay more money to continue should be relieved, now you’ll never have to. From here on out, all paid accounts (both personal and organizations) have unlimited private repos.

Migration From WordPress to Hexo Site Generator

A “static site generator” is an application, in most cases exposing a CLI (command line interface) to build a set of HTML, CSS and JavaScript from your website project and you serve those files as your entire site without the need for a database. No Database means no query optimizations or memcaching. An SSG generates your entire site as nothing more than a collection of front-end resources, and that equates to speed. To the users, these pages act no different than a regular blog, the posts are just “hard-coded”. If you’ve ever used server side caching on your WP site then the concept should be a bit familiar. One method of server caching does attempt to build static content over generating each piece of each page on each page load.

Hexo is a SSG (static site generator) built with Nodejs. Hexo isn’t the top dog on the SSG market, there are some wider used options like Jekyll and Octopress, both are very stable Ruby SSG’s. I chose Hexo because it seems to be building a lot of popularity and I wanted an SSG built on Node. Since the finished site is nothing but HTML, CSS and JavaScript our projects can be setup to use almost any language that compiles/transpiles into browser friendly resources. This means all the code we write will be tied to web development moreso than the language underlying the SSG. There are helper methods specific for Hexo, but in general, all SSG’s I’ve looked into use the same tech so we could easily migrate from a Nodejs SSG to a Ruby, Python or even a Go SSG…

Split CSV File Into Multiple Files Using Python

A few days ago I wrote about a small Python class which I created to merge multiple CSV files into one large file. I had tried to make it extensible a little bit. Ironically only a few days later I found myself in a situation where I needed to do the exact opposite task and split a large csv file into smaller chunks. I’m going to walk you through some of the changes thinking I went through updating the class. You can find the original article and class posted here

Append CSV Files Together With Python (Skipping Headers)

Authors Note: This code has been updated and improved upon. I won’t remove this post, but I highly suggest you use the code from the improved code in the post found here.

Last night I had a project where the client needed 30 .csv files compiled into a single sheet. I figured that I could concatenate them together using Python real quick. Python makes tasks like this fairly trivial, but I like to experiment a bit so rather than just write a loop appending each file I wrote a class to do it with some methods. It’s reusable for anyone who has a similar task. I had wanted to add a utility which would compare the headers of 1 file with the headers of the previous file but I was on the clock so I’ll save that bit for another day.

Python has a csv module but I don’t use it in this class yet. The Python csv module is really just a utility in itself to make working with CSV text files easier. Since there is no difference between a regular text file and a csv file and I know the format of the files being fed to the class I simply used Pythons open method to grab a handle to my files. I did import the csv python module though to remind me to use it when I extend this in the future.

Live Templates - Code Quicker Using JetBrains IDEs

When using an IDE such as WebStorm, PHPStorm or PyCharm we can save a lot of time by using Live Templates. They allow us to type an abbreviation such as if then press TAB and the IDE will generate an entire “If Statement” in the code. They are called “live” because they’re more than just snippets of text which are dropped into a file. The live template knows which files use which version of a snippet and will bring our cursor through each part of the template that requires customization, we can place variables in live templates as we build them later when the live template is activated it will help us customize each variable spot in the snippet. It saves much time…

WP Plugin Which Creates Posts Everytime Lines Are Added to Google Spreadsheet

One of the things which I’ve developed recently and is in active use on a couple websites at the moment is a WordPress plugin which will make posts out of lines in a spreadsheet stored on Google Drive. Doesn’t sound too impressive? What if I told you that the plugin not only handles multiple sheets, it allows the user to create headings at the top of their spreadsheet which can be used as variables in a template for each post, each sheet and template can be updated at different intervals and the plugin will even remotely fetch featured images automatically if told to use one of the fields as an image. The field to store as featured image must be a url and the plugin will download and store the image as an attachment to the new post.