<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>George Shank</title>
		<description>Do everything with love and patience.</description>		
		<link>https://georgeshank.com</link>
		<atom:link href="https://georgeshank.com/feed.xml" rel="self" type="application/rss+xml" />
		
			<item>
				<title>Getting Started With Erlang (Part 1 - Semantics)</title>
				<description>&lt;p&gt;I’ve recently decided to start learning &lt;a href=&quot;http://erlang.org&quot;&gt;Erlang&lt;/a&gt; and I’ve always felt the best way to learn something is to teach others. My favorite style of teaching is pairing and face to face instruction but I don’t have any mentees nearby interested in Erlang so I’ve decided to use blogging as a way of helping others and hopefully solidifying these concepts for myself. Erlang’s syntax is very interesting and a little alien so bear with me as I try to make sense and explain the mechanics. That being said, let’s get on with the post!&lt;/p&gt;

&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
&lt;p&gt;I won’t spend too much time talking about installing Erlang other than to say I’m using a Mac and you can install with &lt;a href=&quot;http://brew.sh&quot;&gt;Homebrew&lt;/a&gt; simply by running the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brew install erlang&lt;/code&gt; command. Erlang should be available for most Linux distributions as well.&lt;/p&gt;

&lt;h2 id=&quot;the-repl&quot;&gt;The REPL&lt;/h2&gt;
&lt;p&gt;Erlang comes with a &lt;a href=&quot;http://en.wikipedia.org/wiki/Read–eval–print_loop&quot;&gt;REPL&lt;/a&gt; that you can start up with the command &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;erl&lt;/code&gt;. You can run simple arithmetic like most REPL’s such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2 + 2&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(5 + 3) * 2&lt;/code&gt; but the key thing to remember is &lt;em&gt;almost&lt;/em&gt; every Erlang statement must end with a period(&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.&lt;/code&gt;). Here’s an example of some basic commands.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;%&amp;gt; erl
Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V6.3  (abort with ^G)
1&amp;gt; 2+2.
4
2&amp;gt; (5 + 3) * 2.
16
3&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You’ll use the REPL to compile and run your different Erlang programs. Speaking of which let’s create a new simple program now.&lt;/p&gt;

&lt;h2 id=&quot;modules&quot;&gt;Modules&lt;/h2&gt;
&lt;p&gt;Each Erlang file describes a module and exports the functions necessary to interact with it. The module name needs to match the file name so if you create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hello-world.erl&lt;/code&gt; you’ll need to name the module &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hello-world&lt;/code&gt; in the program, like this:&lt;/p&gt;

&lt;div class=&quot;language-erlang highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;&apos;hello-world&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Notice the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.&lt;/code&gt; at the end; it’s important to end all statements like that. Don’t worry if you forget though because the compiler will let you know something is funny and give you tips on how to correct it. Now you can hop in the REPL and compile your file:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1&amp;gt; c(&apos;hello-world&apos;).
{ok,&apos;hello-world&apos;}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Awesome, we got a &lt;a href=&quot;http://en.wikipedia.org/wiki/Tuple&quot;&gt;tuple&lt;/a&gt; back saying &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ok&lt;/code&gt; and the name of the module we just compiled. If our file name didn’t match up with our module name the compiler would have thrown an error. If instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-module(&apos;hello-world&apos;).&lt;/code&gt; I had written &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-module(&apos;goodbye-world&apos;).&lt;/code&gt; the compiler would have said something like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;5&amp;gt; c(&apos;hello-world&apos;).
hello-world.beam: Module name &apos;goodbye-world&apos; does not match file name &apos;hello-world&apos;
error
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When we successfully compiled the file notice how &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ok&lt;/code&gt; isn’t surrounded in single quotes? &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ok&lt;/code&gt; is what’s called an atom. In fact, so is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&apos;hello-world&apos;&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;atoms&quot;&gt;Atoms&lt;/h2&gt;
&lt;p&gt;Atoms are literal constants within Erlang and can be passed around as an expressive piece of information. Atoms can either be described using words starting with a lowercase letter or surrounded in single quotes to use capital letters and non-alphanumeric characters. Here are some examples of atoms:&lt;/p&gt;

