<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://benniemosher.com/feed.xml" rel="self" type="application/atom+xml"/><link href="https://benniemosher.com/" rel="alternate" type="text/html"/><updated>2026-01-31T15:23:03+00:00</updated><id>https://benniemosher.com/feed.xml</id><title type="html">Bennie Mosher</title><subtitle>Father. Husband. Problem Solver. Software Engineer.</subtitle><entry><title type="html">Ready Player Two</title><link href="https://benniemosher.com/book%20reviews/2021/08/09/ready-player-two.html" rel="alternate" type="text/html" title="Ready Player Two"/><published>2021-08-09T00:00:00+00:00</published><updated>2021-08-09T00:00:00+00:00</updated><id>https://benniemosher.com/book%20reviews/2021/08/09/ready-player-two</id><content type="html" xml:base="https://benniemosher.com/book%20reviews/2021/08/09/ready-player-two.html"><![CDATA[<p>Foreclosure I was a big fan of the first book in this series, “Ready Player One.” I read RP1 before it was a movie via the Audible service, in one week’s drive. Ernest captured lots of 80s cultural references in ways that were fun and unlike anything I had read to that point. The movie was equally fun for me, and I felt like it was true to the book. I was very excited and anticipated the second book in the series, “Ready Player Two.”</p> <p>“Ready Player Two” was fun and took me on a journey I was not expecting. After reading the book, I was not surprised by the direction that Ernest took with the book. The classic AI armageddon storyline, and it wasn’t bad. I have not read a bunch of sci-fi books or books about AI. The genre is a newer discovery for me. After reading a bunch of reviews on GoodReads.com, I was disappointed to see that other seasoned authors were let down by the book. I can say that during reading the book when I found out there was a neural network interface I knew that Sam would be against it and the rest would be for it. I was able to predict that at least.</p> <p>I however was extremely pleased with the book and the new cultural references that it included. Having some of the final scenes be from the LOTR universe was exciting, and something that I was not expecting. It has inspired me to go back and reread all 5 books, The Hobbit, LOTR, and Simarillion. I hope that they take the time to turn this into a movie, some of these visuals would be amazing.</p> <p>Overall, I thought that this book was great, and Ernest Cline did not disappoint me. I could not put this book down and read it visually in two weeks, which is historically really fast for me. I was letting my wife drive places so I could have my head buried in the book, much like my teenage self reading the Junior Jedi Knights series!</p>]]></content><author><name></name></author><category term="Book Reviews"/><summary type="html"><![CDATA[Some thoughts on the book "Ready Player Two" by Ernest Cline, the sequel to "Ready Player One"]]></summary></entry><entry><title type="html">Learning React and Mocha</title><link href="https://benniemosher.com/learning/2016/02/18/learning-react-and-mocha.html" rel="alternate" type="text/html" title="Learning React and Mocha"/><published>2016-02-18T00:00:00+00:00</published><updated>2016-02-18T00:00:00+00:00</updated><id>https://benniemosher.com/learning/2016/02/18/learning-react-and-mocha</id><content type="html" xml:base="https://benniemosher.com/learning/2016/02/18/learning-react-and-mocha.html"><![CDATA[<p>In my recent job search I have been getting turned down by a lot of employers because I do not have React or Angular experience. Today I decided to learn one and build a demo app that can prove that I know the framework and can get work done. After research and tallying up denial emails, I decided that React was looking more needed and that it was smarter to learn React. So, I set out to do it. I read a <a href="http://reactfordesigners.com/labs/reactjs-introduction-for-people-who-know-just-enough-jquery-to-get-by/">article</a> that explain why React was superior to React and I was hooked. Mind you I finished this at 0200, when I should of been cozyed up against my wife, dogs, and my daughter in bed. However, now I have the damn learning fever that I get when I am learning something new.</p> <p>I knew that after learning the basics of states, that I needed to learn someway to write React in a TDD environment. The article mentioned above, as well as the <a href="http://facebook.github.io/react/docs/getting-started.html">documentation</a> provided by Facebook did not mention this. So, I did the normal developer thing, I Googled it. Which brought me to this little gem of a <a href="http://www.bebetterdeveloper.com/coding/getting-started-react-mocha.html">blog post</a>. The content is incredible, and it in fact does work and taught me how to get Mocha running with React. However, if you look at the dependencies there, it lists Gulp as a dependency.</p> <p>I know, I know, all you magpies are in love with Gulp and Grunt and whatever G word you can think up with to build your environment. I on the other hand have recently been trying to keep it simple. I have been doing everything in my power to write on NPM scripts, and stay away from the extra complexity that G’s bring. So, I went over to Lena’s Github profile, and found her repository for <a href="https://github.com/LenaBarinova/react-mocha-example">react-mocha-example</a> and forked it. And then the obsession grew even deeper.</p> <h2 id="removing-gulp">Removing Gulp</h2> <p><strong>HULK SMASH!!!</strong> and done, Gulp is removed. No, no, I will provide you with more context. So, first thing that I did was ran <code class="language-plaintext highlighter-rouge">npm install</code> just to make sure that my tests pass before I did anything. We are green, awesome. Now, what happens if I run <code class="language-plaintext highlighter-rouge">npm uninstall --save-dev gulp gulp-load-plugins gulp-mocha gulp-open</code>? Well, it uninstalls those modules of course. And then we run <code class="language-plaintext highlighter-rouge">npm test</code> again, and we are green. Okay, phew I didn’t break anything yet. Wait, look in package.json what is this <code class="language-plaintext highlighter-rouge">vinyl-source-stream</code> package? I have no idea, but it has the word stream in it, so it must have something to do with Gulp. A quick search on <a href="https://npmjs.com">npmjs.com</a> and <em>BAM</em>, I found it! In fact <a href="https://www.npmjs.com/package/vinyl-source-stream"><code class="language-plaintext highlighter-rouge">vinyl-source-stream</code></a> actually is a Gulp related package. Alright, sweet let’s blast that guy too, <code class="language-plaintext highlighter-rouge">npm uninstall --save-dev vinyl-source-stream</code>. Alright, run <code class="language-plaintext highlighter-rouge">npm test</code> again, and we are green. SWEET! That just removed five unneeded plugins from this repository. HELL TO THE YEAH! Now, lets delete the <code class="language-plaintext highlighter-rouge">gulpfile.js</code> as we will not need it anymore, and then commit.</p> <h2 id="removing-browserify">Removing Browserify</h2> <p>Alright, <code class="language-plaintext highlighter-rouge">browserify</code> is not a bad package at all. However, I just didn’t see the need for us to have it in this repository at this time. So, lets <code class="language-plaintext highlighter-rouge">npm uninstall --save-dev browserify</code> and then run <code class="language-plaintext highlighter-rouge">npm test</code>. Yup, we are green. Alright, we are doing pretty good so far, not a big deal. Let’s commit and then look at <code class="language-plaintext highlighter-rouge">package.json</code>.</p> <h2 id="removing-unneeded-babel-packages">Removing unneeded Babel packages</h2> <p>Alright, this is where it began to get a little hairy. I didn’t want to have Babel in the package list at all. So, I <code class="language-plaintext highlighter-rouge">npm uninstall --save-dev babel babel-core babel-preset-es2015 babel-preset-react</code> and run <code class="language-plaintext highlighter-rouge">npm test</code>. Holy mother of moses, we have errors. All over. Shoot. Okay, let’s undo that really fast <code class="language-plaintext highlighter-rouge">git co package.json &amp;&amp; npm install</code>. Let’s look at that list that we just uninstalled. At this point in my learning, I am willing to bet money that a package with the name “react” in it is most likely needed. So, let’s try the next one in line <code class="language-plaintext highlighter-rouge">npm uninstall --save-dev babel-preset-es2015</code> and then run <code class="language-plaintext highlighter-rouge">npm test</code>. Oops, nope still getting errors. Okay, again let’s undo that <code class="language-plaintext highlighter-rouge">git co package.json &amp;&amp; npm install</code>. Alright, next in line let’s ditch babel-core <code class="language-plaintext highlighter-rouge">npm uninstall --save-dev babel-core</code> and then run <code class="language-plaintext highlighter-rouge">npm test</code>. “Dammit, man! I’m a doctor, not a physicist!” Alright, we have to have that one too. Okay, lets undo that again <code class="language-plaintext highlighter-rouge">git co package.json &amp;&amp; npm install</code>. Last try here, <code class="language-plaintext highlighter-rouge">npm uninstall --save-dev babel</code> and then run <code class="language-plaintext highlighter-rouge">npm test</code>. DING DING DING! We have a winner! Looks like we don’t need babel in our package list. Well, at least that gets rid of one package. Let’s commit and move on.</p> <h2 id="upgrading-packages">Upgrading packages</h2> <p>At this point, we have removed everything from the <code class="language-plaintext highlighter-rouge">package.json</code> that we can. However, I did notice when we were running <code class="language-plaintext highlighter-rouge">npm install</code> that we were getting some warnings and deprecation notices. So, let’s go ahead and delete the <code class="language-plaintext highlighter-rouge">"devDependencies"</code> element out of our JSON object in <code class="language-plaintext highlighter-rouge">package.json</code>. Then we can run <code class="language-plaintext highlighter-rouge">npm install --save-dev babel-core babel-preset-es2015 babel-preset-react jsdom mocha mocha-jsdom react react-addons-test-utils react-dom</code> and of course run a quick <code class="language-plaintext highlighter-rouge">npm test</code> to make sure we are still green, and we are. Great. Let’s commit here and move on.</p> <h2 id="changing-out-mocha-jsdom-for-jsdom-global">Changing out mocha-jsdom for jsdom-global</h2> <p>One thing that I noticed on that last <code class="language-plaintext highlighter-rouge">npm install</code> command was a deprecation warning about <code class="language-plaintext highlighter-rouge">mocha-jsdom</code> and to move to using <code class="language-plaintext highlighter-rouge">jsdom-global</code>. So, let’s just go ahead and do that <code class="language-plaintext highlighter-rouge">npm uninstall --save-dev mocha-jsdom</code> and then <code class="language-plaintext highlighter-rouge">npm install --save-dev jsdom-global</code>. Of course, lets run <code class="language-plaintext highlighter-rouge">npm test</code> again. And we have another failure. That is okay, pretty easy to fix that one. Let’s <code class="language-plaintext highlighter-rouge">vim test/component-test.js</code> and change line 4 to <code class="language-plaintext highlighter-rouge">var jsdom = require('jsdom-global');</code>, and then run <code class="language-plaintext highlighter-rouge">npm test</code>. Sweet, that was an easy fix and we got rid of one of the deprecation warnings. Let’s commit at this point.</p> <p>After that I just changed the example code to be a little more generic and use things like “Hello World!”, instead of the chipper “Lovely! Here it is - my very first React component!”. BAH HUMBUG!!! Mr. Scrooge no like chipper. You can see the majority of those <a href="https://github.com/benniemosher/react-mocha-example/commit/3c341bea3749c94a5e4317df3071076444202417">changes here</a>.</p> <p>That is it. You now have a basic React and Mocha test framework that you can duplicate and use on every project. Pretty simple right? I thought so, and it was a lot of fun to HULK SMASH NPM packages for an hour or so. Well, I am off to grab some shut eye before my daughter wakes up; but tomorrow I will be learning more React and possibly starting the job hunting app I have been thinking about. Until next time, “You stay classy, San Diego!”</p> <p>P.S. I technically was able to completely remove the Babel dependency from the project, however because Facebook has official endorsed Babel, I didn’t include those steps in this post. You can check out the PR and read more about the Babel/JSTransform fight to the death <a href="https://github.com/benniemosher/react-mocha-example/pull/1">here</a>!</p>]]></content><author><name></name></author><category term="Learning"/><summary type="html"><![CDATA[My quest to learn React and Mocha without Grunt or Gulp]]></summary></entry><entry><title type="html">My Strength and Weaknesses to Date</title><link href="https://benniemosher.com/learning/2016/02/11/my-strength-and-weaknesses-to-date.html" rel="alternate" type="text/html" title="My Strength and Weaknesses to Date"/><published>2016-02-11T00:00:00+00:00</published><updated>2016-02-11T00:00:00+00:00</updated><id>https://benniemosher.com/learning/2016/02/11/my-strength-and-weaknesses-to-date</id><content type="html" xml:base="https://benniemosher.com/learning/2016/02/11/my-strength-and-weaknesses-to-date.html"><![CDATA[<p>Through my recent layoff and my currently ongoing job search, I have had to answer a lot of interview type questions. One of those questions was, “What else do you think we should know about you?”. I thought to myself, what else is pertinent here? Let’s be honest and write about my strengths and weaknesses. And then it set in… my brain came to a halt. What are my strengths? I have non, but I have a ton of weaknesses. Then steps in the wife. According to my wife my greatest strength as an engineer is my attention to detail, and my greatest weakness as a developer is my tendency to try and be a hero and take on too much work in an iteration. Let me go into some more detail.</p> <p>I think that my greatest strength as an engineer is how much I pain attention to detail. I pour my heart into every piece of code that comes from my fingers, or my pairs fingers. Due to my heart being attached to every piece of code, I do everything that I can to make my code a piece of art. I am obsessed with the nerdy things like whitespace, semicolons, same line curly braces, etc. I want the next person who comes along after me to be able to read and update the code that I write with ease.</p> <p>I think that my greatest weakness as a engineer is that I tend to take on too much responsibility in an iteration, which makes me tend to work fast. This usually results in my code suffering in quality, and things like whitespace being wrong. I know, the world is going to end right! It is something that has been brought to my attention at my last employer, and it is something that I have been and am going to continually work on throughout my career. I can still live to my nickname of “FedEx”, and slow down and make sure that mistakes are not made.</p>]]></content><author><name></name></author><category term="Learning"/><summary type="html"><![CDATA[An exercise of inner reflection and true honesty.]]></summary></entry><entry><title type="html">What is a category?</title><link href="https://benniemosher.com/learning/2016/01/29/what-is-a-category.html" rel="alternate" type="text/html" title="What is a category?"/><published>2016-01-29T00:00:00+00:00</published><updated>2016-01-29T00:00:00+00:00</updated><id>https://benniemosher.com/learning/2016/01/29/what-is-a-category</id><content type="html" xml:base="https://benniemosher.com/learning/2016/01/29/what-is-a-category.html"><![CDATA[<p>Categories are not a Groovy specific thing. From a quick google search I found this <a href="https://en.wikipedia.org/wiki/Class_(computer_programming)#Partial">Wikipedia</a> article, which tells us that the idea of categories have been around in many languages such as Smalltalk (known as Class Extensions), C# 2.0 and Visual Basic 2005 (known as partial classes), Objective-C (known as categories), and I also found that <a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Extensions.html">Swift</a> has the same idea known as Extensions.</p> <p>Since I am by no means a programming expert (yet, I will get there!), I will not try to completely explain categories instead I will just make some notes on the things that I learned about them during the pairing session. Categories do not add methods to the parent class at compile time like most other classes, instead it actually is adding them at runtime. This allows for the interpretor to basically layer the classes on top of each other. Let us look at an example our core class <code class="language-plaintext highlighter-rouge">Bob</code>:</p> <div class="language-groovy highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">class</span> <span class="nc">Bob</span>
<span class="o">{</span>
  <span class="n">String</span> <span class="nf">drinkCoffee</span><span class="o">()</span>
  <span class="o">{</span>
    <span class="n">String</span> <span class="n">cup</span> <span class="o">=</span> <span class="s1">'16oz'</span>
    <span class="k">return</span> <span class="n">cup</span>
  <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div> <p>In our <code class="language-plaintext highlighter-rouge">Bob</code> class above, we have a method called <code class="language-plaintext highlighter-rouge">drinkCoffee</code>. In this method we simply create a string called <code class="language-plaintext highlighter-rouge">cup</code> and then set it to <code class="language-plaintext highlighter-rouge">'16 oz'</code>. We simply just then return our string <code class="language-plaintext highlighter-rouge">cup</code> at the end of the method. This is just a basic class and method, I am sure that your codebase is much more complex, as is the codebase at my work, however for this example we will keep it simple. Let us get our category on!</p> <div class="language-groovy highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">class</span> <span class="nc">Bill</span>
<span class="o">{</span>
  <span class="n">use</span><span class="o">(</span><span class="n">Bob</span><span class="o">)</span> <span class="o">{</span>
    <span class="n">String</span> <span class="nf">drinkCoffee</span><span class="o">()</span>
    <span class="o">{</span>
      <span class="n">String</span> <span class="n">coffee</span> <span class="o">=</span> <span class="s1">'French Roast with Cream and Sugar'</span>
      <span class="k">return</span> <span class="n">cup</span> <span class="o">+</span> <span class="n">coffee</span>
    <span class="o">}</span>
  <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div> <p>If we look here, we use a category by <code class="language-plaintext highlighter-rouge">use(Bob)</code> and then extend the functionality by calling the same method <code class="language-plaintext highlighter-rouge">drinkCoffee()</code>. As we can see here, we don’t redeclare <code class="language-plaintext highlighter-rouge">String cup = '16oz'</code> because we don’t want to change it. The category principle basically allows us to inherit the cup variable from the parent class. We then set coffee with <code class="language-plaintext highlighter-rouge">String coffee = 'French Roast with Cream and Sugar'</code>. At the end of the method we then just <code class="language-plaintext highlighter-rouge">return cup + coffee</code>. The category allows us to easily extend the base method and include our own data and functionality and inherit the variables from the parent method.</p>]]></content><author><name></name></author><category term="Learning"/><summary type="html"><![CDATA[Learning about Groovy's categories]]></summary></entry><entry><title type="html">Things to think about before beginning a task</title><link href="https://benniemosher.com/learning/2016/01/28/things-to-think-about-before-beginning-a-task.html" rel="alternate" type="text/html" title="Things to think about before beginning a task"/><published>2016-01-28T00:00:00+00:00</published><updated>2016-01-28T00:00:00+00:00</updated><id>https://benniemosher.com/learning/2016/01/28/things-to-think-about-before-beginning-a-task</id><content type="html" xml:base="https://benniemosher.com/learning/2016/01/28/things-to-think-about-before-beginning-a-task.html"><![CDATA[<p>When beginning a new feature task, it is good to take the time and sit back and think about your approach. Come up with your game plan. Your play book. You should start by asking yourself, “Where am I getting the data from?”. This is probably one of the most key decisions that you can make before you get started. Are you getting data from more than one source? Grab a scratch piece of paper, or a blank text editor and start writing down some notes. Next question you should ask yourself is, “Is there options Out Of The Box (OOTB)?”. Ask yourself, “Is there something in our ecosystem that I can use and just make it more robust? A class that I can just extend?”. Most of the time it appears that this is the case. Which really, ultimately seems to make development a lot easier. You do not have to start over from scratch. You can just extend a class, or use a category, and add the data or methods that you need for your new feature. Take a few minutes to look through your existing code base. Check some things out, pseudo code, write notes, draw a mind map, do whatever you can find that allows you to wrap your head around the entire feature and how you are going to implement it.</p> <p>In our particular case, we were working on a feature where we needed to add image url data to the SKU object. So, we knew that we already had a core class that generated a custom Color object, so let’s consider that our OOTB class that we can extend to make more robust. We also know that our data lived on the Color object’s parent object of Product. Since we were working with Oracle Commerce (OC), my partner showed me a really easy way to view the data that is being delivered to any OC page. You can simply append this query string onto the URL and it will show you all the data, <code class="language-plaintext highlighter-rouge">?format=json</code>. Once you have the format though, at least in Google Chrome, it looks like just a giant unreadable string. Have no fear, my fellow engineer; there is an extension for that! I personally use <a href="https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc">JSONView</a>, which will re-render the JSON into a readable format for you.</p> <p>One more thing to remember before starting your feature, is set this rule for yourself, <strong><em>“Avoid, at all costs, changing a core class!”</em></strong> I have not done a lot of programming on top of another platform, like OC, most of my work has been done on a from scratch project. However, I have been told from a few coworkers and mentors that you can almost always get away with never changing a core class. For instance, at work the brave souls that we call Architects have designed a platform that sits on top of Oracle Commerce and enhance the functionality and accessibility. Therefore, we call this platform our “core” now. When we started our newest project, we have been extending those core classes to provide the specific functionality that is not included in our core platform. Sometimes this requires being extremely clever, sometimes it does in fact mean having to refactor a core class so that we can properly extend it in the new project. We have been using a type of classes called Categories, also known as partial classes.</p>]]></content><author><name></name></author><category term="Learning"/><summary type="html"><![CDATA[How I learned to approach a task with agile thinking]]></summary></entry><entry><title type="html">How to read your tmux/wemux config</title><link href="https://benniemosher.com/.dotfiles/tmux/2014/08/14/read-tmux-wemux-config.html" rel="alternate" type="text/html" title="How to read your tmux/wemux config"/><published>2014-08-14T00:00:00+00:00</published><updated>2014-08-14T00:00:00+00:00</updated><id>https://benniemosher.com/.dotfiles/tmux/2014/08/14/read-tmux-wemux-config</id><content type="html" xml:base="https://benniemosher.com/.dotfiles/tmux/2014/08/14/read-tmux-wemux-config.html"><![CDATA[<p>So, if you are using a fork of my dotfiles you will see that I have a tmux and wemux config file in there. I generally use wemux to do work, don’t ask me why but it is what was suggested by a coworker over tmux (maybe a post will be due soon on that). I have been reading a lot on how to use tmux and have been having some problems. Thoughtbot has a whole <a href="https://upcase.com/tmux">trail on tmux</a> and has a lot of great information on that trail.</p> <p>I was reading through some of the post and getting discouraged very quickly. Everything in my dotfiles was mapped differntly then what thoughtbot had. I begain to think about this and realized that most of thoughtbot’s materials probably assume that you are using their <a href="https://github.com/thoughtbot/laptop">laptop</a> setup. What if you are not using their setup? What if you are using a laptop from work that your boss set up for you so that you can have the same setup as the rest of the team, as to make pairing a lot easier. How do you learn the key bindings to things like vim or tmux? Well I have come up with a small tip: <strong><em>READ THE CONFIG FILES!</em></strong></p> <p>You might be thinking to yourself, I have looked at those config files and they are confusing and hard to understand. Let’s quickly go over some details and things to look for so that you can begin to understand how to pick out the good things in the config files.</p> <p>You can see my <code class="language-plaintext highlighter-rouge">.tmux.conf</code> file <a href="https://github.com/benniemosher/dotfiles/blob/master/tmux.conf">here</a>.</p> <h3 id="command-keys">Command keys</h3> <p>In my configuration my command keys for tmux is <code class="language-plaintext highlighter-rouge">ctrl+a</code>. This can get cumbersome to type, unless you remap your <code class="language-plaintext highlighter-rouge">caps lock</code> key to <code class="language-plaintext highlighter-rouge">ctrl</code>. Then all you do is press <code class="language-plaintext highlighter-rouge">caps lock + a</code> followed by a command.</p> <h3 id="bind-key-or-bind"><code class="language-plaintext highlighter-rouge">bind-key</code> or <code class="language-plaintext highlighter-rouge">bind</code></h3> <p>When you see <code class="language-plaintext highlighter-rouge">bind-key</code> or <code class="language-plaintext highlighter-rouge">bind</code> in your config file, to my understanding, this is a way to set shortcuts. So, I read <code class="language-plaintext highlighter-rouge">bind-key</code> as <code class="language-plaintext highlighter-rouge">ctrl+a</code> (<code class="language-plaintext highlighter-rouge">caps lock + a</code>).</p> <h4 id="bind-keys-or-binds-to-note"><code class="language-plaintext highlighter-rouge">bind-key</code>s or <code class="language-plaintext highlighter-rouge">bind</code>s to note</h4> <ul> <li><a href="https://github.com/benniemosher/dotfiles/blob/master/tmux.conf#L22">line 22</a> – <code class="language-plaintext highlighter-rouge">bind-key | split-window -h</code>.</li> <li><a href="https://github.com/benniemosher/dotfiles/blob/master/tmux.conf#L24">line 24</a> – <code class="language-plaintext highlighter-rouge">bind-key - split-window -v</code>.</li> <li><a href="https://github.com/benniemosher/dotfiles/blob/master/tmux.conf#L25">line 25</a> – <code class="language-plaintext highlighter-rouge">bind-key x kill-pane</code>.</li> <li><a href="https://github.com/benniemosher/dotfiles/blob/master/tmux.conf#L47-50">line 47-50</a> – These bindings allow you to navigate through panes using VIM keybindings thruogh <code class="language-plaintext highlighter-rouge">ctrl + a &lt;key&gt;</code></li> </ul> <h3 id="more-details">More details</h3> <p>To get better ideas of what to look for and to figure out some key commands, thoughtbot has these two great links:</p> <ul> <li><a href="http://robots.thoughtbot.com/post/2166174647/love-hate-tmux">Love, hate, &amp; tmux</a></li> <li><a href="http://robots.thoughtbot.com/post/2641409235/a-tmux-crash-course">A Tmux Crash Course</a></li> </ul> <p>Here is to *muxing your future!</p>]]></content><author><name></name></author><category term=".dotfiles"/><category term="tmux"/><summary type="html"><![CDATA[A walk-down of reading your tmux/wemux config to enable you to quickly learn]]></summary></entry><entry><title type="html">Speeding up your tests by selectively persisting data</title><link href="https://benniemosher.com/tdd/2014/08/14/speeding-tests-selectively-persisting-data.html" rel="alternate" type="text/html" title="Speeding up your tests by selectively persisting data"/><published>2014-08-14T00:00:00+00:00</published><updated>2014-08-14T00:00:00+00:00</updated><id>https://benniemosher.com/tdd/2014/08/14/speeding-tests-selectively-persisting-data</id><content type="html" xml:base="https://benniemosher.com/tdd/2014/08/14/speeding-tests-selectively-persisting-data.html"><![CDATA[<p>I follow the <a href="http://robots.thoughtbot.com">thoughtbot blog</a> very closely, and today they posted about <a href="http://robots.thoughtbot.com/speed-up-tests-by-selectively-avoiding-factory-girl">speeding up tests by selectively avoiding factory girl</a>. This was enlightening on multiple levels.</p> <h2 id="benchmarking-their-own-gems">Benchmarking their own gems</h2> <p>For me it was extremely enlightening to see a company, who does a lot of gem work, benchmark their own gem. It was great to see that they don’t always use <a href="https://github.com/thoughtbot/factory_girl">FactoryGirl</a> in their test suites.</p> <h2 id="okay-to-not-always-be-persisting-data">Okay to not always be persisting data</h2> <p>It was awesome to see that a company so highly thought of say that it is okay to not persist data in your specs. I have been using FactoryGirl for a few years now, and admittedly probably too much. I thought that it was always necessary to persist the data, but to see that its 100% faster to not persist data is going to make me think twice next time I create a test.</p> <p>Go test things and don’t always persisting data!</p>]]></content><author><name></name></author><category term="TDD"/><summary type="html"><![CDATA[Learn to benchmark your gems and selectively persist data]]></summary></entry><entry><title type="html">Changing routes not paths</title><link href="https://benniemosher.com/rails/2014/08/12/changing-routes-not-paths.html" rel="alternate" type="text/html" title="Changing routes not paths"/><published>2014-08-12T00:00:00+00:00</published><updated>2014-08-12T00:00:00+00:00</updated><id>https://benniemosher.com/rails/2014/08/12/changing-routes-not-paths</id><content type="html" xml:base="https://benniemosher.com/rails/2014/08/12/changing-routes-not-paths.html"><![CDATA[<p>So this morning I watched <a href="https://gorails.com/episodes/a-look-into-routing">GoRails.com’s screencast ‘A Look Into Routing‘</a> and learned something fantastic about your routes file.</p> <p>In the podcast Chris (at least that is who sent me the email about this podcast), is describing how to make a routes folder for a book store. He eventually describes and gets to this point in the code:</p> <div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="no">Rails</span><span class="p">.</span><span class="nf">application</span><span class="p">.</span><span class="nf">routes</span><span class="p">.</span><span class="nf">draw</span> <span class="k">do</span>
    <span class="n">resources</span> <span class="ss">:books</span> <span class="k">do</span>
        <span class="n">member</span> <span class="k">do</span>
            <span class="n">patch</span> <span class="ss">:publish</span>
            <span class="n">patch</span> <span class="ss">:unpublish</span>
        <span class="k">end</span>

        <span class="n">collection</span> <span class="k">do</span>
            <span class="n">patch</span> <span class="ss">:publish_all</span>
            <span class="ss">post: </span><span class="n">import</span>
        <span class="k">end</span>
    <span class="k">end</span>
<span class="k">end</span>
</code></pre></div></div> <p>He then describes a very common case in the startup world, you pivot and begin to need to sell products. He describes a scenario where you do not yet have products other then books to sell, but you decide that you want to start to switch over your URLs to start getting your customers use to this type of path url. This is where the light bulb went off in my head. He adds 15 characters to his routes file and the whole world changes:</p> <div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="o">...</span>
    <span class="n">resources</span> <span class="ss">:books</span><span class="p">,</span> <span class="ss">path: </span><span class="s2">"products"</span> <span class="k">do</span>
    <span class="o">...</span>
</code></pre></div></div> <p>This now changes your URLs from <code class="language-plaintext highlighter-rouge">/books/:id/publish</code> to <code class="language-plaintext highlighter-rouge">/products/:id/publish</code>. This is amazing to me. He only changed his URL schema, he does not have to go through his app and change his <code class="language-plaintext highlighter-rouge">publish_book_path</code> as it is still a viable path. The routes files just forwards new requests to <code class="language-plaintext highlighter-rouge">/products/</code>.</p> <p>This is obviously an inbetweener step, and you will eventually have to go in and change it to be <code class="language-plaintext highlighter-rouge">resources :products</code> and then change your controller name and all that good stuff, but this will allow you to start indexing your product URL schema without any real changes to your app.</p> <p>This is my mind blown moment for the day!</p>]]></content><author><name></name></author><category term="Rails"/><summary type="html"><![CDATA[Easily change your routes file to have new URLs]]></summary></entry><entry><title type="html">mocks != stubs</title><link href="https://benniemosher.com/tdd/2014/08/10/mocks-stubs.html" rel="alternate" type="text/html" title="mocks != stubs"/><published>2014-08-10T00:00:00+00:00</published><updated>2014-08-10T00:00:00+00:00</updated><id>https://benniemosher.com/tdd/2014/08/10/mocks-stubs</id><content type="html" xml:base="https://benniemosher.com/tdd/2014/08/10/mocks-stubs.html"><![CDATA[<p>In attempting to complete thoughtbot’s Testing trail, I read Martin Fowlers’s article, <a href="http://martinfowler.com/articles/mocksArentStubs.html">“Mocks Aren’t Stubs”</a>.</p> <p>I have been writing tests for about a year now and I have always just done Integration/Feature tests because they were easier, and I really didn’t know how to use mocks and stubs. This was okay until our test suite at work reached a few minutes to complete because of all the feature specs. Now that I have read Fowler’s article, I understand what they are now.</p> <blockquote> <p>Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what’s programmed in for the test.</p> <p><cite>Martin Fowler</cite></p> <p>Mocks … objects pre-programmed with expectations which form a specification of the calls they are expected to receive.</p> <p><cite>Martin Fowler</cite></p> </blockquote> <p>In general stubs will use state verification and mocks will uses behavior verification. As Fowler talks about in his article, a stub would tell you if your message was marked as sent in a database and your mock would make sure that the proper methods where called and that they were sent the right things.</p> <p>You can often use mocks to test that a third-party service is called. Such as below:</p> <div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">third_party_mock</span><span class="p">.</span><span class="nf">should_receive</span><span class="p">(</span><span class="ss">:create</span><span class="p">).</span><span class="nf">with</span><span class="p">(</span>
    <span class="ss">user_guid: </span><span class="n">user</span><span class="p">.</span><span class="nf">guid</span><span class="p">,</span>
    <span class="ss">account_guid: </span><span class="n">account</span><span class="p">.</span><span class="nf">guid</span><span class="p">,</span>
    <span class="ss">attr_1: </span><span class="n">attr_1</span><span class="p">,</span>
    <span class="ss">attr_2: </span><span class="n">attr_2</span>
<span class="p">)</span>
</code></pre></div></div> <p>This allows us to make sure that the behavior is called and that the correct elements are sent with the call.</p> <p>You can often use stubs to fake out states of variables that that it returns the required data. You can stub out how many elements are returned per page for pagination like so:</p> <div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="no">ArticleController</span><span class="p">.</span><span class="nf">any_instance</span><span class="p">.</span><span class="nf">stub</span><span class="p">(</span><span class="ss">:articles_per_page</span><span class="p">).</span><span class="nf">and_return</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
</code></pre></div></div> <p>This is nice because instead of having <code class="language-plaintext highlighter-rouge">articles_per_page = 10</code> and then have to generate 11 articles in your test, you can set it to be 1 and then you only have to create 2 articles to test that your pagination is working.</p> <p>I think that it finally makese sense now and now that I have a grasp on when to use mocks vs. stubs I can go and test the world!</p>]]></content><author><name></name></author><category term="TDD"/><summary type="html"><![CDATA[Learn the difference between mocks and stubs]]></summary></entry><entry><title type="html">Submitting Changes to my .dotfiles upstream</title><link href="https://benniemosher.com/.dotfiles/vim/2014/08/10/submitting-changes-to-my-dotfiles-upstream.html" rel="alternate" type="text/html" title="Submitting Changes to my .dotfiles upstream"/><published>2014-08-10T00:00:00+00:00</published><updated>2014-08-10T00:00:00+00:00</updated><id>https://benniemosher.com/.dotfiles/vim/2014/08/10/submitting-changes-to-my-dotfiles-upstream</id><content type="html" xml:base="https://benniemosher.com/.dotfiles/vim/2014/08/10/submitting-changes-to-my-dotfiles-upstream.html"><![CDATA[<p>At work I have started to use Vim more often. In doing so I have adapted my coworker’s dotfiles repo (which is based off of thoughtbot’s dotfiles) and started using it for myself. I have forked it <a href="https://github.com/benniemosher/dotfiles">here</a>. To install read the <a href="https://github.com/benniemosher/dotfiles/blob/master/README.md">README.md</a> or <a href="http://robots.thoughtbot.com/manage-team-and-personal-dotfiles-together-with-rcm">thoughtbot’s install blog post</a>.</p> <p>I recently hit a problem with using these dotfiles in that I wanted to make some changes to my setup but still wanted to be able to contribute things back to my coworkers dotfiles. So, I started to do some research and was able to get ahold of <a href="https://twitter.com/r00k">@r00k</a> and <a href="https://twitter.com/croaky">@croaky</a> on Twitter and <a href="https://twitter.com/croaky">@croaky</a> mapped me to this <a href="http://robots.thoughtbot.com/keeping-a-github-fork-updated">blog post from thoughtbot</a>.</p> <p>It took me a little bit of thinking and trial and error but I have finally figured it out. So, here we go…</p> <p>Lets clone your forked dotfiles repo down (replace <github_username> with your username):</github_username></p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone git@github.com:&lt;github_username&gt;/dotfiles.git
</code></pre></div></div> <p>Then we can add a remote called upstream, which will the repo that you forked yours from:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd </span>dotfiles
git remote add upstream git@github.com:benniemosher/dotfiles
</code></pre></div></div> <p>Now we are set. We can now update our master branch from our upstreams master branch:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git fetch upstream
git rebase upstream/master
</code></pre></div></div> <p>This will allow us to get any updates that our upstream repo pushes out. We can now change anything that we want in our forked dotfiles repo and push it to github. We can begin to personal our dotfiles and still be able to retrieve updates from our upstream repo.</p> <p>Let’s say that you have wrote this amazing macro for your Vim setup and you want to push it out to your upstream repo.</p> <p>Simply checkout your upstreams master branch under a branch named upstream:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git co <span class="nt">-b</span> upstream upstream/master
</code></pre></div></div> <p>This will remove all of your Vim customizations and set you back to your upstreams default. We can now make a change in the upstream branch, push it to github, and then make a pull request (PR) comparing our upstream branch to upstream/masters branch. This will allow you to push any customization that is worthy of being in the upstream repo up, and then create PRs of only those changes. Once the PR has been approved and merged into our upstream repo, we can update our local copy with those changes:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git fetch upstream
git rebase upstream/master
</code></pre></div></div> <p>We do a rebase here instead of a merge so that we can try to avoid as many conflicts as possible. This should take the commit in our upstream branch and replay it on top of all of our customizations. Now we just simply rinse and repeat!</p> <p>Happy Viming!</p>]]></content><author><name></name></author><category term=".dotfiles"/><category term="VIM"/><summary type="html"><![CDATA[How to submit changes to a repos upstream repository]]></summary></entry></feed>