Evernote to Blog Post

Today I learned how to publish our TIL posts directly to our blog, straight from my favorite text tool, Evernote .

We are simply making the connection with one of our go-to’s, Zapier . The concern with this integration is that our zap is searching for new notes every 15 minutes, so you would need to be aware of this as it relates to how you draft your content. For example, if you create a new post, and need to go back and edit this note beyond a 15 minute time frame, you run the risk of posting a partial blog post (depending on your Evernote sync settings). Therefore, we still have some tweaking to do to establish versioning workflow. For the time being, I will likely draft in my main notebook, and dump in my TIL notebook when ready to ship. Future versions will also need to handle images, as these are not included on my zap yet.

Additionally, we will need to handle code better in the future. Evernote has released a beta feature of a “Code Block,” which has to be manually be turned on in order to use, however, the zap is not pulling this in to the blog post. You can access it in the preferences: http://take.ms/6e0up

Overall, this is massively helpful in meeting our goal of using TIL as a repo, not a marketing tool.

Here is a random code snippet:

<div class="ipsType_normal ipsType_richText ipsContained" data-role="commentContent" data-controller="core.front.core.lightboxedImages">
<div class="ipsQuote_citation ipsQuote_open">  <a href="#" data-action="toggleQuote"> </a>     <i class="fa fa-share"></i>    On 2/19/2016 at 10:16 AM,   <a href="//discussion.evernote.com/?app=core&amp;module=members&amp;controller=profile&amp;id=102218" data-ipshover="" data-ipshover-target="//discussion.evernote.com/?app=core&amp;module=members&amp;controller=profile&amp;id=102218&amp;do=hovercard">bootislands</a> said:</div></blockquote>

Recursion in Elixir

Coming from an object oriented language with data mutability, learning looping in Elixir required that I let go of my current understanding about iterating over a collection. In fact, just forget looping and think recursion. So, what’s recursion?

Recursion is solving a problem whereby one applies the same solution to smaller instances of that problem. Think, a function calling itself. So, here is what it looks like in Elixir:

defmodule Recursionism do

  def operate_on_list_items([], _) do

  def operate_on_list_itmes([head | tail], fun) do
    [fun.(head) | operate_on_list_items(tail, fun)]

Recursionism.operate_on_list_items([1, 2, 3], fn(n) -> n * n end)

Let’s break this down:

  • First we define a multi-clause function called Recusionism.operate_on_list/2. Multi-cause functions are multiple functions of the same name and arity that are executed depending on the matching of the arguments.
  • Then, when we call Recusionism.operate_on_list_items([1, 2, 3], fn(n) -> n * n end), it matches the second multi-clause function definition and executes it.
  • That second function, uses the anonymous function (it’s second argument) to operate on the first item in the list (head). The result of applying the anonymous function (fun.(head)) becomes the first item in a new list.
  • In order to complete the list, the operate_on_list_items function calls itself by passing all the remaining items in the original list (tail) as the first argument, along with the same anonymous function as the second argument.
  • When there are no more items in the list, calling operate_on_list_items matches the first multi-clause function definition and returns an empty list, thereby stopping the recursion.
  • The end result is building a list by doing [1 | [4 | [9 | []]]], which evaluates to [1, 4, 9]

Angular 1.x Dropdown Menus
(Removing The Blank Option)

Over the past week I kept running into the issue of iterating over an array or an object in a <select> field with ng-repeat, only to find that I had a blank option as the first item in the dropdown.  After trying several strategies, I finally found one that worked.

Let’s say you want to iterate over the array ctrl.items in your <select> field.


(function() {
  'use strict';

  function SomeController() {

    var ctrl = this;

    // item array for dropdown
    ctrl.items = [
        select: 'data1',
        label: 'Option 1'
      }, {
        select: 'data2',
        label: 'Option 2'
      }, {
        select: 'data3',
        label: 'Option 3'


    .component('someComponent', {
      controller: SomeController,
      templateUrl: '/app/components/some.component.html',

Instead of using ng-repeat, this can be accomplished with ng-options.

ng-options Pattern Usage: select as label for value in array


<select name="selectName"
        ng-options="item.select as item.label for item in $ctrl.items">

  <!-- this option sets the dropdown placeholder -->
  <!-- value must be an empty string for this to work -->
  <option value="" selected="selected">Select an Item</option>

Where: select: value that will be submitted or bound to the model of the parent label: each <option> shown in dropdown list value: local variable for each array item or object property value being iterated over.

You can find more ng-options usage patterns in the AngularJS API Documentation

Efficient Object Oriented Design with UML Sequence Diagrams

So, you have a feature to write. Now what? Do you start coding right away and hope for the best? Hopefully not. Here’s an example of using a Universal Modeling Language (UML) Sequence Diagram to plan a feature.


In this example, User calls the create() method on Post, which in turns calls the send() method on the Messenger class. The dotted line is called the object’s Lifeline. The part of the Lifeline that is wider, is where the object is active.

What are the benefits of a sequence diagram? It turns the focus from the objects themselves to the messages that pass between them. You can see what public interfaces you’ll need to implement. As Sandi Metz writes in her book, Practical Object-Oriented Design in Ruby, this process can also reveal ‘hidden objects’ – object you didn’t know you needed. If you do TDD, you also know what tests to write. What happens if you make a mistake? Just fix the diagram. It’s a lot cheaper than fixing code.