&lt;div class=&quot;language-erlang highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cat&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;&apos;Marmalade&apos;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;&apos;hello-world&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Atoms don’t hold a value, they simply provide a consistent expressive way for representing information. They’re closely related to &lt;a href=&quot;http://en.wikipedia.org/wiki/Enumerated_type&quot;&gt;enums&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Symbol_(programming)&quot;&gt;symbols&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;functions-and-variables&quot;&gt;Functions and Variables&lt;/h2&gt;
&lt;p&gt;So we’ve compiled our first Erlang file but it doesn’t do anything yet. Let’s create a simple function to double a number’s value. Function names, much like atoms, are defined starting with a lowercase letter with some parameters defined.&lt;/p&gt;

&lt;div class=&quot;language-erlang highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;myfunc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;SomeVar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Variables on the other hand begin with an uppercase letter. Not only that but a variable can only be defined &lt;strong&gt;once&lt;/strong&gt;. This one of many properties in Erlang that make it a &lt;a href=&quot;http://en.wikipedia.org/wiki/Functional_programming&quot;&gt;functional language&lt;/a&gt; and is included to remove the possibility of &lt;a href=&quot;http://en.wikipedia.org/wiki/Side_effect_(computer_science)&quot;&gt;side-effects&lt;/a&gt;. If you want to save the result of a calculation you’ll need to store it in a new variable.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;11&amp;gt; MyVar = 3,
11&amp;gt; MyOtherVar = MyVar + 3.
6
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;See that comma I threw in there? When you’re building a function the period is for the very end of the function and commas are used to separate statements leading up to the final statement. We’ll talk more about that later, for now let’s go ahead and create our double function.&lt;/p&gt;

&lt;div class=&quot;language-erlang highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;&apos;hello-world&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;Val&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s fairly simple isn’t it? We created a function that accepts a value and assigns it to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Val&lt;/code&gt;. We then multiply it by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2&lt;/code&gt;. Notice that we don’t have to explicitly call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;return&lt;/code&gt;. Erlang implicitly returns the last evaluated expression from each function. We could even do this:&lt;/p&gt;

&lt;div class=&quot;language-erlang highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;&apos;hello-world&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;DoubledValue&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Val&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;DoubledValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There’s that comma again, separating the first statement from the last. As I said before, the comma says there are more statements to come, I’m not yet done processing. Also this time we return the value by simply putting the result as the last statement. Erlang will evaluate and return it just the same.&lt;/p&gt;

&lt;p&gt;This function is looking pretty solid and all that’s left is to export it so it can be used. You’ll use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-export()&lt;/code&gt; statement to do that.&lt;/p&gt;

&lt;div class=&quot;language-erlang highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;&apos;hello-world&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]).&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;DoubledValue&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Val&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;DoubledValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-export&lt;/code&gt; takes an array of function definitions you would like to export. Function names need to be accompanied by their &lt;a href=&quot;http://en.wikipedia.org/wiki/Arity&quot;&gt;arity&lt;/a&gt; which is the number of arguments they accept. Functions with the same name but different arity are considered completely separate. Now that we’ve exported &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;double&lt;/code&gt; we can compile the file and use the function.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;18&amp;gt; c(&apos;hello-world&apos;).
{ok,&apos;hello-world&apos;}
19&amp;gt; &apos;hello-world&apos;:double(3).
6
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Success!&lt;/p&gt;

