<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by CJ Horton on Medium]]></title>
        <description><![CDATA[Stories by CJ Horton on Medium]]></description>
        <link>https://medium.com/@radditude?source=rss-293ad9375687------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XXlHnubgYc6ZaWDteZ89nQ.jpeg</url>
            <title>Stories by CJ Horton on Medium</title>
            <link>https://medium.com/@radditude?source=rss-293ad9375687------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 18:36:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@radditude/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Bash Script to Create Even Easier Dark Mode for Slack]]></title>
            <link>https://medium.com/revelry-labs/a-bash-script-to-create-even-easier-dark-mode-for-slack-9ad80c6d7819?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ad80c6d7819</guid>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[dark-mode]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[slack]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Fri, 03 May 2019 14:41:48 GMT</pubDate>
            <atom:updated>2019-05-28T16:26:01.011Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSr2q3YbKnLbMAe7KwwbNQ.jpeg" /></figure><p>If you’ve found this post, chances are you’ve already seen Hunter Chang’s post <a href="https://dev.to/changoman/easy-dark-mode-for-slack-1mmn">Easy Dark Mode for Slack</a>. The solution described there works fine, but why manually copy and paste when you can automate?</p><p>I thought I could show you how to write a bash script to re-darken Slack on MacOS with a single command.</p><p>Rejoice: save your dark-mode-accustomed eyes from the stress of unnecessary light theme exposure.</p><p>You can check out the <a href="https://gist.github.com/radditude/43b76745b796db8035d676ff63346d4a">gist</a> to jump right to the code. But if you’d like to see how I figured it out, open up a new file and prepare to follow along:</p><p><a href="https://revelry.co/dark-mode-for-slack/">Check out the original post</a> on Revelry.co for all the steps!</p><p>If you’d like to see the full finished script all together, check out the <a href="https://gist.github.com/radditude/43b76745b796db8035d676ff63346d4a">gist</a> on GitHub.</p><p><strong><em>At Revelry, we use Slack channels for open communication across our projects.</em></strong></p><p><a href="https://revelry.co/external-slack-communication/"><strong>Read: inviting clients into project conversations</strong></a></p><p><a href="https://revelry.co/custom-slack-emoji/"><strong>Also check out: The best custom emoji for Slack</strong></a></p><p><em>Originally published at </em><a href="https://revelry.co/dark-mode-for-slack/"><em>https://revelry.co</em></a><em> on May 3, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ad80c6d7819" width="1" height="1" alt=""><hr><p><a href="https://medium.com/revelry-labs/a-bash-script-to-create-even-easier-dark-mode-for-slack-9ad80c6d7819">A Bash Script to Create Even Easier Dark Mode for Slack</a> was originally published in <a href="https://medium.com/revelry-labs">Revelry</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spacecraft Driven Development: How We Took Computers to The Moon]]></title>
            <link>https://medium.com/revelry-labs/spacecraft-driven-development-how-we-took-computers-to-the-moon-12f91c6e97e8?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/12f91c6e97e8</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[space]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[innovation]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Tue, 05 Feb 2019 14:45:38 GMT</pubDate>
            <atom:updated>2019-05-16T16:08:31.233Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w1giT6ncRMonzUZxftPHRw.jpeg" /></figure><p>At the dawn of the space program, computers were enormous, bulky, delicate things, with extremely limited processing capability. Today, we have <a href="https://en.wikipedia.org/wiki/Unmanned_NASA_missions">unmanned spacecraft</a> exploring the outer reaches of the solar system.</p><p>This is the story of how we got here from there.</p><h3>Spacecraft driven development: a series of incremental improvements and learnings</h3><p>It’s easy to forget that even the most sophisticated technology is rooted in a series of incremental developments — learning from failure — and the story of NASA’s earliest onboard guidance computers is no different. Along the way, they more or less invented the discipline of software engineering, along with many of the best practices we know and love today.</p><p>If you’ve come here for stories of sci-fi-like last-minute repairs and incredible feats of genius, you may be disappointed. The people in these stories were incredibly smart, yes, but they were also figuring things out as they went along — it’s a hazard of doing things no one’s ever done before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JHfw4XyXOo6BaSoi.jpg" /></figure><h3>Project Mercury &amp; the Human Computer</h3><p>The year was 1958. The space race had just kicked off with the launch of <a href="https://en.wikipedia.org/wiki/Sputnik_1">Sputnik</a>, and the newly formed National Aeronautics and Space Administration was under a lot of pressure.</p><p>Cue Project Mercury, the first U.S. human spaceflight program. The goal was simply to put an astronaut into orbit, then return him (all American astronauts were male until Sally Ride’s first flight in 1983) safely to the ground.</p><p>Project Mercury spacecraft were essentially well-sealed tin cans filled with air, plus some instrumentation and small positional thrusters. Ascent was controlled by the angle of the rocket at launch, and descent was handled by a parachute and water landing. There was no guidance computer, and the only way to communicate with the ground was by radio.</p><p>The astronaut still needed to perform small adjustments in mid-flight to control his orbit and ensure he re-entered the atmosphere at the correct angle. And so they needed some way to relay data to the ground, use NASA’s computers to make those incredibly complex flight calculations, and relay the results back to space.</p><p><strong>The solution they came up with was a logistical feat that boggles the mind. It was a global relay race:</strong></p><ol><li>The astronaut would take readings from his instruments and radio the results to the ground.</li><li>That radio call would be received by the Worldwide Tracking Network, a chain of 18 stations around the equator in various nations and continents. Each station was in range of the spacecraft for approximately 7 minutes as it passed overhead.</li><li>The Worldwide Tracking Network relayed the data from the spacecraft to NASA staffers at the control centers in Maryland and Florida, who ran the calculations on their (firmly non-portable) computers.</li><li>NASA then phoned the results of their calculations to the WTN (after calculating which station was currently in range of the spacecraft).</li><li>The WTN station radioed the results back up to the spacecraft.</li><li>The astronaut would make the appropriate adjustments, take new readings, and start the cycle all over again.</li></ol><p>Each flight needed a total of about 18,000 support personnel on the ground.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8GPhQloaQhSBDebm.jpg" /></figure><h3>Project Gemini &amp; the First In-Flight Computer</h3><p>Fast forward to 1961 and Project Gemini. NASA, having successfully orbited people around the earth, had a new, more ambitious goal — a manned spacecraft that could make a mid-air rendezvous with an upper-stage rocket, which would be sent up separately. The other rocket would deliver additional fuel after the manned spacecraft reached orbit, allowing it to perform much more complex flight maneuvers than those possible with Project Mercury spacecraft.</p><p>To accomplish that goal, they needed greater precision than the Worldwide Tracking Network/NASA relay could provide. So they imagined something new: a computer installed onboard the spacecraft itself, capable of taking input from the ship’s instruments and performing the calculations needed to get a crew safely home.</p><p>The resulting Gemini Guidance Computer, built by IBM, weighed a whopping 60 pounds and took 420 milliseconds to multiply two numbers together. This was, of course, state of the art at the time.</p><p>To IBM’s surprise, however, building the hardware turned out to be the easy part. Software engineering was a very young discipline at this point — and indeed wasn’t even called software engineering! IBM’s engineers assumed that they would be able to quickly crank out the code needed to guide the spacecraft through its trip.</p><p><strong>Once they started coding, though, their software promptly ran up against the limits of the hardware.</strong></p><p>Even though they were using a variant of assembly language that was extremely low-level and memory-efficient, the tiny memory was nowhere near large enough to hold all the programs needed for take-off, in-flight maneuvers, re-entry, and landing. The solution was an external tape storage system that could hold programs not currently in use and load them back into the working memory as needed.</p><p>Unfortunately, the tape system was prone to errors and misreads during the vibrations of takeoff and landing. They stabilized the tape with weights to minimize the effect of the vibrations, and implemented a three-way voting system where each bit of a program would be read simultaneously from three copies. If a particular bit on one tape was corrupted or misread, the computer had two other good copies to overrule the bad one.</p><p>The downside of this safety measure was time: it took nearly 6 minutes to load a new program from tape. But it reduced errors to acceptable levels.</p><p><strong>Another new challenge was how to organize all this code.</strong></p><p>The engineers originally envisioned each flight as one big procedural program, like a long essay. This plan lasted until they realized that the giant program would would need to be completely rewritten and retested for each subsequent flight.</p><p>They eventually settled on a module system organized by the phase of the flight, since some parts of the code changed more than others between flights.</p><p>The last major obstacle IBM’s engineers faced was to how test their flight code. Clearly, the programs needed to be error-free; just as clearly, they couldn’t actually be tested in flight. The result was a 3-level test system:</p><ol><li>First, each hardcoded equation was verified to ensure that it produced the correct output.</li><li>Next up were “man-in-the-loop” simulations, something like what we might call unit tests — given a certain input, does a piece of a program produce the correct output?</li><li>Lastly, they would run a series of manual integration tests using the real hardware and crew interface.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-1YvU5Re8kKpgAlo.jpg" /></figure><h3>The Apollo Project: Taking Computers to the Moon</h3><p>The next opportunity to build space computers came a few years later with the launch of the Apollo program. MIT rose to the task and produced the <a href="http://svtsim.com/moonjs/agc.html">Apollo Guidance Computer</a>.</p><p>The MIT team unfortunately fell victim to some of the exact same problems that plagued the IBM team for the Gemini missions — namely, the hardware team vastly underestimated the amount of memory required hold the ever-increasing complexity of the guidance software. The hardware memory had to be increased 18 times during the course of the project, and topped out at what, in modern units, would be about 72 kb.</p><p>In an effort to make their software as memory-efficient as possible, the software team even wrote their own language: they created a variant of assembly language (now known as ACG assembly), which used less memory at the price of sacrificing some speed. To get a feel for what the code looked like, check out <a href="https://github.com/chrislgarry/Apollo-11">the code for the Apollo 11 mission on Github</a>.</p><p>The hardware team did learn from some of the mistakes of the Gemini team, though. Given the issues the Gemini team had with vibrations and power fluctuations during takeoff and landing, they decided to use an extremely reliable type of memory called <a href="https://www.youtube.com/watch?v=P12r8DKHsak">core rope memory</a>.</p><p>Since core rope memory is read-only, it wasn’t vulnerable to data corruption from the rigors of spaceflight. However, the fact that it couldn’t be changed or updated without manufacturing an entirely new piece of memory created a whole new set of challenges for the programmers.</p><p><strong>The software workflow went something like this:</strong></p><ol><li>An engineer wrote or edited a section of the guidance software in AGC assembly language.</li><li>The AGC assembly language was compiled to binary and printed to paper.</li><li>This printed binary went off to a manufacturing facility, where workers hand-wove it into core rope memory</li><li>The rope memory came back from manufacturing and underwent testing for software bugs or manufacturing flaws</li><li>When problems were found, the cycle started over again from the beginning</li></ol><p>The length of the feedback cycle, plus the fact that the software team couldn’t easily develop or test changes with the actual flight hardware, meant that the process needed to be carefully managed.</p><p>According to some sources, <a href="https://en.wikipedia.org/wiki/Margaret_Hamilton_(scientist)">Margaret Hamilton</a> coined the term <em>software engineer </em>while working on the AGC software — it’s easy to see why this complex, error-prone process might have inspired the term.</p><h3>To Infinity…</h3><p>So what’s the point of all this, other than to share cool facts about space and old computers? Well, if you squint you can see the parallels with common problems that plague software projects today:</p><p><strong>How do we build something that’s never been built before? What do we do when our software maxes out the resources allotted to it? How do we test software that guides a space flight without launching a rocket every time we change something?</strong></p><p>The main reason, though, is that it’s easy to forget that big advances happen in small steps. It’s easy for us application developers to joke that our job isn’t rocket science, but one of the most interesting things I learned while researching this piece is just how many mistakes happened on the way to the moon.</p><h3>Further reading</h3><p>Much of the info in this post comes from <a href="https://history.nasa.gov/computers/contents.html"><em>Computers in Spaceflight: the NASA Experience</em></a> by James E. Tomayko, the full text of which is available online through <a href="https://waffle.io/nasa.gov">nasa.gov</a>.</p><p>Other resources used and/or linked:</p><ul><li><a href="https://github.com/chrislgarry/Apollo-11">the Apollo 11 source code on Github</a></li><li><a href="http://svtsim.com/moonjs/agc.html">a web simulator of the user interface for the Apollo Guidance Computer</a></li><li><a href="https://www.youtube.com/watch?v=P12r8DKHsak">a video describing the painstaking process of making core rope memory</a></li><li><a href="http://confreaks.tv/videos/rubyconf2017-buuuuugs-iiiiin-spaaaaace">Colin Fulton’s talk on <em>Bugs in Space!</em> from RubyConf 2017</a></li></ul><p><em>Originally published at </em><a href="https://revelry.co/spacecraft-driven-development/"><em>revelry.co</em></a><em> on February 5, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12f91c6e97e8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/revelry-labs/spacecraft-driven-development-how-we-took-computers-to-the-moon-12f91c6e97e8">Spacecraft Driven Development: How We Took Computers to The Moon</a> was originally published in <a href="https://medium.com/revelry-labs">Revelry</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Take Your Pair Programming Skills to the Next Level]]></title>
            <link>https://medium.com/revelry-labs/how-to-take-your-pair-programming-skills-to-the-next-level-6bfd79367356?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/6bfd79367356</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[pair-programming]]></category>
            <category><![CDATA[agile-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Tue, 29 May 2018 14:47:41 GMT</pubDate>
            <atom:updated>2018-07-27T18:56:17.147Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M7iw5bHXI2JEldQRDAU7pg.jpeg" /></figure><p>The research is in — <strong>pair programming is awesome</strong>. At the cost of about a 15% increase in development time, pairing <strong>produces code with fewer errors,</strong> and even <strong>makes us happier at work</strong>. I’m here to help you take your pair programming skills to the next level.</p><p>Seriously, though: those claims are supported by <em>actual research. </em>Download the respective PDFs here: <a href="http://www.idi.ntnu.no/grupper/su/publ/ebse/R11-pairprog-hannay-ist09.pdf">The Effectiveness of Pair Programming: A Meta-Analysis</a>, <a href="https://collaboration.csc.ncsu.edu/laurie/Papers/dissertation.pdf">The Collaborative Software Process</a>, and <a href="https://www.cs.utah.edu/~lwilliam/Papers/ieeeSoftware.PDF">Strengthening the Case for Pair-Programming.</a></p><p>But if you take a cross-section of developers, you’ll find some very mixed opinions about pairing. Some devs hate it. Some devs write blog posts about how great it is.</p><h3>Developing pair programming skills means handling the learning curve</h3><p>Why the divide? It’s easy to hand-wave away by muttering <em>something something soft skills</em> and leave it at that — which is exactly why I dislike the term <em>“soft skills.”</em> It’s too often used in a nebulous way to indicate something that’s the opposite of <em>hard</em>, aka <em>technical</em>, skills.</p><p>In reality, the two are highly complementary skill sets. It’s hard to collaborate with someone without learning from them, which is a really effective way to ramp up your technical skills. Done right, it becomes a positive feedback loop where the development of soft skills reinforces the development of technical skills and vice versa.</p><p>But it’s true that there’s a learning curve to pairing. Think of picking up an unfamiliar musical instrument for the first time: at first it’s not much fun, as you fumble over fingerings and pick your way through unfamiliar notation, but it rapidly becomes more rewarding as you get comfortable with the basics.</p><p><strong>So with that in mind, think of these tips &amp; techniques as ways to help get over the discomfort of that initial curve and into a place where you can enjoy the benefits of pairing.</strong></p><h3>Describe what you’re doing</h3><p>If you’re typing silently while your pair sits and watches… well, you’re both probably not getting that much out of the session. Try to narrate your approach aloud as you code, so your pair can jump in with questions or comments.</p><p>This is not something that’s intuitive to most people, so it’s helpful to practice on your own (at the risk of looking like the maniac arguing with their computer in a coffee shop).</p><h3>“Yes, and…”</h3><p>You may have heard of this technique in the context of improv comedy, but it’s also a useful framework for most collaborative, idea-based work. Another way to say this is, <em>don’t shoot down ideas prematurely.</em></p><p>If the first thing you do every time you hear an idea is to start listing its flaws, the energy of the session will drop. Instead, try to extend the thought or add further information. If it’s a bad idea, that’ll be clear soon enough; you might find that it still nudges you towards the solution.</p><h3>Restate the problem</h3><p>When you disagree with someone over how to approach a problem, it can start to feel like you’re talking about different things entirely. Pause, and make sure you agree on what the problem actually is. This hits a reset button so you can approach the disagreement in a more constructive way.</p><h3>Pseudocode all the things</h3><p>If you’re driving, it’s easy to forget that it’s harder to read code than it is to write it. One way to address this is by putting the code in a form that’s easier to read. <a href="http://www.vikingcodeschool.com/software-engineering-basics/what-is-pseudo-coding">Pseudocoding out a solution</a> before starting to implement it lets you both examine it from a high level, where you’re better positioned to spot potential pitfalls.</p><h3>Choose the right problem</h3><p>Not all problems are well suited to pairing. High-level, complex problems are great for collaboration; lower-level, detail-oriented tasks, not so much. This can help you figure out when to end a pairing session and split off to work separately.</p><h3>Practice regular check-ins</h3><p>It’s easy to <a href="https://revelry.co/awesome-remote-pair-programming/">get caught up in the code</a> and forget about our weak human needs like<em> food</em> and <em>water</em> and<em> rest</em>, but for some reason, people don’t tend to produce great code when they’re exhausted and dehydrated. Asking your pairing partner how they’re feeling once in a while helps keep you both going by making sure you take breaks and switch roles as needed.</p><p>Once you’re ready to wade in further, check out Chelsea Troy’s great series on <a href="https://chelseatroy.com/2017/04/01/advanced-pair-programming-pairing-remotely">advanced pair programming</a>. And happy pairing!</p><p><em>Originally published at </em><a href="https://revelry.co/pair-programming-skills/"><em>revelry.co</em></a><em> on May 29, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6bfd79367356" width="1" height="1" alt=""><hr><p><a href="https://medium.com/revelry-labs/how-to-take-your-pair-programming-skills-to-the-next-level-6bfd79367356">How to Take Your Pair Programming Skills to the Next Level</a> was originally published in <a href="https://medium.com/revelry-labs">Revelry</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Set Up an HTML Email Development Workflow That’s… Better.]]></title>
            <link>https://medium.com/revelry-labs/make-html-email-development-in-rails-better-with-these-tools-e4e7cbf425a?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4e7cbf425a</guid>
            <category><![CDATA[email]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Fri, 03 Nov 2017 13:51:10 GMT</pubDate>
            <atom:updated>2018-01-30T19:01:26.331Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6Fhc1fGwBQRFwWCQil1ww.jpeg" /></figure><p>Ah, HTML email. What a special challenge you present. We’ve got best practices for CSS in emails, and then there’s best practices for modern web CSS.</p><p>This makes it a particular challenge to preview changes, and testing on different email clients gets time consuming quickly.</p><p>Let’s set up an email development workflow that looks more like the front-end development workflow you’re used to.</p><p>Or you can skip straight to the <a href="https://github.com/radditude/rail-html-email-setup">example Rails app</a> that I set up with all of these tools.</p><h3>HTML Email Development using Premailer &amp; Foundation</h3><p>Many email clients ignore externally linked stylesheets, so your best bet for compatibility is pretending that it’s 1998 and writing all your styles inline. <a href="https://github.com/fphilipe/premailer-rails">Premailer</a> makes this process suck less by letting you write your styles as normal stylesheets, then compiling them into inline styles when the email is sent. Plus, it’s compatible with Less and Sass (through the Rails asset pipeline). This means you can keep the syntax you’re used to.</p><p>Email CSS has compatibility issues that are completely separate from the browser compatibility issues we all know and love. So, it’s nice to start out with a set of tried-and-tested style rules to prevent reinventing the wheel. Enter <a href="https://foundation.zurb.com/emails.html">Foundation for Emails</a> and <a href="https://foundation.zurb.com/emails/docs/inky.html">Inky</a>, a framework and templating language for writing great HTML emails.</p><p>Foundation/Inky is available as a Ruby gem, so it’s ready to drop into Rails. You can find instructions for setting up Foundation and Premailer together <a href="https://foundation.zurb.com/emails/docs/gem-guide.html">here</a>.</p><p>Once you’ve installed both gems and generated an email layout and basic stylesheet with rails g inky:install, it’s time to make sure the Rails asset pipeline plays nice with your new setup.</p><h3>Asset Pipeline</h3><p>You have two options here:</p><ol><li>requiring foundation_emails in application.css so that Rails automagically precompiles it with your other stylesheets</li><li>configuring the asset pipeline to compile foundation_emails into its own file</li></ol><p>I’d recommend the second option, since otherwise your email styles will be mixed in with the styles for the rest of the application.</p><p>You can find this config option in config/initializers/assets.rb. Uncomment the line starting with Rails.application.config.assets.precompile and add foundation_emails.css to the array of files there.</p><p>Now your email styles will precompile into their own separate bucket and not interfere with the styling of the rest of the app.</p><h3>Level Up Your Foundation Setup</h3><p>Foundation’s templates and defaults are great, but you’ll probably want to use your own colors and settings. I used <a href="https://github.com/zurb/foundation-emails-template/blob/master/src/assets/scss/_settings.scss">this settings file</a> as a template for customizing Foundation’s default settings. Just make sure to import your settings file before foundation-emails in foundation_emails.scss.</p><p>And if you want to use Inky, Foundation’s templating language, you don’t have to give up erb. To tell Rails to run your email through both Inky and erb preprocessors, name your mailer view files with the extension .html.inky-erb (you can also use the .inky file extension, but I prefer .inky-erb for clarity).</p><h3>Set Up Email Previews</h3><p>One frustrating aspect of working on HTML emails is the need to resend the email each time you make a change. Luckily, Rails has built-in support for previewing emails using a special class in spec/mailers/previews (or test/mailers/previews, depending on your setup). Once you’ve followed the <a href="http://guides.rubyonrails.org/action_mailer_basics.html#previewing-emails">Rails Guide setup directions</a>, you’ll be able to view the email you’re working on in the browser and refresh to see changes.</p><h3>Testing</h3><p>With this setup, building HTML emails is as straightforward as working on any web page — at least until you get to the testing stage. There you’ll need one more tool that we love: <a href="https://litmus.com/">Litmus</a> is an email testing service that lets you preview your emails in different email clients so you can uncover those pesky bugs before they reach your customers’ inboxes.</p><p>That’s it! You’re all set for some less painful HTML email development in Rails. If you’d like to try out the tools mentioned here, there’s <a href="https://github.com/radditude/rail-html-email-setup">an example app</a> so you can see them in action.</p><p><em>Originally published at </em><a href="https://revelry.co/html-email-development-rails-tools/"><em>revelry.co</em></a><em> on November 3, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4e7cbf425a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/revelry-labs/make-html-email-development-in-rails-better-with-these-tools-e4e7cbf425a">Set Up an HTML Email Development Workflow That’s… Better.</a> was originally published in <a href="https://medium.com/revelry-labs">Revelry</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t Stop Asking “Bad Questions”.]]></title>
            <link>https://medium.com/revelry-labs/why-your-bad-questions-are-good-and-necessary-ccbcdc84e9f?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccbcdc84e9f</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[culture]]></category>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Wed, 30 Aug 2017 13:34:43 GMT</pubDate>
            <atom:updated>2019-05-21T18:38:22.867Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I1uZ4GPgYCUPQskgGL72Mw.jpeg" /></figure><p>Deep down inside, we probably all have a fear of being That Person. The one who asks a ton of annoying or obviously <em>bad questions.</em></p><p>We’ve seen the advice that is aimed at helping you to craft <em>good questions.</em></p><p>But I believe there’s a lot of value in asking not-so-great questions, especially when building software.</p><p>I’ve given a name to four different types of “bad” questions. (Hint: they’re all good questions, Brent.)</p><blockquote>Open-ended questions and questions that seem to be confirming the obvious can help interrogate assumptions and make sure we build the right thing, as well as building the thing right.</blockquote><h3>The “Nitpicky” Question: “Did you mean X?”</h3><p>Let’s say <a href="https://revelry.co/behavior-driven-development-bdd/">I have a story</a> for an admin user login with the following acceptance criteria:</p><ul><li><em>when I visit </em><em>/sign_in</em></li><li><em>and I enter my email and password</em></li><li><em>I am logged in and redirected to </em><em>/</em></li></ul><p>…but when building the login for regular users last week, we discussed admins having a separate home page at /admin.</p><p><strong>This feels like a nitpicky question.</strong></p><p>The AC writer probably meant /admin, after all. Taking a minute to make sure I’m on the same page, though, clarifies the issue for the whole team.</p><p>Odds are good that someone on the team will have the same question at some point.</p><p>The ticket will probably fail QA, for one thing, since QA uses the AC to determine what the expected behavior should be. Plus, another engineer working a related ticket may make the opposite assumption and end up with a lot of conflicts. Clarifying the issue now prevents a snowball effect of problems later.</p><h3>The “Badly Timed” question: “Sorry to interrupt…”</h3><blockquote>“We’re all set, I just need someone with admin access to add this integration to the repo.”</blockquote><blockquote>“Ask Jim — he’s the only admin on that, as far as I know.”</blockquote><p>In this hypothetical situation, there’s only one person with admin access, which isn’t something that happens terribly often at Revelry. But if it does come about, I can’t worry too much about finding the best possible time and context to ask at a time when I won’t be interrupting Jim — I owe it to my team and the project to spend as little time blocked as I can.</p><h4>This is where <a href="https://revelry.co/team/#core-values">Revelry’s Core Value</a> of <em>Earn and dispense trust</em> comes into play.</h4><p>I trust that if Jim needs interruption-free time, he’ll <a href="https://get.slack.help/hc/en-us/articles/218551977-Reduce-noise-in-Slack">mute notifications</a> or otherwise take steps to preserve his concentration and get back to me when he can. Jim in turn trusts me to judge whether I could ask my question in a public channel rather than asking him specifically.</p><h3>The “Inconvenient” question: “Why are we doing it like that?”</h3><blockquote><strong>While planning database relations</strong>: “So families have many children, and each child has one mother…”</blockquote><blockquote>“Why only one mother?”</blockquote><p>This is a bit of a silly example, but you get the idea. On the one hand, my coworker knows what they’re doing, and maybe they’ve already thought about how this database could handle complex or unconventional family relationships.</p><p>On the other hand, maybe they haven’t, and by questioning the assumption that children or families have one (and only one) mother, I’ve kept the product from excluding a lot of people and saved the team from having to spend a lot of time fixing this problem later.</p><h3>The “Fire Alarm” question: “The sprint commitment is in danger and I’ve been stuck on this mystery error for three hours but I think I’m really close…”</h3><p>I’ve probably progressed well into the profanity stage of debugging at this point, and I don’t have a specific question so much as an error message, a stack trace, and a pile of discarded theories.</p><blockquote>Besides, I know I can solve it in another half hour.</blockquote><p>Asking for help feels like a “bad question” because it can seem like I’m shifting the responsibility for the problem to someone else. The thing about these roadblocks, though, is that at some point when I’ve been staring at a problem for hours, what I really need to solve it is a change in perspective.</p><p>Sometimes I can get that from taking a break and distracting myself a bit so I can look at the problem in a new way, and sometimes I need to get an actual other perspective, which entails running the problem by another person. They might be able to point out something that I’ve missed.</p><h3><strong>You may have noticed a common theme: when in doubt, ask the question.</strong></h3><p>Best case scenario: you learn something and help the team improve. Worst case scenario: you won’t get an answer, in which case you’ve just learned something about how not to ask a question. Either way, you can move forward the wiser for the experience.</p><p><em>Asking dumb questions is the first step to asking smart ones.</em> [h/t Curtis!]</p><p><em>Originally published at </em><a href="https://revelry.co/asking-bad-questions-software-engineering/"><em>revelry.co</em></a><em> on August 30, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccbcdc84e9f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/revelry-labs/why-your-bad-questions-are-good-and-necessary-ccbcdc84e9f">Don’t Stop Asking “Bad Questions”.</a> was originally published in <a href="https://medium.com/revelry-labs">Revelry</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Poetry for Developers]]></title>
            <link>https://medium.com/@radditude/poetry-for-developers-4cf17cdf0ff9?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cf17cdf0ff9</guid>
            <category><![CDATA[humor]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[poetry]]></category>
            <category><![CDATA[slack]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Tue, 06 Jun 2017 05:01:54 GMT</pubDate>
            <atom:updated>2017-06-06T15:00:25.487Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Dux9mIOI2j9P535zOFFcWA.gif" /></figure><p><em>With apologies to </em><a href="https://www.poetryfoundation.org/poems-and-poets/poems/detail/47652"><em>Emily Dickinson</em></a><em>, </em><a href="https://www.poetryfoundation.org/resources/learning/core-poems/detail/44272"><em>Robert Frost</em></a><em>, and </em><a href="https://www.poetryfoundation.org/poems-and-poets/poems/detail/48860"><em>Edgar Allen Poe</em></a></p><h4><strong>Because I could not stop for tests</strong></h4><p>Because I could not stop for Tests — <br>They kindly stopped for me — <br>The Console held but just “Build failed” — <br>And failure Messages three.</p><p>I fixed the first — a Feature, broken<br>By a clever turn of Code — <br>I fixed the second, a Syntax error,<br>I fixed the third — oh no —</p><p>Since then — ’tis Centuries — and yet<br>One stubborn Test I see<br>I must surmise this Testing suite<br>Tests but my urgency</p><h4><strong>The Merge Conflict Not Taken</strong></h4><p>Two files diverged in a Git repo,<br>And sorry I could not include both<br>And have one project, long I stood<br>And thought through one as far I could,<br>To where it fell victim to JS growth;<br>Then picked the other, just as fair,<br>And having perhaps the better claim,<br>Since it used ES6 syntax, writ with care.<br>Oh, I kept the first for another day!<br>Yet knowing how change leads on to change,<br>I doubted if I should return to this git stash.<br>I shall be telling this with a sigh<br>In some blog post ages hence:<br>Two files diverged in a repo, and I — <br>I took the one more modernized,<br>And that has made all the difference.</p><h4><strong>The Slackbot<br><em>-or-<br></em>Accidentally Setting a Slack Reminder for Midnight Instead of Noon</strong></h4><p>Once upon a midnight dreary, while I pondered, weak and weary,<br>Over many a quaint and curious file of outdated code — <br>While I nodded, nearly napping, suddenly there came a tapping,<br>As of a Slack notification happening, happening on my laptop screen,<br>“’Tis some @here,” I muttered, “happening on my laptop screen — <br>Only this and nothing more.”</p><p>Back into the code returning, blinking dry eyes to stop the burning,<br>Soon again I heard a tapping just the same as came before.<br>“Surely,” said I, “surely that’s a general notification;<br>Let me see, then, what it is, and this mystery explore — <br>Let my heart be still a moment and this mystery explore; — <br>’Tis a general notification, and nothing more!”</p><p>Open then! I pulled up Slack, and then, with much alas, alack,<br>I saw a new DM awaiting — “It’s midnight, for God’s sake!”, I swore.<br>A server failure? A botnet attack? I closed my eyes and clicked it fast,<br>I read the message, blinked, and laughed; and felt relief set in at last,<br>For on the screen was naught but a reminder that I’d set that morn:<br>Quoth the Slackbot, “Nevermore.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cf17cdf0ff9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#DevDiscuss Recommends Programming Books]]></title>
            <link>https://medium.com/@radditude/devdiscuss-recommends-programming-books-880cfa5177a5?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/880cfa5177a5</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[book-recommendations]]></category>
            <category><![CDATA[programming-tips]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Wed, 19 Apr 2017 06:25:11 GMT</pubDate>
            <atom:updated>2017-04-19T06:25:11.825Z</atom:updated>
            <content:encoded><![CDATA[<p><em>First published on </em><a href="https://dev.to/radditude/devdiscuss-recommends-programming-books"><em>dev.to</em></a><em>.</em></p><p>Some people love programming books; some people hate them. I, clearly, am one of the former. And so while reading through the latest DevDiscuss Twitter chat, I started taking note of which books were most recommended by DevDiscussers.</p><p>The following are the greatest hits, collected in an easy-to-browse format with links to Amazon.</p><h4>The medalists: these three books had 5+ recommendations apiece.</h4><ul><li><a href="https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882"><em>Clean Code: A Handbook of Agile Software Craftsmanship</em></a> by Robert C. Martin</li><li><a href="https://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670"><em>Code Complete</em></a><em> </em>by Steve McConnell</li><li><a href="https://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X"><em>The Pragmatic Programmer: From Journeyman to Master</em></a> by David Thomas and Andrew Hunt</li></ul><h4>Books on project management and writing good code:</h4><ul><li><a href="https://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073"><em>The Clean Coder: A Code of Conduct for Professional Programmers</em></a><em> </em>by Robert Martin</li><li><a href="https://www.amazon.com/Coders-Work-Reflections-Craft-Programming/dp/1430219483"><em>Coders At Work: Reflections on the Craft of Programming</em></a> by Peter Seibel</li><li><a href="https://www.amazon.com/Mythical-Man-Month-Software-Engineering-Anniversary/dp/0201835959"><em>The Mythical Man-Month: Essays on Software Engineering</em></a> by Frederick Brooks</li></ul><h4>Books on refactoring and maintaining good code:</h4><ul><li><a href="https://www.amazon.com/Refactoring-Improving-Design-Existing-Code/dp/0201485672"><em>Refactoring: Improving the Design of Existing Code</em></a> by Martin Fowler</li><li><a href="https://www.amazon.com/Refactoring-Patterns-Joshua-Kerievsky/dp/0321213351"><em>Refactoring To Patterns</em></a> by Joshua Kerievsky</li><li><a href="https://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052"><em>Working Effectively with Legacy Code</em></a> by Michael Feathers</li></ul><h4>Books on software architecture and design patterns (language-agnostic):</h4><ul><li><a href="https://www.sandimetz.com/99bottles/"><em>99 Bottles of OOP: A Practical Guide to Object-Oriented Design</em></a> by Sandi Metz</li><li><a href="https://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445"><em>Agile Software Development: Principles, Patterns, and Practices</em></a><em> </em>by Robert Martin</li><li><a href="https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215"><em>Domain Driven Design: Tackling Complexity in the Heart of Software</em></a> by Eric Evans</li><li><a href="https://www.amazon.com/High-Performance-Browser-Networking-performance/dp/1449344763"><em>High Performance Browser Networking</em></a> by Ilya Grigorik (<a href="https://hpbn.co/">also available to read online</a><em>)</em></li><li><a href="https://www.amazon.com/Just-Enough-Software-Architecture-Risk-Driven/dp/0984618104"><em>Just Enough Software Architecture: A Risk-Driven Approach</em></a> by George Fairbanks</li><li><a href="https://www.amazon.com/Production-Ready-Microservices-Standardized-Engineering-Organization/dp/1491965975"><em>Production-Ready Microservices: Building Standardized Systems Across an Engineering Organization</em></a> by Susan Fowler</li></ul><h4>Non-technical books to inform your programming:</h4><ul><li><a href="https://www.amazon.com/dp/B004IK8PLE/ref=dp-kindle-redirect?_encoding=UTF8&amp;btkr=1"><em>The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography</em></a> by Simon Singh</li><li><a href="https://www.amazon.com/dp/B00E257T6C"><em>The Design of Everyday Things</em></a> by Don Norman</li><li><a href="https://www.amazon.com/dp/B0047Y0F0K"><em>Ghost in the Wires: My Adventures As the World’s Most Wanted Hacker</em></a> by Kevin Mitnick</li><li><a href="https://www.amazon.com/Innovators-Hackers-Geniuses-Created-Revolution/dp/1476708703"><em>The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution</em></a> by Walter Isaacson</li></ul><h4>Language-specific books:</h4><ul><li><a href="https://www.amazon.com/gp/product/1593275846"><em>Eloquent Javascript</em></a> by Marijn Haverbeke (<a href="http://eloquentjavascript.net/">also available to read online</a>)</li><li><a href="https://www.amazon.com/Hemingway-Wrote-JavaScript-Angus-Croll/dp/1593275854"><em>If Hemingway Wrote Javascript</em></a> by Angus Croll</li><li><a href="http://www.poodr.com/"><em>Practical Object-Oriented Design in Ruby: An Agile Primer</em></a> by Sandi Metz</li><li><a href="https://www.amazon.com/Programming-Ruby-1-9-2-0-Programmers/dp/1937785491"><em>Programming Ruby: the Pragmatic Programmer’s Guide</em></a><em> (</em>aka the Pickaxe Ruby book) by Dave Thomas, Andy Hunt, and Chad Fowler</li><li><a href="https://www.amazon.com/You-Dont-Know-Js-Book/dp/B01AY9P0P6"><em>You Don’t Know JS</em> series</a> by Kyle Simpson (<a href="https://github.com/getify/You-Dont-Know-JS">also available to read online</a>)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=880cfa5177a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LegisLately: A Tale of Angular and APIs]]></title>
            <link>https://medium.com/@radditude/legislately-a-tale-of-angular-and-apis-60bff5e765d2?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/60bff5e765d2</guid>
            <category><![CDATA[civictech]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[politics]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Sun, 02 Apr 2017 21:39:12 GMT</pubDate>
            <atom:updated>2017-04-02T21:39:12.458Z</atom:updated>
            <content:encoded><![CDATA[<p>The last time I built an SPA (with Rails and jQuery), I was <a href="https://blog.clarehorton.com/project-postmortem-flatcollab-part-2-6798f550b7b0">pretty down on the whole concept</a>. Performance wasn’t great, it broke the browser’s back button, and I was constantly fighting to keep my code from turning into callback nightmare spaghetti.</p><p>This time, I used Angular, and I’m thinking maybe SPAs are all right.</p><p>I learned a ton building this app. I worked with multiple external APIs, including one that went through some pretty significant changes during the building process; I tried a different approach to planning/preparing that mostly paid off; and I learned all the ins and outs of working with Angular and Rails.</p><h4>APIs ARE AMAZING. AND FRUSTRATING.</h4><p>I ended up working with 4 APIs during this project, not including my own Rails back end: the <a href="https://developers.google.com/maps/documentation/geocoding/start">Google Geocoding API</a>, the <a href="https://developers.google.com/civic-information/">Google Civic Information API</a>, the <a href="https://sunlightlabs.github.io/congress/index.html">Sunlight Congress API</a>, and the <a href="https://propublica.github.io/congress-api-docs/">ProPublica Congress API</a>. Only two of them are included in the final version of the project.</p><p>I got to learn first-hand the joys and hazards of relying on external APIs. Originally, I planned to use only the Sunlight API and the Google Geocoding API (to convert an address to latitude and longitude so the legislators/locate API call could find a user’s local senators and House rep). Calls to the SCAPI didn’t require a key, so I put all my API calls directly into the front end Angular code:</p><pre>function SCAPIFactory($http, $sce) {<br>   return {<br>     getComingSoon: getComingSoon<br>   }<br>   function getComingSoon() {<br>     return $http.get(&#39;https://congress.api.sunlightfoundation<br>       .com/upcoming_bills&#39;);<br>   };<br>}</pre><pre>angular<br>  .module(&#39;legislately&#39;)<br>  .factory(&#39;SCAPIFactory&#39;, SCAPIFactory);</pre><p><em>However</em>. Sunlight Labs shut down in November 2016. I didn’t realize it at the time, but the Sunlight Congress API was no longer being maintained and was in the process of being taken over and incorporated into ProPublica’s existing Congress API.</p><p>So about two-thirds of the way through my initial build, I realized I was going to have to migrate over to the ProPublica Congress API. <em>Easy</em>, I thought, <em>I’ll just change over the URLs.</em></p><p>But what to do about that API key? Obviously I couldn’t just have it sitting in a Javascript file, freely available to anyone with the slightest knowledge of Chrome Dev Tools. My next idea was setting up a Rails route on the back end to respond with the key whenever it was needed — but anyone who glanced at the code on GitHub would know just what path to follow to get it.</p><p>I couldn’t set up an entire set of back end routes just to bounce these external API calls… could I? That seemed so… inefficient.</p><p>And yet there’s just no way to truly conceal an API key if it’s ever in front-end code.</p><p>So I rewrote large chunks of the front and back ends to allow the external API calls to be made via Rails and Faraday, with the API key nicely concealed via an environment variable. Now my external API calls look something like this:</p><pre>def info<br>    legislator_id = params[:id]<br>    url = &quot;<a href="https://api.propublica.org/congress/v1/members/#{legislator_id}.json">https://api.propublica.org/congress/v1/members/#{legislator_id}.json</a>&quot;<br>    <a href="http://twitter.com/resp">@resp</a> = Faraday.get url do |req|<br>      req.headers[&#39;X-API-Key&#39;] = ENV[&#39;PROPUBLICA_API_KEY&#39;]<br>    end</pre><pre>    body_hash = JSON.parse(<a href="http://twitter.com/resp">@resp</a>.body)<br>    legislator = body_hash[&#39;results&#39;][0]<br>    render json: legislator<br>end</pre><p>Instead of making a request directly to the external API, an Angular factory makes a call to the back end, which grabs the API key and makes the external API call, then returns the data through Rails to the front end. Complex, but hey — the whole concept of having freely available data you can get just by sending an HTTP request is pretty mind-boggling.</p><h4>NEATEST TRICK LEARNED</h4><p>If you’ve worked with Bootstrap before, you may be familiar with the somewhat laborious process of attempting to change or override the default colors/fonts/etc to make it look a little less Bootstrappy.</p><p>But I have good news — you don’t have to abuse the !important rule in your CSS anymore! If you use the <a href="https://github.com/twbs/bootstrap-sass">bootstrap-sass</a> gem, you can redefine Bootstrap colors, fonts, spacing and more with Sass variables right there in your application.scss. Just make sure you put in the variable declarations before you @import &quot;bootstrap&quot;. Like so:</p><pre>$body-bg: #0971B2;<br>$headings-font-family: &#39;Open Sans Condensed&#39;, sans-serif;<br>$headings-font-weight: 300;<br>$headings-color: #FEFFFE;</pre><pre>@import &quot;bootstrap&quot;;</pre><p>For a full list of Bootstrap variables and defaults, go <a href="http://getbootstrap.com/customize/#less-variables">here</a>.</p><h4>WORKFLOW EXPERIMENTS</h4><p>I tried out a new approach by completely separating out design and application logic for the first phase of this project. That is to say, I built out the entire initial app in plain text. No styling whatsoever until the app logic was pretty well fleshed out.</p><p>This worked really well for me because I work best when I can concentrate deeply on one problem at a time. In the past, I’ve tried to build the design alongside the logic and ended up feeling scattered and distracted (plus the time suck of trying to redesign things on the fly when I was in the middle of working out a thorny technical problem).</p><p>This approach definitely wouldn’t work well with a team, but it was an interesting experiment for a solo project. Apparently separation of concerns is good for workflows too! Who knew?</p><h4>RESOURCES</h4><p>Aside from the amazing APIs mentioned above, I took advantage of a variety of excellent resources while building this app:</p><ul><li><a href="https://www.getpostman.com/">Postman</a>: a Chrome extension/app that allows you to test out API calls and configure headers, params, etc.</li><li><a href="https://www.sitepoint.com/setting-up-an-angular-spa-on-rails-with-devise-and-bootstrap/">This excellent rundown</a> on how to use Devise for authentication in a Rails/Angular app.</li><li>This list of <a href="http://getbootstrap.com/customize/#less-variables">Bootstrap variables and defaults</a> (also linked above).</li><li>Too many Stack Overflow answers to link here.</li></ul><blockquote>To explore the code for this project, check it out on <a href="https://github.com/radditude/legislately">GitHub</a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60bff5e765d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project Postmortem: FlatCollab Part 2]]></title>
            <link>https://medium.com/@radditude/project-postmortem-flatcollab-part-2-6798f550b7b0?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/6798f550b7b0</guid>
            <category><![CDATA[babeljs]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Sun, 05 Feb 2017 09:48:48 GMT</pubDate>
            <atom:updated>2017-02-05T10:57:51.876Z</atom:updated>
            <content:encoded><![CDATA[<h4>JavaScript &amp; jQuery Edition</h4><h4>Wait, didn’t we have this blog post already?</h4><p>I did do <a href="https://blog.clarehorton.com/flatcollab-a-rails-app-for-group-projects-4dee356250d2#.426pn1946">a post about FlatCollab</a> already, it’s true. However, the original FlatCollab was only Rails, HTML, and CSS — the front end was a series of static pages.</p><p><a href="https://flat-collab.herokuapp.com/">FlatCollab 2</a> has a nice spiffy new front end that uses jQuery and AJAX calls to render all of FlatCollab’s functionality as a single page app. The Rails backend is now mostly used as an API, rendering JSON responses which the front end processes into JavaScript model objects.</p><h4>It looks pretty much the same.</h4><p>I didn’t change much about the design other than adding a handful of animated UI features (like the dropdown menu in the navbar, which formerly was CSS-only).</p><p>Behind the scenes, though, it’s totally rebuilt. Instead of loading an entire new page of HTML when the new task form is submitted, JavaScript is there, ticking away behind the scenes. Our helpful little script takes the values from the form, sends them to the backend via an AJAX call, and gets back a JSON response with the newly persisted task. Then it can add that one little piece of HTML to the list of tasks, instead of reloading the entire page and hitting the database with another collection query.</p><h4>Single page apps suck.</h4><p>Now you’re just being negative.</p><p>It’s true, though. I didn’t really realize how annoying they were from a UX perspective until I spent a lot of time testing AJAX calls on inner pages of FlatCollab.</p><p>Since you’re not actually loading a separate URL for each page, you can’t link directly to the page you want. You have to click through all the intervening navigation steps to get anywhere. Plus, it breaks the back button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3nolcpiCkjl2QiBvrVmaeg.png" /></figure><p>So, while it was good experience and it’s fun to say that I built an SPA, there’s no use in SPA for its own sake. The next iteration of FlatCollab is going to include a little rebuild so it doesn’t break important browser UX features.</p><h4>What was the hardest thing about the rebuild?</h4><p>Definitely the timing. I started working on this project on January 21… yeah, the day after the inauguration. Given what was happening in the news, I wasn’t at my most focused.</p><p>Once I took a break from reading the headlines on Twitter and got my head back in the game, though, it was a great distraction. There’s nothing like debugging a silently failing AJAX call to make you forget all your other troubles.</p><h4>What did you learn during this project?</h4><p>This is the most JavaScript-intensive project I’ve done so far, and I really gained a new appreciation for all the cool stuff JavaScript can do.<br> <br>JS was tough for me to get a handle on at first. I’ve done a good bit of JS work before, but I didn’t really get to experience how flexible the language is and how many ways it can be applied. But now I feel a lot more comfortable with all the various ways to move data from client to server and back again.</p><h4>What’s a cool trick you learned while building FlatCollab 2?</h4><p>I wanted to do some conditional formatting on the client side — showing the edit button only if a post belonged to the current logged in user, for example. But I couldn’t think of a good way to pass the current user’s id from the controller to the view.</p><p>As it turned out, the answer was on Stack Overflow. Why do I even bother Googling stuff when I could just search SO?</p><pre># /application.html.erb</pre><pre># at the very bottom of the file<br># just above the closing &lt;/body&gt; tag</pre><pre>&lt;script&gt;<br>  window.currentUser = {<br>    id: &lt;%= current_user.id %&gt;<br>  }<br>&lt;/script&gt;</pre><p>It’s a neat trick. The erb gets rendered server side, replacing &lt;%= current_user.id %&gt; with the actual id. Then, since this is in the application layout which gets loaded for every page, each page has a currentUser.id that can easily be referenced in your client-side code.</p><p>Another thing which I’m not sure qualifies as “cool,” exactly: when getting ready to deploy to Heroku, I found out that Rails’ default JS minifier, Uglify, doesn’t play nice with ES6 syntax, which caused asset precompiling to fail on my ES6 classes and methods.</p><p>My options for <a href="https://www.stevefenton.co.uk/2012/11/compiling-vs-transpiling/">transpiling</a> my ES6 code to something that plays nicely with the Rails asset pipeline were basically either webpack or Babel. Webpack seemed like overkill for a lightweight application like this, though, and since I’m using Rails 5, a lot of the resources on the web for using Babel with Rails are out of date. Thanks to <a href="http://9elements.com/io/babel-rails-5-and-sprockets-4/">this excellent tutorial</a> from <a href="http://9elements.com/">9elements</a>, I was able to get Babel configured with Rails 5 and have a fully-functioning asset pipeline to deliver my CSS and JavaScript files.</p><p><em>You can see the new, improved, Javascripted version of FlatCollab in all its single-page glory at </em><a href="https://flat-collab.herokuapp.com/"><em>https://flat-collab.herokuapp.com/</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6798f550b7b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Debugging Diaries: Javascript Testing with PhantomJS]]></title>
            <link>https://medium.com/@radditude/the-debugging-diaries-javascript-testing-with-phantomjs-cc69afb851b7?source=rss-293ad9375687------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc69afb851b7</guid>
            <category><![CDATA[phantomjs]]></category>
            <category><![CDATA[debugging-diaries]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[CJ Horton]]></dc:creator>
            <pubDate>Wed, 18 Jan 2017 05:43:51 GMT</pubDate>
            <atom:updated>2017-01-18T05:43:51.465Z</atom:updated>
            <content:encoded><![CDATA[<p>The Flatiron School uses a test-driven learning process. For each lesson, students are given a set of tests and write their code to make the tests pass. Once the tests pass, you pass the lesson.</p><p>In this particular lesson, I was working with Javascript, and it was going swimmingly right up until I tried to run my tests.</p><p>I had two options for running the <a href="https://jasmine.github.io/">Jasmine</a> tests:</p><ol><li>I could run my code and the tests in Chrome by using the command learn -b.</li><li>I could run the tests with <a href="http://phantomjs.org/">PhantomJS</a>, a “headless” browser and the default runner for Jasmine tests, using the command learn.</li></ol><p>I was using learn -b to run the tests in the browser, and finally got them all passing. After doing a short victory dance, I remembered I still needed to run them using learn (aka with PhantomJS)…</p><p>They all failed. Every last one.</p><p>I was floored. I ran them in the browser again — all passing! I ran them using PhantomJS again, and my terminal did the computer equivalent of flipping me the bird.</p><p>There were no errors in the browser console, so I felt I could safely rule out typos and simple syntax errors. I started refactoring and rephrasing things, checking that all my variables were declared with appropriate scope and using debugger to check return values.</p><p>I came up empty-handed. Apparently Jasmine and/or PhantomJS had a personal grudge against me.</p><p>I compared notes with another student. His code looked more or less identical to mine, except instead of string interpolation:</p><pre>var value = &quot;This is a&quot;;<br>var string = `${value} string`;<br>&lt;&lt; &quot;This is a string&quot;</pre><p>He used concatenation:</p><pre>var value = &quot;This is a&quot;;<br>var string = value + &quot; string&quot;;<br>&lt;&lt; &quot;This is a string&quot;</pre><p>Somewhat suspicious, I made the changes to my code and ran learn.</p><p>It worked! But why?</p><p>This turned out to be a surprisingly tricky error to research. After some intense dives into the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript">Mozilla Developer Network</a> and googling various combinations of “Javascript Jasmine PhantomJS string interpolation fail”, I started to find some StackOverflow answers that pointed me in the right direction.</p><p>As a relative newcomer to Javascript, I hadn’t realized that string interpolation was a brand new feature of the language, courtesy of the <a href="http://es6-features.org/">ES6 release</a> in 2015. And as it turns out, PhantomJS hasn’t yet been updated to support ES6 syntax. In PhantomJS, my fancy string interpolation pretty much did this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*DLFmjwjLaOJb4kT6BOtlKw.gif" /></figure><p>…which was a bummer, since string interpolation is much nicer to work with than string concatenation. But armed with the <a href="http://es6-features.org/">ES6 feature list</a>, I was ready to tackle this problem when it showed up again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*DGmNAD0gLLG-tCcuEfPKIQ.gif" /></figure><p><em>The 2.5 release of PhantomJS is </em><a href="https://github.com/ariya/phantomjs/issues/14506"><em>scheduled to add support for ES6</em></a><em>. All rejoice!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc69afb851b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>