&lt;p&gt;That’s all I’ll write for this installment but if you like what you’ve seen so far you can &lt;a href=&quot;https://twitter.com/taterbase&quot;&gt;follow me on Twitter&lt;/a&gt; or &lt;a href=&quot;http://georgeshank.com/feed.xml&quot;&gt;subscribe to my RSS feed&lt;/a&gt; and you’ll know when the next blog post in this Erlang series gets posted.&lt;/p&gt;
</description>
				<pubDate>Fri, 09 Jan 2015 00:00:00 +0000</pubDate>
				<link>https://georgeshank.com/getting-started-with-erlang-part-1</link>
				<guid isPermaLink="true">https://georgeshank.com/getting-started-with-erlang-part-1</guid>
			</item>
		
			<item>
				<title>Composing Your Solution</title>
				<description>&lt;p&gt;In the past couple weeks I’ve been writing a few different modules and publishing them to &lt;a href=&quot;https://npmjs.org&quot;&gt;npm&lt;/a&gt;. When I’m writing new code to solve a problem I often end up coding together some functionality and releasing a singular module however this time around I tried to do things a little differently. Instead I tried to sit down and break out each individual piece of my solution (similar to what’s often referred to as the &lt;a href=&quot;http://substack.net/many_things&quot;&gt;substack pattern&lt;/a&gt;). What pieces could I work on separately that would have value and merit on their own? The result was 3 individual modules with each one being a composition of the last. Breaking out my solution like this did a few things that I think are big wins when programming:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;I made my problem’s surface area smaller by identifying tinier problems (and easier wins)&lt;/li&gt;
  &lt;li&gt;I made useful pieces of my solution available for others to compose into other potential solutions&lt;/li&gt;
  &lt;li&gt;My github activity bar is looking awesome&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;##The Problem
The problem I set out to solve was how to keep &lt;a href=&quot;http://dat-data.com&quot;&gt;dat&lt;/a&gt; (a project with the goal of streamlining data transfer between any and all data stores or file formats) in sync with &lt;a href=&quot;http://mongodb.org&quot;&gt;MongoDB&lt;/a&gt;. Doing a single import had been solved by &lt;a href=&quot;https://npmjs.org/package/mongs&quot;&gt;mongs&lt;/a&gt; but there was no existing way to keep that import up to date with changes in Mongo. Having identified my problem I broke it out into smaller problems.&lt;/p&gt;

&lt;p&gt;##Oplog Docs
The first tinier problem was translating &lt;a href=&quot;http://docs.mongodb.org/manual/core/replica-set-oplog/&quot;&gt;Mongo’s oplog&lt;/a&gt; documents into actions that can be performed on any object. Mongo utilizes the oplog to translate changes in the primary to its secondaries keeping them in sync. The syntax of these JSON documents is little peculiar at first but they provide information about document updates, inserts, as well as deletes. Essentially everything you need to make the same changes to a document that lives outside of Mongo as well. I built &lt;a href=&quot;https://npmjs.org/package/oplog-transform&quot;&gt;oplog-transform&lt;/a&gt; to take oplog documents, turn them into functional expressions, and apply those changes to any JSON object you want.&lt;/p&gt;

&lt;p&gt;##Tailing the Oplog
Now that we can translate oplog docs we just need to hook up to the oplog and tail it to perform these changes in real-time. I created &lt;a href=&quot;https://npmjs.org/package/oplog-transform-tail&quot;&gt;oplog-transform-tail&lt;/a&gt; to do just that. It’s a simple composition of the great &lt;a href=&quot;https://npmjs.org/package/mongo-oplog&quot;&gt;mongo-oplog&lt;/a&gt; lib as well as oplog-transform. We’re already reaping the benefits of breaking these pieces out by being able to build them up in new useful ways.&lt;/p&gt;

&lt;p&gt;##Wrapping up
Finally we can solve the overarching problem we set out for in the beginning, syncing dat with MongoDB, and the result is &lt;a href=&quot;https://npmjs.org/package/dat-oplog&quot;&gt;dat-oplog&lt;/a&gt;. Dat has hooks you can plug into with your own functionality and dat-oplog makes use of &lt;a href=&quot;https://github.com/maxogden/dat/blob/master/docs/js-api.md#hooks&quot;&gt;listen&lt;/a&gt;. Now using oplog-transform-tail we can push updates to dat every time a document changes in Mongo.&lt;/p&gt;

&lt;p&gt;The code needed to create dat-oplog was relatively small since we can leverage the previous modules. Each module being responsible for its own functionality keeps the individual code bases small which can reduce bugs and increase transparency into what is happening. Building a solution this way has a lot of advantages and I think it’s a worthwhile exercise when tackling any large problem.&lt;/p&gt;
</description>
				<pubDate>Wed, 22 Oct 2014 00:00:00 +0000</pubDate>
				<link>https://georgeshank.com/composing-a-solution</link>
				<guid isPermaLink="true">https://georgeshank.com/composing-a-solution</guid>
			</item>
		
			<item>
				<title>How to Enable a MongoDB Replica Set on Travis</title>
				<description>&lt;p&gt;&lt;a href=&quot;https://travis-ci.org&quot;&gt;Travis&lt;/a&gt; is a fantastic resource for developers building 
open source projects since they provide free build servers to run your tests automatically.
Every time you push new code to your repos on &lt;a href=&quot;https://github.com&quot;&gt;Github&lt;/a&gt; Travis can pull down
the changes, run the tests, and update you when they fail. It also works with just about every 
imaginable language and provides quite a few databases out of the box.&lt;/p&gt;

&lt;p&gt;When setting your project up for Travis a basic config can often work pretty well but sometimes you 
need something a little more custom. I like to use Travis for most of my projects so while I was building 
&lt;a href=&quot;http://npm.im/oplog-transform-tail&quot;&gt;oplog-transform-tail&lt;/a&gt; (a node module that keeps your MongoDB data in sync with a secondary data store in real time)
I went ahead and created a somewhat standard Travis config file for a node project using MongoDB.&lt;/p&gt;

&lt;p&gt;That looks something like this:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#.travis.yml&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;node_js&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;node_js&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0.11&quot;&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0.10&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mongodb&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This config just says that we’re using node, we want to test on version &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0.10&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0.11&lt;/code&gt;, 
and under &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;services&lt;/code&gt; we say we want access to a MongoDB database. The problem with this
setup is &lt;a href=&quot;http://npm.im/oplog-transform-tail&quot;&gt;oplog-transform-tail&lt;/a&gt; requires access to
&lt;a href=&quot;http://docs.mongodb.org/manual/core/replica-set-oplog/&quot;&gt;MongoDB’s oplog&lt;/a&gt;. By default
MongoDB starts as a single server with &lt;strong&gt;no&lt;/strong&gt; replica set and as such does not utilize the oplog.&lt;/p&gt;

&lt;p&gt;To turn this feature on we just need to guide Travis a little bit and tell it to set our MongoDB
up as a &lt;a href=&quot;http://docs.mongodb.org/manual/core/replication/&quot;&gt;replica set&lt;/a&gt;. Luckily Travis has a few &lt;a href=&quot;http://docs.travis-ci.com/user/build-lifecycle/&quot;&gt;lifecycle entrypoints&lt;/a&gt; that we can
take advantage of to do just that. Our use case just needs to happen before the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;script&lt;/code&gt; event (when the tests get run) 
so we’ll use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;before_script&lt;/code&gt; hook to make the changes ensuring our database is set up properly for testing.&lt;/p&gt;

&lt;p&gt;Here’s our new config for Travis:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#.travis.yml&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;node_js&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;node_js&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0.11&quot;&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0.10&quot;&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mongodb&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# make mongodb a replica set&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;before_script&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;echo &quot;replSet = myReplSetName&quot; | sudo tee -a /etc/mongodb.conf&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;sudo service mongodb restart&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;sleep &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;20&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mongo --eval &apos;rs.initiate()&apos;&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;sleep &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Let’s talk about what this does.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo &quot;replSet = myReplSetName&quot; | sudo tee -a /etc/mongodb.conf&lt;/code&gt;
Here we append a string to the MongoDB config file, telling it set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;replSet&lt;/code&gt; name to myReplSetName. This is all that’s required for basic replica set initialization.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo service mongodb restart&lt;/code&gt;
Now we restart MongoDB so it can use the new config&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sleep 20&lt;/code&gt;
Sometimes the database can take a while to reboot, we sleep 20 seconds here to make sure it’s ready for the next step&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mongo --eval &apos;rs.initiate()&apos;&lt;/code&gt;
Here we tell MongoDB to evaluate our command, in this case &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rs.initiate()&lt;/code&gt; which tells MongoDB to start up the replica set functionality.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sleep 15&lt;/code&gt;
Here we sleep for another 15 seconds to give MongoDB a chance to properly set up the replica set.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And there you have it, now the MongoDB instance is running as a single server replica set and will write operations to the oplog allowing the tests a chance to run properly.&lt;/p&gt;
</description>
				<pubDate>Tue, 14 Oct 2014 00:00:00 +0000</pubDate>
				<link>https://georgeshank.com/how-to-enable-a-mongodb-replica-set-on-travis</link>
				<guid isPermaLink="true">https://georgeshank.com/how-to-enable-a-mongodb-replica-set-on-travis</guid>
			</item>
		
			<item>
				<title>Keeping Elasticsearch Springy</title>
				<description>&lt;blockquote&gt;
  &lt;p&gt;While elasticsearch is quick to set up the initial configuration is not quite production ready. In this post I would like to lay out some simple tweaks you can perform to get a consistent reliable search cluster up and running.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I wrote a &lt;a href=&quot;https://web.archive.org/web/20130921162948/http://tech.i.tv/09-10-2013/keeping-elasticsearch-springy&quot;&gt;blog post&lt;/a&gt; about some small performance tweaks you can do with &lt;a href=&quot;http://elasticsearch.org&quot;&gt;elasticsearch&lt;/a&gt;.&lt;/p&gt;
</description>
				<pubDate>Tue, 10 Sep 2013 00:00:00 +0000</pubDate>
				<link>https://georgeshank.com/keeping-elasticsearch-springy</link>
				<guid isPermaLink="true">https://georgeshank.com/keeping-elasticsearch-springy</guid>
			</item>
		
			<item>
				<title>Partial Application with JavaScript</title>
				<description>&lt;p&gt;If you haven’t heard &lt;a href=&quot;http://en.wikipedia.org/wiki/Functional_programming&quot;&gt;functional programming&lt;/a&gt; is all the rage these days. One of the more interesting aspects of functional programming is something called &lt;a href=&quot;http://en.wikipedia.org/wiki/Partial_application&quot;&gt;partial application&lt;/a&gt; which essentially comes down to pre-loading arguments in a function.&lt;/p&gt;

&lt;p&gt;But George, if I’m going to pre-load functions with variables why don’t I just use regular instance variables instead. Well, that’s silly and a good way to write more boilerplate or even duplicate code. When you’re using a language that supports &lt;a href=&quot;http://en.wikipedia.org/wiki/Higher-order_function&quot;&gt;higher order functions&lt;/a&gt; you should really take advantage of partial application (or &lt;a href=&quot;http://stackoverflow.com/questions/36314/what-is-currying&quot;&gt;&lt;del&gt;currying&lt;/del&gt;&lt;/a&gt; actually, partial application and currying are not the same, &lt;a href=&quot;http://raganwald.com/2013/03/07/currying-and-partial-application.html&quot;&gt;Raganwald explains&lt;/a&gt;) to make your code more polymorphic. Essentially it gives you more value from your function. Enough gibber gabber, let’s write some code!&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sendMessageTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;sendMessageTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;George&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;clean your room!&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//George, clean your room!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So what I’ve just done here in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mom.js&lt;/code&gt; is created a function that addresses a console.log to a name with a message. Super complex stuff. I then had it tell me to clean my room (over my dead body mom). But say, what if we wanted to tell me more than one thing. Like do the dishes, mow the lawn, perhaps even a bit of laundry?&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;sendMessageTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;George&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;do the dishes&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//George, do the dishes&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;sendMessageTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;George&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;mow the lawn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//George, mow the lawn&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;sendMessageTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;George&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;do the laundry&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//George, do the laundry&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Wow, she’s furious and there’s no way I’m doing all of that. It’s unfortunate she had to specifically say to tell George that each time too. Recalling your own son’s name is old school, computers should retain that info for us. Here comes partial application to the rescue!&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sendMessageToGeorge&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sendMessageTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;George&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;sendMessageToGeorge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;be nicer to your mother&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//George, be nicer to your mother&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Hey, that’s neat. Now she doesn’t have to pass in a name each time. It’s almost like she’s got a direct line! Let’s break down what happened here.&lt;/p&gt;

&lt;p&gt;JavaScript functions have a method called &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind&quot;&gt;bind&lt;/a&gt; (at least &lt;a href=&quot;http://en.wikipedia.org/wiki/ECMAScript#ECMAScript.2C_5th_Edition&quot;&gt;es5&lt;/a&gt; asks that most implementations do) which does 2 fancy things. The first argument I passed in was &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt;. All this does is set the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;this&lt;/code&gt; context, a much bigger concept than the one I’m trying to convey right now. Essentially it allows you to change what &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;this&lt;/code&gt; means &lt;strong&gt;inside&lt;/strong&gt; the function. I passed in null because I don’t care about that in this instance, much like the laundry.&lt;/p&gt;

&lt;p&gt;The next argument I passed in was the &lt;em&gt;first&lt;/em&gt; argument of the function itself. It doesn’t have to stop at 1 either, you can pass in all of the variables for the function if you would like.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sayHiToGeorge&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sendMessageTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;George&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;hi&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;sayHiToGeorge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//George, hi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s rather pointless but you can do it. You can pass in more too but they won’t go anywhere (unless you are grabbing them from the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arguments&lt;/code&gt; hash).&lt;/p&gt;

&lt;p&gt;So there you have it, partial application in JavaScript. It’s a neat thing and can be very useful. Functions allow us to break our code up into nice concise blocks of functionality and partial application gives us the power to customize those functions as we need to without repeating code. Next time I’ll touch on how binding &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;this&lt;/code&gt; to the function can benefit you as well. Until then, happy JavaScripting!&lt;/p&gt;
</description>
				<pubDate>Thu, 14 Mar 2013 00:00:00 +0000</pubDate>
				<link>https://georgeshank.com/partial-application-with-javascript</link>
				<guid isPermaLink="true">https://georgeshank.com/partial-application-with-javascript</guid>
			</item>
		
			<item>
				<title>Font Awesome</title>
				<description>&lt;p&gt;I can’t believe I’m just finding this out but there is something called &lt;a href=&quot;http://fortawesome.github.com/Font-Awesome/&quot;&gt;Font Awesome&lt;/a&gt; which has &lt;strong&gt;free&lt;/strong&gt; font glyphs. Font glyphs are rad because of two things.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;They scale very well for high density screens&lt;/li&gt;
  &lt;li&gt;Changing the color of them is as easy as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;style=&quot;color:#000000;&quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Github pioneered the icons as fonts area of web with their &lt;a href=&quot;https://github.com/blog/1106-say-hello-to-octicons_&quot;&gt;Octicons&lt;/a&gt; and I think it’s spot on for most needs. The only limiting factor is each icon can only have one color.&lt;/p&gt;

&lt;p&gt;Previously I was using the free &lt;a href=&quot;http://glyphicons.com&quot;&gt;Glyphicons&lt;/a&gt; for my social links but quickly saw how ugly they were on retina devices (they also have fonts, just not free). I’ve swapped them out for Font Awesome glyphs and I think they look much better.&lt;/p&gt;
</description>
				<pubDate>Mon, 10 Dec 2012 00:00:00 +0000</pubDate>
				<link>https://georgeshank.com/font-awesome</link>
				<guid isPermaLink="true">https://georgeshank.com/font-awesome</guid>
			</item>
		
			<item>
				<title>New Blog</title>
				<description>&lt;p&gt;Well, I finally bit the bullet and put my old blog to rest. It was an old Rails knockoff of &lt;a href=&quot;http://svbtle.com&quot;&gt;Svbtle&lt;/a&gt; called &lt;a href=&quot;https://github.com/NateW/obtvse&quot;&gt;Obtvse&lt;/a&gt;. The old blog was very boilerplate and I didn’t really want to delve to deep into customization with it which led to me not wanting to post very often for fear I would migrate soon.&lt;/p&gt;

&lt;p&gt;Well, that migration has happened.&lt;/p&gt;

&lt;p&gt;Welcome to the new and improved &lt;a href=&quot;http://georgeshank.com&quot;&gt;georgeshank.com&lt;/a&gt;. It’s faster, stronger, and powered by &lt;a href=&quot;http://pages.github.com/&quot;&gt;Github Pages&lt;/a&gt; using &lt;a href=&quot;http://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;. For those that don’t know Jekyll is a “blog aware” static site generator that just happens to be available on Github’s free pages offering. With a little css, html, and some YAML configuring you’re off with a free blog by Github. It’s pretty powerful stuff.&lt;/p&gt;

&lt;p&gt;Another fun part of creating the new blog is that this one makes use of &lt;a href=&quot;http://johnpolacek.github.com/scrolldeck.js/decks/responsive/&quot;&gt;“responsive design”&lt;/a&gt;. Many people have different interpretations of what that means and for this blog that just means it looks good on all screens. (Except maybe retina macbooks, &lt;a href=&quot;http://twitter.com/taterbase&quot;&gt;let me know&lt;/a&gt; if not!)&lt;/p&gt;

&lt;p&gt;I’m hoping that with a new blog I’ll be encouraged to post more. Who knows, maybe I’ll post less. Either way a new year is around the corner and I’m thinking some big changes are on their way.&lt;/p&gt;
</description>
				<pubDate>Sun, 09 Dec 2012 00:00:00 +0000</pubDate>
				<link>https://georgeshank.com/new-blog</link>
				<guid isPermaLink="true">https://georgeshank.com/new-blog</guid>
			</item>
		
			<item>
				<title>Npm Scripts!</title>
				<description>&lt;p&gt;When you’ve got a somewhat complex Node app going you can end up with a lot of necessary batch operations you need to run before actually running your app. Some people run them manually and others actually write a small script that does this for them. Either way it’s a little disconnected from actually running the app.&lt;/p&gt;

&lt;p&gt;It turns out &lt;a href=&quot;http://npmjs.org&quot;&gt;NPM&lt;/a&gt; actually has an amazing solution for this. NPM supports a &lt;a href=&quot;http://npmjs.org/doc/scripts.html&quot;&gt;scripts&lt;/a&gt; setting in the package.json  where you can configure many items, among them being &lt;strong&gt;start&lt;/strong&gt; and &lt;strong&gt;prestart&lt;/strong&gt;. You simply add a command line action you’d like performed before starting the app in the &lt;strong&gt;prestart&lt;/strong&gt; tag  and then &lt;strong&gt;node app.js&lt;/strong&gt; in the &lt;strong&gt;start&lt;/strong&gt; tag and you’re ready to rock and roll. All you have to do is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm start&lt;/code&gt; and you’re off to the races.&lt;/p&gt;

&lt;p&gt;I have some coffeescripts I need transpiled before each run so my package.json looks a little like this:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;app-name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;author&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;George Shank&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.1.1-3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;dependencies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;express&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2.5.9&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;jade&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;gt;= 0.0.1&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;scripts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;start&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;node app.js&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;prestart&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;coffee -c public/js/*.coffee&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There’s a ton of potential here. You could do this with all your &lt;a href=&quot;http://lesscss.org&quot;&gt;Less files&lt;/a&gt; as well or anything else you need done just before run time.&lt;/p&gt;

&lt;p&gt;Happy hacking!&lt;/p&gt;

&lt;h6&gt;Thanks to &lt;a href=&quot;http://twitter.com/supershabam&quot;&gt;@supershabam&lt;/a&gt; for showing this to me.&lt;/h6&gt;
</description>
				<pubDate>Sun, 13 May 2012 00:00:00 +0000</pubDate>
				<link>https://georgeshank.com/npm-scripts</link>
				<guid isPermaLink="true">https://georgeshank.com/npm-scripts</guid>
			</item>
		
	</channel>
</rss>