<?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 Caleb Taylor on Medium]]></title>
        <description><![CDATA[Stories by Caleb Taylor on Medium]]></description>
        <link>https://medium.com/@caleb89taylor?source=rss-8f2668739633------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*NEYn-U5a7vKeYDjLjIlGAg.jpeg</url>
            <title>Stories by Caleb Taylor on Medium</title>
            <link>https://medium.com/@caleb89taylor?source=rss-8f2668739633------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:03:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@caleb89taylor/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[Writing Effective Tests for Modern Web Apps]]></title>
            <link>https://caleb89taylor.medium.com/writing-effective-tests-for-modern-web-apps-48a69e34f06b?source=rss-8f2668739633------2</link>
            <guid isPermaLink="false">https://medium.com/p/48a69e34f06b</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Caleb Taylor]]></dc:creator>
            <pubDate>Sat, 17 Apr 2021 22:55:19 GMT</pubDate>
            <atom:updated>2021-04-20T02:09:34.872Z</atom:updated>
            <content:encoded><![CDATA[<p>Testing modern web apps can be challenging. There are many variations of tests — unit, integration, acceptance, end-to-end — and knowing which ones to use can be difficult. This article will cover patterns I use to test my web apps using unit and integration tests. The integration tests will closely simulate a real user’s journey through the app but will have no dependencies on external systems.</p><p>This means the tests will run quickly and be less brittle than end-to-end tests, but will also provide a high level of confidence that your app is working correctly. The patterns used in these tests are very flexible and allow your tests to be decoupled from the implementation details of your code. This means you can refactor your code without creating a “false negative”, where the code is correct but the test fails due to some tight coupling between the test and how the code was implemented.</p><blockquote><strong>Important: </strong>This article will cover high-level patterns and testing strategies. It will not be a step-by-step guide on writing tests. The examples will use libraries like <a href="https://jestjs.io/">Jest</a>, <a href="https://testing-library.com/">Testing Library</a>, <a href="https://www.npmjs.com/package/jest-fetch-mock">jest-fetch-mock</a> and more, but I will only mention the relevant pieces and leave the details to the docs for each respective library.</blockquote><h3>The Example App</h3><p>To start, let’s say that we are building a user authentication flow for our web application. This involves showing the user an input field on the first screen for the user’s email. If we find that the user’s email exists in our system, we show them a password input field. If not, we show them a join form. The user will start on the /lookup view, and then end up on either the /join or /challenge view depending on whether or not they have an account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGGQb-QycjmNzHjsbnxm2A.jpeg" /><figcaption>Basic user flow for our simple authentication web app</figcaption></figure><p>This provides us with a fairly simple user experience that can still benefit from both unit and integration tests. We’ll leave some of the implementation details out (like the UI) and focus on how we would test this application effectively to ensure it works as expected.</p><h3>Mocking HTTP Requests the Right Way</h3><p>To start, we know that we will need to make an API call to look up a user in our system by their email address. Let’s make a basic module to handle making that API call for us.</p><p>Let’s put the file at src/app/api/lookup/index.ts. It may look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ncrgcKapS0Kh3M21EmyXEA.png" /><figcaption>Example module that handles making API requests</figcaption></figure><p>Under the hood, the Http object from @core/http is just a utility class that handles common HTTP logic for our application. Things like setting up the base API domain based on environment variables, setting common HTTP headers, parsing the response, firing analytic events, etc...</p><p>When it comes to mocking, generally it’s best to mock at the “edge” of the thing you are testing. For a web application, this means you can mock actual HTTP requests instead of mocking a code module. If you don’t do this, I can personally attest to how brittle mocking modules can be. I’ve built up large, complex tests using something like j<a href="https://jestjs.io/docs/es6-class-mocks">est module mocking</a>. I then used a <a href="https://enterprisecraftsmanship.com/posts/styles-of-unit-testing/">collaboration verification</a> style of testing to basically assert <em>“Did </em>moduleA<em> call </em>moduleB <em>with the correct arguments?”.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*_CJel-9ebwVUEAZNfTf_AQ.jpeg" /><figcaption>Image from <a href="https://enterprisecraftsmanship.com/posts/styles-of-unit-testing/">enterprisecraftmanship.com</a></figcaption></figure><p>It was like building a house of cards. Instead of validating app functionality, tests were asserting how the code was structured. This leads to some of the most useless, tightly-coupled tests you could possibly imagine. The slightest code change would cause tests to start triggering false negatives.</p><p>The main idea is that <em>how</em> the code is structured isn’t the thing we want to test. At the end of the day, we care that the app functions correctly. This means that we expect an HTTP request to be sent in the correct format and that our app correctly handles all the various responses that could come back.</p><p>By mocking the HTTP request itself, the underlying code is free to be refactored without failing tests that shouldn’t fail. Let’s look at how we would write a unit test of this module by looking at how we approach mocking HTTP requests.</p><h3>Use a Single, Global Mock Object</h3><p>Mocking HTTP calls in tests is a very common pattern. However, it is easy to do this in a way that becomes messy and prone to errors.</p><p>As your application grows, there is a good chance that you might make the same API call from different places in your code. If you redefine the HTTP mock in individual test suites, you increase the chance for bugs.</p><p>For example, what happens when the API response changes? You have to update each test that mocked that response and hope you catch all of the places it is used. If you happen to miss a place where the mock is incorrect, that test is asserting on incorrect data.</p><p>To address this, we use a <strong>single, global mock </strong>for each of our API calls. Per our convention, all of our modules that make API calls are located in the api directory. For each of those modules, we can add a __mocks__ directory that contains a module with the “definition” for that network call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*Gh2464lRB1s8Bk1pkkrafA.png" /><figcaption>Project structure for tests and global mocks</figcaption></figure><p>The mock object includes both the response and the request payloads, as well as any of the variations that are needed for testing. You can use user-friendly keys for the uses cases like userNotFound to make it easier to see what was being mocked. Here is an example mock for the lookup module we defined earlier. This mock would be located at src/app/api/lookup/__mocks__/lookup.ts .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OgYKhn9TWT7tAdVXvhvsEA.png" /><figcaption>Example snippet of mock file for the lookup API call</figcaption></figure><p>Now, we can use this global mock for both unit and integration tests.</p><h3>Writing a Unit Test for the API module</h3><p>Unit tests are a great way to ensure that individual modules are functioning as expected. These tests don’t provide as much value in ensuring the entire app functions correctly, but they can help developers build components effectively.</p><p>As an example, let’s write a unit test for the lookup API module. This example unit test would be located in src/app/api/lookup/__tests__/index.spec.ts .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sKDJXAHHT8LMnPlqVqs8iA.png" /><figcaption>Example Jest unit test for the lookup API module</figcaption></figure><p>The above example only tests a single flow for the lookup module, but it should give you an idea of the basic structure. The global mock is used in combination with <a href="https://www.npmjs.com/package/jest-fetch-mock">jest-fetch-mock</a> to mock the underlying HTTP request. Now you can do assertions on the module’s response and verify the structure of the HTTP request.</p><h3>Writing an Integration Test</h3><p>Unit tests are nice, but to really test our application, we want to have integration tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*fhMJQP4jbVtWoFF3ubD4SQ.png" /><figcaption>Source: <a href="https://twitter.com/rauchg/status/807626710350839808">https://twitter.com/rauchg/status/807626710350839808</a></figcaption></figure><p>Why are integration tests valuable? They validate that individual modules interact correctly with each other. It is very easy to incorrectly tie modules together with mistakes in code. I have personally made mistakes in the past that involved writing code that simply did not work, even though the unit tests all passed.</p><p>After all, a single module in isolation usually does nothing for a user. In the end, it’s a collection of many modules or pieces of code interacting together that provide benefit to the user.</p><p>Having said all of that, integration tests are inherently more complex than unit tests. There are more pieces of code under test, and as a developer, you still have to decide how to group functionality into an integration test. I’ve found that one nice rule of thumb is to look at it from the user’s perspective. In the case of our example app, we can effectively write integration tests for each view in our app.</p><p>From the diagram above, we can write integration tests for the major flows for the lookup view. In general, it will look like this:</p><ol><li>Start on the lookup view</li><li>Set up the mocks for the HTTP request for the /user/credential_available/v1 call</li><li>Type in an email for the user and click submit</li><li>Assert that the expected things happened in your app</li></ol><p>Notice this plan makes very few assumptions about the underlying code. We have a starting point, and we know we have to mock an API call, but we are triggering all of the behavior just like a user would. Let’s dig a bit more into simulating user interaction.</p><h4>Simulating User Interaction</h4><p>When writing integration tests, it used to be tricky to simulate user behavior. But interacting with your application like a user would is an important factor to having tests that provide value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*7Dn2orW3zHzdQ5QpMZT9kA.png" /><figcaption>Source: <a href="https://twitter.com/kentcdodds/status/977018512689455106">https://twitter.com/kentcdodds/status/977018512689455106</a></figcaption></figure><p>This is the <a href="https://testing-library.com/docs/guiding-principles">guiding principle</a> for the <a href="https://testing-library.com/">Testing Library</a>. One of the big benefits of this strategy is that you can ensure that all of your UI pieces are correctly hooked up to the code. I’ve run into bugs in my career where I was testing a user flow by manually invoking code that I <em>assumed </em>would be invoked on a button press, but I had unfortunately made a mistake and never actually hooked the button up correctly to invoke the code.</p><p>Using something like the <a href="https://github.com/testing-library/user-event">user-event</a> library can help us simulate user behavior in a straightforward way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G5Fy6YZbqOW5ARJWsym_JQ.png" /></figure><p>While this works great, there is a small drawback. For each event, we have to grab the element to perform the action on. This is simple to do, but what happens as your test suite grows? The same thing that can happen with the mocking of HTTP requests. If you grab the same element in multiple tests (or even test suites), but then you have to change the HTML structure of that element, you break a lot of tests.</p><p>This once again creates a <a href="https://en.wikipedia.org/wiki/Coupling_(computer_programming)">coupling</a> between our tests and implementation details in the code. In this case, it’s the structure of the HTML. Let’s see if we can decouple that in a scalable way.</p><h4>Using a Page Model</h4><p>In order to decouple our tests from the HTML structure of the underlying app, I recommend using a <a href="https://martinfowler.com/bliki/PageObject.html">Page Model</a>. By creating an interface over your HTML, the test can then rely on that interface instead of knowing about the structure of the app’s HTML. These page models can be stored with the view under the __tests__ directory for each view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*muqScdVWfbv42JVS7G8nIQ.png" /><figcaption>Project structure for view page models and integration tests</figcaption></figure><p>Let’s look at an example page model for the lookup view located at src/app/components/views/Lookup/__tests__/LookupPage.ts :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pgmtlas30EVfbpaZSurXPg.png" /><figcaption>Simple page model class for the lookup view</figcaption></figure><p>This page is relatively simple, but you can see how this would become much larger for a complex page. You can even extend this page model by having each model extend a base PageModel class like the above example. That base PageModel class can contain base functionality that might be consistent across all views. An example of this might be a method to assert if an error is visible if you implemented errors consistently across your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v30z-P0vyKhFy-Zu44TcxA.png" /><figcaption>Example base PageModel class that other page models can extend</figcaption></figure><h4>Putting It All Together</h4><p>Now let’s take all of the individual pieces we’ve covered and put it all together for an integration test for the lookup view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ji3Mwt5q4xQX7g84RVwOeg.png" /><figcaption>An integration test for the case where a user’s email is found</figcaption></figure><p>This test is a little bigger, but most of it should look familiar by now. One of the new pieces is the use of <a href="https://reach.tech/router/https://www.npmjs.com/package/@reach/router">@reach/router</a> to handle routing for our app. The renderWithRouter method is a utility method from the <a href="https://testing-library.com/docs/example-reach-router/">@testing-library docs</a>. This allows us to assert that the app is correctly routing to pages as expected. Just like with our unit tests, we are using the global mock and <a href="https://www.npmjs.com/package/jest-fetch-mock">jest-fetch-mock</a> to mock our HTTP requests.</p><p>Now that we’ve mocked the edge of our application (HTTP requests) and the minimal amount that we need in order to assert functionality (reach router mocking), we can simulate our user behavior and interact with our app. We use the LookupPage page model class to interact with the HTML, and the <a href="https://github.com/testing-library/user-event">user-event</a> library to simulate user behavior to interact with our page.</p><p>Because the HTTP request was mocked to “find” the user in our system, the user should then be redirected to the /challenge view. That is our main assertion in this test. While this seems simple, we have just tested many modules working together correctly from the user’s point of view. We did this with minimal mocking, and our test will be incredibly resilient to any code refactors that may happen.</p><h3>Conclusion</h3><p>Using the techniques described in this article, you can create flexible tests that give you a high degree of confidence in your app. To recap the main points:</p><ol><li>Stop mocking at the code level and mock at the network level</li><li>Use a single object as the source of truth for a network call’s mock</li><li>Use a consistent project structure for tests, mocks, and models for maintainability</li><li>Use a Page Model/Object pattern for more flexible interactions between tests and HTML elements</li><li>Simulate real user behavior in your tests to give you higher confidence in your tests</li><li>Integration tests can provide massive amounts of value for web apps while still being implementation-agnostic</li></ol><p>I’ll add the caveat that not all of these techniques make sense for every project. There will always be different use cases, but there is a good chance you can find value from these techniques, even if you don’t always use them all.</p><p>Thanks for reading, and please let me know if you have any feedback or thoughts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48a69e34f06b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A guide to modern Web Development with (Neo)vim]]></title>
            <link>https://caleb89taylor.medium.com/a-guide-to-modern-web-development-with-neo-vim-333f7efbf8e2?source=rss-8f2668739633------2</link>
            <guid isPermaLink="false">https://medium.com/p/333f7efbf8e2</guid>
            <category><![CDATA[vim]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Caleb Taylor]]></dc:creator>
            <pubDate>Thu, 18 Apr 2019 16:25:42 GMT</pubDate>
            <atom:updated>2019-04-18T17:08:35.966Z</atom:updated>
            <content:encoded><![CDATA[<p>There are a lot of great editors out there that provide a ton of features for web development. Recreating those features in Vim has always been a challenge. I love Vim, but I’ve also dedicated a <strong><em>ton</em> </strong>of time to tweaking my setup. This article is a summary of the result of my work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwtBkUpu7nSToAEP8N2IOQ.png" /><figcaption>Jarvis in action</figcaption></figure><p>I use <a href="https://github.com/neoclide/coc.nvim">coc.nvim</a> and <a href="https://github.com/Shougo/denite.nvim">denite</a> to power my coding experience. Denite is used to fuzzy find files, manage open files, and search your project. Coc.nvim drives the <a href="https://docs.microsoft.com/en-us/visualstudio/ide/using-intellisense?view=vs-2019">intellisense</a> engine by wrapping many of the same core extensions that drive the <a href="https://code.visualstudio.com/">VSCode IDE</a>. For my full setup, including how I configure these plugins and more, check out <a href="https://github.com/ctaylo21/jarvis">my dotfiles</a>.</p><blockquote><strong>Note</strong>: I’ll just reference Vim in this article, but I actually use <a href="https://neovim.io/">Neovim</a>. The plugins all work with Vim as well — depending on the version — but things like the “floating window” feature will be specific to Neovim.</blockquote><h3><strong>Intro</strong></h3><p>I write TypeScript/JavaScript on a daily basis, and I know how stark the difference is between Vim and an editor like VSCode out of the box. There are many features available in modern editors that take time, expertise, and/or plugins to achieve in Vim.</p><p>I’ve created the following list of features that I expect out of a modern editor. Standard editor features (like syntax highlighting) aren’t included.</p><ol><li><strong>Fuzzy File Finding</strong> — If you know the file name in the project, you should be able to open it quickly (such as — two keystrokes + minimum number of characters to unique filename).</li><li><strong>File Switching</strong> — You should be able to see open files, and quickly switch between open files, both with fuzzy finding and manual browsing.</li><li><strong>Linting</strong> — Code linting should be automatic<strong> </strong>and fast<strong>, </strong>and you should be able to use a code fixer.</li><li><strong>Project Searching</strong> — You should be able to search for an arbitrary string, search for a symbol, find definitions, and find usages of a symbol.</li><li><strong>Code Intellisense </strong>— Having your IDE provide relevant, seamless suggestions and auto-completions can be a huge boost to productivity. In my opinion, the “white whale” for most Vim users.</li></ol><p>Getting all of these things working in Vim can be a pain. There are tons of plugins to choose from, configurations to tweak, and docs to read. After 7 years of trial and error, I’ve finally got my setup to a great place. The best part?</p><p><strong>I’m going to show you how to get all of the core functionality with just two plugins.</strong></p><p>I won’t be covering every feature of these awesome plugins, or listing all the possible alternatives (and there are a lot of great ones). I will focus on highlighting the core functionality I use, as well as any mappings or configurations I use to elevate the experience.</p><p>So without further ado, let’s get to it.</p><h3><strong>Denite</strong></h3><p><strong>What you get:</strong> Fuzzy file finding, file management, project searching</p><p>I’m not going to lie, <a href="https://github.com/Shougo/denite.nvim">Denite</a> is pretty insane. Just take a look at <a href="https://github.com/Shougo/denite.nvim/blob/master/doc/denite.txt">the docs</a>. At a basic level, it provides a fuzzy-finding layer on top of a bunch of core functionality. It was built by the legendary <a href="https://github.com/Shougo">Shougo</a>, a Jedi master of Vim.</p><p>Denite is built on <a href="https://github.com/lambdalisue/neovim-prompt">lambdalisue/neovim-prompt</a>. It has a full-featured interface that can take a while to get used to. You can create custom menus, and use many custom sources with Denite as a layer on top.</p><h4><strong>Basics</strong></h4><p>I primarily use <a href="https://github.com/Shougo/denite.nvim">Denite</a> for finding files in my project, and managing my open files. I have configured Denite to use <a href="https://github.com/BurntSushi/ripgrep">ripgrep</a> to power my searching. You can see <a href="https://github.com/ctaylo21/jarvis/blob/master/config/nvim/init.vim#L58">how I’ve configured</a> it in my setup.</p><p>I have all of key features mapped for quick and easy access. The keys I use for these mappings are just personal preference, and should be customized per user. I use the “floating window” option for my Denite mappings, but other variations are supported as well (like horizontal/vertical splits).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba8951dc282f3f4d7344321527eb220b/href">https://medium.com/media/ba8951dc282f3f4d7344321527eb220b/href</a></iframe><h4><strong>Managing Open Files</strong></h4><p>; brings up a list of currently open files. You can start typing and it will allow you to fuzzy-search through your current open files. With the file list open,&lt;ctrl&gt;o lets you browse the list like you are in normal mode, where you can open and/or delete any files from the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*oVQVFnE9i41t_tmK9chiUQ.gif" /><figcaption>Managing open buffers with Denite</figcaption></figure><h4><strong>Fuzzy Finding Files</strong></h4><p>&lt;leader&gt;t fuzzy-searches files in the current directory. With ripgrep, any files in your .gitignore are also ignored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*YiZ9RVBkO1xunJW8V3_DoQ.gif" /><figcaption>Fuzzy-finding files in the current directory</figcaption></figure><h4><strong>Project Searching</strong></h4><p>&lt;leader&gt;g and &lt;leader&gt;j search the entire project for a given term, and searching the term under cursor, respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*bwBvzXB5iv94W7KCmvwK8w.gif" /><figcaption>Searching with Denite</figcaption></figure><h4><strong>Configuration</strong></h4><p>Denite can be a pretty tough tool to wrap your head around. It’s well documented, but it does reference some concepts that may be unfamiliar to most users. All of my <a href="https://github.com/ctaylo21/jarvis/blob/master/config/nvim/init.vim#L58">Denite configurations</a> are documented in my setup, so you should be able to use it as a reference. Here’s a quick sample of configuring the base options of Denite for things like customizing highlight groups and layouts.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/617fc260147a08fc7376c4070f5212dd/href">https://medium.com/media/617fc260147a08fc7376c4070f5212dd/href</a></iframe><h3>Coc.nvim</h3><p><strong>What you get:</strong> Intellisense code engine, auto-completion, linting, code fixing</p><p>One of the biggest challenges with modern development in Vim is setting up <a href="https://en.wikipedia.org/wiki/Intelligent_code_completion">intellisense code completion</a>. Most modern editors like <a href="https://code.visualstudio.com/">Visual Studio Code</a> come with intellisense engines built in, or easily available with a plugin (with minimal setup).</p><p>I have tried a few solutions, and <a href="https://github.com/neoclide/coc.nvim">coc.nvim</a> is the best I’ve used. It comes with several major features that are the crux of bringing Vim to the same level as modern IDEs.</p><p>There are a few main reasons I think it’s one of the better solutions to intellisense in Vim:</p><ol><li>It was <strong>incredibly</strong> easy to setup, and immediately worked with both my TypeScript and JavaScript projects.</li><li>It’s built upon <a href="https://langserver.org/">language servers</a>, which power intellisense in many modern editors.</li><li>Language server extensions like <a href="https://github.com/neoclide/coc-tsserver">coc-tsserver</a> are built on top of the <a href="https://github.com/Microsoft/vscode/tree/master/extensions/typescript-language-features">TypeScript/JavaScript code extension</a> that is built into VSCode. So as VSCode server extensions improve, Vim users can benefit as well.</li></ol><h4><strong>Basics</strong></h4><p>Getting coc.nvim up and running is very straightforward. Once you follow the <a href="https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim">installation instructions</a>, you can install language server extensions by running :CocInstall .</p><p>For example, in my current web-based projects, I can have a fully-functioning intellisense engine for most modern TypeScript/JavaScript projects by running:</p><pre>:CocInstall coc-tsserver coc-eslint coc-json coc-prettier coc-css</pre><h4><strong>LSP Extension</strong></h4><p>This is core of coc.nvim experience. With a language server extension like <a href="https://github.com/neoclide/coc-tsserver">coc-tsserver</a>, you get a <a href="https://github.com/neoclide/coc-tsserver#features">ton of features</a>. I’ll highlight a few:</p><ul><li>Code completion support</li><li>Go to definition</li><li>Find references</li><li>Signature help</li><li>Code validation</li><li>Support for Javascript &amp; TypeScript and JSX/TSX</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*gveAH1EA0tK3LIPCMkq-pw.gif" /><figcaption>coc-tsserver in action with React and Typescript</figcaption></figure><p>By default, you get fast, automatic code completion. Types are automatically imported, and you can see function signatures and relevant code completions as you type.</p><p>I have a few key mappings set up to quickly utilize a few key features of the language server:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6934e3282e61e5a843e88bf1ad605774/href">https://medium.com/media/6934e3282e61e5a843e88bf1ad605774/href</a></iframe><p>These mappings allow you to quickly jump to a symbol definition, see the implementation for a symbol, or find where it’s referenced. I use them all frequently and find them to be a huge productivity boost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*sugrSH6xNNPIxRuw-Rw1mA.gif" /><figcaption>Using coc.nvim mappings</figcaption></figure><h4><strong>Linting</strong></h4><p>I rely on <a href="https://eslint.org/">ESLint </a>for linting both my JavaScript and TypeScript projects. Now that <a href="https://medium.com/palantir/tslint-in-2019-1a144c2317a9">TSLint is being deprecated</a>, the choice is even easier. I initially used <a href="https://github.com/w0rp/ale">Ale </a>(which is a great tool), but it had some issues when used together with coc.nvim.</p><p>Now, using the <a href="https://github.com/neoclide/coc-eslint">coc-eslint language server extension</a>, you can get real-time feedback from your linter and language server using the same tool. I also use <a href="https://github.com/neoclide/coc-prettier">coc-prettier</a> to have coc.nvim format my code to <a href="https://prettier.io/">prettier</a> standards on file save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*0nZE62WR2LxaufaX2anB0g.gif" /><figcaption>Using eslint and prettier via coc.nvim</figcaption></figure><h4><strong>Configuration</strong></h4><p>You can configure your coc.nvim setup by creating a configuration file. Right now, <a href="https://github.com/ctaylo21/jarvis/blob/master/config/nvim/coc-settings.json">mine</a> is pretty simple:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/63bbac33996b8dbc9d94983911b49c56/href">https://medium.com/media/63bbac33996b8dbc9d94983911b49c56/href</a></iframe><p>You can read more about setting up your own coc.nvim configuration file <a href="https://github.com/neoclide/coc.nvim/wiki/Using-configuration-file">here</a>.</p><h3>Conclusion</h3><p>That about wraps it up. I’d love to hear any feedback or suggestions, so please leave a comment! In case you missed it above, for my full setup, check out my <a href="https://github.com/ctaylo21/jarvis">dotfiles</a> and <a href="https://medium.freecodecamp.org/coding-like-a-hacker-in-the-terminal-79e22954968e">my article on the rest of my setup</a> outside of Vim. Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=333f7efbf8e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The qualities that make a great software engineer]]></title>
            <link>https://caleb89taylor.medium.com/qualities-of-great-software-engineers-621f4094f5ab?source=rss-8f2668739633------2</link>
            <guid isPermaLink="false">https://medium.com/p/621f4094f5ab</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[Caleb Taylor]]></dc:creator>
            <pubDate>Sat, 23 Feb 2019 20:25:27 GMT</pubDate>
            <atom:updated>2019-02-26T16:58:58.814Z</atom:updated>
            <content:encoded><![CDATA[<h3>Qualities of Great Software Engineers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xv37PaIjTqZzoWQUk-4arw.jpeg" /></figure><p>Over the years, I’ve noticed some common traits of people that were incredibly valuable to a company. These engineers were smart, but that’s not why they were great. They tended to consistently do certain things that many other engineers did not. I’ve captured some of these qualities and boiled them down into concepts that any engineer could use.</p><blockquote><strong><em>Disclaimer: </em></strong><em>These are not always easy things to do. I have personally fallen short of each quality at some point in my career. I consider these “guiding principles” for anyone who is looking to be a great engineer, but it’s not a comprehensive list. Your definition of a “great” engineer may differ from mine.</em></blockquote><h3>Train To Be A Firefighter</h3><p>When I was a young, fresh-faced engineer, I got my first valuable lesson from my manager. He said,</p><blockquote>“If you want to be valuable to your company, be the person that runs toward fires.”</blockquote><p>He wasn’t encouraging me to go throw myself in a fire (although I’m sure I deserved that at times), but rather to be the engineer who was willing — and capable — to tackle the big problems.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FdbtDDSvWErdf2%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FdbtDDSvWErdf2%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FdbtDDSvWErdf2%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="236" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa46dec20a0d433201be0a52abb24235/href">https://medium.com/media/aa46dec20a0d433201be0a52abb24235/href</a></iframe><p>The “fires” can be anything from a nasty production bug, to a daunting refactor of a major service. Not everyone can put out these fires. A willingness to tackle hard issues is the first step, but it’s not enough. You have to actually be capable of putting out the fire.</p><p>Preparing for these big moments isn’t always easy. You must dedicate yourself to understanding your system’s architecture and design. The more complicated a system, the more time it will take.</p><p>There are a couple of ways I’ve found that help prepare me to fight fires:</p><ul><li>Creating an HLD (<a href="https://en.wikipedia.org/wiki/High-level_design">High-level design</a>) for your app/service</li><li>Documenting complicated pieces of your code</li><li>Debugging common flows through your code line-by-line</li><li>Taking time to dig into any code you run across that you don’t understand</li><li>Research technologies that your team uses and become an expert</li></ul><p>When you work on individual tasks, be on the lookout for anything you don’t understand. <strong>Don’t accept things that <em>“just work”</em></strong><em>. </em>Every time you touch your code, you have a chance to build your understanding. That’s why training to be a “fireman” is so hard. It can be a tedious, daily effort to be ready for fires.</p><p>Great engineers are the people that consistently do these sort of things. They are willing to jump on issues they don’t know how to solve. They tend to dig deeper than the average engineer because they want to truly understand things. This has nothing to do with intelligence. It’s a mindset.</p><p><strong>Takeaway: </strong>Dedicate yourself to acquiring a deep understanding of your application. When tough issues arise, be willing to dive in and put out the fire.</p><h3>Recognize Bottlenecks</h3><p>How many times have you experienced a situation like this?</p><blockquote>Developer A: “I’m going to deploy the latest change, okay? Once I manually update each of the static files and remove the local configuration settings, I can upload it”.</blockquote><blockquote>New Developer: “Wait, you manually edit these files each time you deploy?”</blockquote><blockquote>Developer A: “Yeah, it’s a pain. We’ve also broken production a few times when we make a mistake. It’s pretty annoying.”</blockquote><blockquote>New Developer: “That seems like a bad way to do deploys..”</blockquote><blockquote>Developer A: “Yeah, we really should fix that.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F8Fla28qk2RGlYa2nXr%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F8Fla28qk2RGlYa2nXr%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F8Fla28qk2RGlYa2nXr%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="233" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea7de0e4fcc8cdc754404376ee7ead6c/href">https://medium.com/media/ea7de0e4fcc8cdc754404376ee7ead6c/href</a></iframe><p>This is unfortunately a pretty common problem for software teams. Important or common pieces of your team’s workflow are manual, fragile, and slow. Occasionally, the team will recognize that it’s a problem and fix it. At the very least, they might make a card in the backlog.</p><blockquote>The real problem is when nobody recognizes a bottleneck</blockquote><p>So where do you begin looking? A good starting point is to think about automating everything. Start with the most critical tasks you perform manually. Does your team have tests that everybody manually runs for each pull request to make sure they pass? Why not hook that up to a CI server like <a href="https://jenkins.io/">Jenkins </a>or <a href="https://travis-ci.org/">Travis CI</a> and display the results directly in the pull request with web hooks?</p><p>Do members of your team spend time reviewing code style and formatting? Why not automatically lint your code using a Git hook on each commit with a tool like <a href="https://github.com/typicode/husky">Husky</a> and <a href="https://github.com/okonet/lint-staged">lint-staged</a>?</p><p>These sort of optimizations can be easy to miss. Teams accept these pain points as “the way things are”, rather than as candidates for optimization. Great engineers tend to think about these issues. They take the time to fix them, and the resulting changes are big wins for the entire team.</p><blockquote><em>I’ve recently read </em><a href="https://www.amazon.com/Accelerate-Software-Performing-Technology-Organizations-ebook/dp/B07B9F83WM"><em>Accelerate: The Science of Lean Software and DevOps: Building and Scaling High Performing Technology Organizations</em></a><strong><em> </em></strong><em>and found it to be a great resource. It gives insight into best engineering practices, and how they affect team performance and happiness. It can also be useful to help justify working on your team’s bottlenecks to your company’s leadership and product teams with data from many other companies.</em></blockquote><p><strong>Takeaway:</strong> Look for bottlenecks in your team’s development process or deploy pipeline. Make an effort to prioritize and fix the most important issues to improve your team’s quality of life.</p><h3>Don’t Blindly Follow Existing Patterns</h3><p>Engineers love patterns. Thousands of books exist on the best programming patterns and how to use them. Unfortunately, not all code patterns should be reused.</p><p>Occasionally, I’ve reviewed a pull request and found an odd or poorly-written section of code. When I ask why it was written this way, the answer is usually the same: “That’s how it was done before. I just copied it from somewhere else”.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FE2USislQIlsfm%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FE2USislQIlsfm%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FE2USislQIlsfm%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="281" frameborder="0" scrolling="no"><a href="https://medium.com/media/a20b3c9f64f8eefd3a95b2d606d0e090/href">https://medium.com/media/a20b3c9f64f8eefd3a95b2d606d0e090/href</a></iframe><blockquote>Breaking old patterns is the first step of establishing new ones</blockquote><p>The tendency for developers to copy existing code is one of the biggest reasons for tech debt. It’s easy to allow these changes through because it looks like other code in production.</p><p>Great engineers are very careful about reusing existing code. This applies to both writing and reviewing code. They tend to ask the questions:</p><ul><li>Is the copied code the best way to solve the problem?</li><li>If it’s similar to an existing piece of code, can we combine into a single module to reduce duplication?</li><li>Are there any logic bugs due to subtle differences between the new and existing code?</li><li>Does this code fit with my team’s latest standards and design discussions?</li></ul><p>These principles also apply to making updates to older pieces of code. It’s very easy to sneak in a code change to a outdated or poorly-written section of code without fixing anything, but <strong>great engineers rarely do this</strong>. They tend to embrace the concept of <a href="https://martinfowler.com/bliki/OpportunisticRefactoring.html">continuous refactoring</a>.</p><p>This doesn’t mean that each code update results in a massive refactor. The improvements can be (and usually are) a variety of simple things:</p><ul><li>Improving variable or function names</li><li>Breaking out a large, complex function into smaller ones</li><li>Abstracting out logic copied in several places into a shared component</li></ul><p>Great engineers are constantly thinking about ways to improve code, and almost always leave the code in a better state than they found it.</p><blockquote><em>I’ve recently read the book </em><a href="https://martinfowler.com/books/refactoring.html"><em>Refactoring: Improving the Design of Existing Code</em></a><strong><em> </em></strong><em>by Martin Fowler, and found it to be a great resource on refactoring.</em></blockquote><p><strong>Takeaway</strong>: Constantly re-evaluate code structures, patterns, and design. Copying and pasting code is the root of all evil. Always leave code in a better state than when you found it.</p><h3>Conclusion</h3><p>Any software engineer can apply these qualities to their work. It can be difficult to do consistently. Some characteristics require a willingness to go the extra mile in the many facets of your job. If you are willing to work at these qualities, you will become a better software engineer.</p><p>This short list is based upon my own experiences, but I’d love to hear what others think. What qualities do great engineers tend to have in your experience? Please let me know!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=621f4094f5ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to code like a Hacker in the terminal]]></title>
            <link>https://medium.com/hackernoon/coding-like-a-hacker-in-the-terminal-79e22954968e?source=rss-8f2668739633------2</link>
            <guid isPermaLink="false">https://medium.com/p/79e22954968e</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[satire]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Caleb Taylor]]></dc:creator>
            <pubDate>Wed, 17 Oct 2018 19:55:16 GMT</pubDate>
            <atom:updated>2018-10-26T19:55:17.959Z</atom:updated>
            <content:encoded><![CDATA[<p>You are a hacker. Your home is the terminal. You know every key stroke is valuable. If something is less than 100% efficient, you will spend hours figuring out the right tool to save yourself seconds. Because it’s always worth it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GMvdjMQAjokYEFzTXjsp6Q.jpeg" /><figcaption>Source: <a href="https://www.pablostanley.com/">Pablo Stanley</a> via <a href="https://twitter.com/pablostanley/status/963469081910296576">Twitter</a></figcaption></figure><p>Does your constant search for newer and better ways to do things detract from actually doing things? Some may say yes, but you say nay. No work is worth doing unless you can lecture your coworkers on why you were able to do it so efficiently (setup time not included).</p><p>The following is a list of tools/features that every good hacker should know about.</p><blockquote><strong>Dislcaimer</strong>: This article is written with a heavy dose of satire. It’s a twist on the <a href="https://knowyourmeme.com/memes/me-an-intellectual">“Me, an Intellectual” meme.</a> While the suggestions are sincere (and by no means complete), the references to being a “hacker” are just for fun.</blockquote><h3><strong>Shell (zsh)</strong></h3><blockquote><strong>Average developer</strong>: A shell is a shell. It doesn’t really matter which one I use. They all suck anyway.</blockquote><blockquote><strong>You, a Hacker</strong>: The shell is the lifeblood of my work. My passion for efficiency and features knows no bounds. My shell must be one worthy of a true hacker.</blockquote><p>You live in the terminal, and that’s why you want to use a great shell. That’s why you use <a href="http://www.zsh.org/">zsh</a>.</p><p>It comes with a whole slew of features:</p><ul><li>Auto-correct of misspelled commands</li><li>Easy drop-in replacement of bash</li><li>Better cd completion using &lt;tab&gt;</li><li>Path expansion: cd /u/c/c/j + &lt;tab&gt; =cd /user/caleb/code/jarvis</li><li><a href="http://zsh.sourceforge.net/Doc/Release/zsh_toc.html">Much more</a></li></ul><p>It also comes with a great framework for managing your zsh configuration: <a href="https://github.com/robbyrussell/oh-my-zsh">Oh My Zsh</a>. It includes 200+ plugins and 140+ themes to add all sorts of awesome features to your terminal. A small sample:</p><ul><li><a href="https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git">git</a> - tons of aliases and useful functions for git</li><li>t<a href="https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/tmux/tmux.plugin.zsh">mux</a> - alias and settings for integrating zsh with tmux</li><li><a href="https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/node">node</a> - adds node-docs command for opening website docs</li><li><a href="https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/osx">osx</a> - several utilities for working with OSX</li><li><a href="https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/web-search">web-search</a> - initialize web searches from command line</li><li><a href="https://github.com/zsh-users/zsh-autosuggestions">auto-suggestions </a>- fast, unobtrusive suggestions as you type based on history</li></ul><p>You can find the full list of plugins <a href="https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins">here</a>.</p><h3>Session Management (<a href="https://github.com/tmux/tmux">tmux</a>)</h3><blockquote><strong>Average developer</strong>: Okay I’ve got my files open for lame_project_1. But I also need to do work in boring_project_2. I also need to ssh into a server and look at the logs. I guess I’ll just create a huge mess in my terminal that has files/tabs from multiple projects open in a way that I’ll eventually lose control of and be forced to close and start over.</blockquote><blockquote><strong>You, a Hacker</strong>: I work on several projects at once, so I need a tool to help me keep it organized. It should work across multiple platforms, and allow me to create organized work spaces and have a lot of other features that help with productivity.</blockquote><p>You know that development can get messy. Sometimes, you have to work on several projects at once. That’s why you use <a href="https://github.com/tmux/tmux">tmux</a>.</p><p>It allows you to create sessions. Each session can be customized to the exact layout you need. You can name sessions for easy switching, and even save and restore sessions if your terminal is closed. Plus, it has its own customizable status line that will allow you display things like time, date, CPU usage, and more. And if you don’t know your CPU usage at any given moment, are you even a hacker?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1aaEQExjdaueLgsLWxfr1g.gif" /><figcaption>Organize your terminal with sessions and use fzf for fuzzy create/finding/deleting of sessions</figcaption></figure><p>It even has a <a href="https://github.com/tmux-plugins/tpm">plugin manager</a> and a <a href="https://github.com/rothgar/awesome-tmux">whole slew of awesome plugins &amp; features</a> that will take your hacking to the next level.</p><p><strong>Super-Pro Hacker Tip:<br></strong>Use tmux with fzf via some <a href="https://github.com/junegunn/fzf/wiki/examples#tmux">awesome scripts</a> to quickly create/delete/navigate to push your hacker level to over 9000.</p><h3>Search (ripgrep)</h3><blockquote><strong>Average developer</strong>: Where did I define that constant at? I know it’s somewhere in here. I’ll try to grep for it. What are the arguments again? Let me google that. Ah crap, now it’s searching my node_modules folder. This is the worst.</blockquote><blockquote><strong>You, a Hacker</strong>: When I search for something, it should be blazing fast. Also, it should use sensible default settings, like ignoring binaries or hidden files.</blockquote><p>You know that searching your project is a common task. It should be fast, and it should not waste your time. This means things like ignoring anything that your .gitignore file ignores, and skipping binaries and hidden files. That’s why you use <a href="https://github.com/BurntSushi/ripgrep">ripgrep</a>. It’s like grep on steroids.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*5Nt_6zoCkF0THdmdNtGoQw.gif" /><figcaption>ripgrep in action</figcaption></figure><p>In the <a href="https://blog.burntsushi.net/ripgrep/">words of its creator</a>: <em>“Use ripgrep if you like speed, filtering by default, fewer bugs and Unicode support.”</em></p><h3>Fuzzy Finding (<a href="https://github.com/junegunn/fzf">fzf</a>)</h3><blockquote><strong>Average developer</strong>: It’s sure hard to remember the exact location of so many files within my project. I guess I’ll stumble around until I find the right one.</blockquote><blockquote><strong>You, a Hacker</strong>: I should be able to fuzzy-find files. I can type the file name, or some of the path, or all of it, and quickly find the file I’m looking for.</blockquote><p>You know you shouldn’t have to type any more than you need to. So you use <a href="https://github.com/junegunn/fzf">fzf</a>, a general-purpose command-line fuzzy finder. It can also do much more than fuzzy-find files. It can used with any list: “files, command history, processes, hostnames, bookmarks, git commits, etc”.</p><p><strong>Super-Pro Hacker Tip: </strong>You know that aliases are a great way to make shortcuts to take advantage of fzf’s features. For example, if you wanted to fuzzy-find a file, and then open up the selection in your default editor, you can add this to your zsh config:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa2abd84953013be5ba78649e78a7f39/href">https://medium.com/media/aa2abd84953013be5ba78649e78a7f39/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c4DFt6p5PDhOxHTx2p_lag.gif" /><figcaption>Now you can run “fo” fuzzy-find and open a file</figcaption></figure><p>Many more examples can be found on the <a href="https://github.com/junegunn/fzf/wiki/examples">fzf wiki</a>.</p><h3>Terminal Prompt (<a href="https://github.com/denysdovhan/spaceship-prompt">Spaceship</a>)</h3><blockquote><strong>Average developer</strong>: Who cares what my terminal prompt looks like? There’s no way it could possibly give me any useful information. I’ll just leave it as the default.</blockquote><blockquote><strong>You, a Hacker</strong>: I want my prompt to be amazing. It should be context-aware. It should give me useful info and be configurable. Also, it would be sweet if it was related to space.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vtc9ZCR2p7a_9-6MuFB-hw.gif" /><figcaption>Welcome to the future… but actually the present. Hackers/astronauts only.</figcaption></figure><p>You know a prompt should be simple, clean, and provide only relevant information. It should also blow people’s minds when they see its beauty. That’s why you use <a href="https://github.com/denysdovhan/spaceship-prompt">spaceship-prompt</a>. It provides git/mercurial integration, battery level indicator, clever host name and user data, version numbers for a variety of libraries, gorgeous icons, and much more.</p><h3>Changing directories (<a href="https://github.com/rupa/z">z</a>)</h3><blockquote><strong>Average developer:</strong> I need to change my directory to my “hacker” project, which is inside of my cool folder, which is inside of my personal folder, which is inside of my code folder, which is in my home directory.</blockquote><pre>cd ~/code/personal/cool/hacker</pre><blockquote><strong>You, a Hacker: </strong>I need to change my directory to my “hacker” project.</blockquote><pre>z hacker</pre><p>Typing out full file paths is what average developers do. You are a hacker. You rely on <a href="https://github.com/rupa/z">z</a>. Once installed, it will start learning which directories you visit. Then, you can give it a regex (or simple folder name) to hop to the most likely candidate.</p><h3>Bonus Hacker Tools</h3><p>The following tools are additional ways to truly elevate your hacking game.</p><ol><li><a href="https://github.com/chubin/wttr.in">wttr.in</a> — There’s only one right way to check the weather.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eoCAnuHdh9I69SiGJU_aOg.png" /></figure><p>2. Star Wars — Cool people like Star Wars. Hackers watch it in the terminal.</p><pre>telnet towel.blinkenlights.nl</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*VHd1lA9C36pYxi_a5-afYQ.gif" /><figcaption>Pro Tip: Watch star wars in another tmux pane while working. No one will question you.</figcaption></figure><p>3. <a href="https://github.com/donnemartin/haxor-news">haxor-news</a> - Are you even a hacker if you don’t read <a href="https://news.ycombinator.com/">Hacker News</a>?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*lcF0nWWF74IZCcc8I-ULBQ.gif" /></figure><p>4. Spotify - Using <a href="https://github.com/hnarayanan/shpotify">shpotify</a>, you can play music from the terminal (OSX only… Hey, stop booing! Put that chair down! Who threw that tomato!?), or <a href="https://www.mopidy.com/">mopidy</a> for something that’s cross-platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*ued2Pipg7m16DOKuwpAUdw.gif" /><figcaption>God bless the commands in the terminal</figcaption></figure><p>That about wraps it up. This is by no means a comprehensive list. Do you have any other amazing hacker tools? Leave a comment and let me know.</p><p>If you are interested in seeing more of these tools in action, checkout out my <a href="https://github.com/ctaylo21/jarvis">dotfiles</a> that I use for development. As a bonus, here’s a screenshot of the glorious terminal in action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V73Ai9Nc8NhSRrs8zOvcHA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79e22954968e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/coding-like-a-hacker-in-the-terminal-79e22954968e">How to code like a Hacker in the terminal</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Customizing highlighting of individual Neovim windows]]></title>
            <link>https://caleb89taylor.medium.com/customizing-individual-neovim-windows-4a08f2d02b4e?source=rss-8f2668739633------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a08f2d02b4e</guid>
            <category><![CDATA[customization]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[winhighlight]]></category>
            <category><![CDATA[neovim]]></category>
            <dc:creator><![CDATA[Caleb Taylor]]></dc:creator>
            <pubDate>Sun, 01 Jul 2018 19:46:13 GMT</pubDate>
            <atom:updated>2019-04-19T14:51:07.354Z</atom:updated>
            <content:encoded><![CDATA[<p>In 2017, Neovim released the winhighlight feature. It gave users the ability to perform “<em>window-local highlights”. </em>There were talks of using it in tandem with the upcoming (hopefully) <a href="https://github.com/neovim/neovim/pull/6619">floating windows feature</a>. But how can you use it now?</p><blockquote><strong>Disclaimer:</strong> Thanks to <a href="https://medium.com/u/ee9977d32a6b">Niall Burkley</a>, I have realized that you should only use guifg and guibg if you have termguicolors enabled in Neovim. If not, then you should be using ctermfg and ctermbg for color changes.</blockquote><blockquote>See :h &#39;termguicolors&#39; for more details.</blockquote><h4>Highlighting Active/Inactive Windows</h4><p>One of the most obvious benefits of per-window highlighting is the ability to distinguish between active and inactive windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dg2OyYxENz50zw_Iwa1buA.png" /><figcaption>Example of dimming background of inactive windows</figcaption></figure><p>This used to be done via plugins like <a href="https://github.com/blueyed/vim-diminactive">blueyed/vim-diminactive</a> that were built on a hack using &amp;cursorcolumn. Now, the basic functionality of changing the background color of inactive windows is now done easily in Neovim:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ee7b1e77a5a0c6c2c1ac9821ecf97da/href">https://medium.com/media/5ee7b1e77a5a0c6c2c1ac9821ecf97da/href</a></iframe><p>The process is pretty straight forward:<br>1. Create an auto-command group to call a function when a new window is entered.<br>2. Create your new local highlights in that function to customize windows.</p><p>Note the use of the Normal and NormalNC highlight groups. According to the <a href="https://neovim.io/doc/user/syntax.html#hl-NormalNC">documentation</a>, the Normal highlight group affects <em>“normal text” </em>and the NormalNC highlight group affects <em>“normal text in non-current </em><a href="https://neovim.io/doc/user/windows.html#windows"><em>windows</em></a><em>”.</em></p><p>This allows us to set the highlight group of the active window to the ActiveWindow highlight group, and inactive windows to the InactiveWindow . The syntax for winhighlight is to define a comma-delimited set of highlight groups in the format {Highlight_Group_To_Replace}:{Highlight_Group_To_Use_Instead} .</p><p>I found that using something like this <a href="https://www.cssfontstack.com/oldsites/hexcolortool/">hex color tool</a> allows you to darken/lighten your colorscheme’s background color by a few percent to achieve a good “inactive” background color.</p><h4>Targeting Specific Window Types</h4><p>Another useful feature is the ability to target specific types of windows. My <a href="https://github.com/ctaylo21/jarvis">personal setup</a> is very minimal. I started with the <a href="https://github.com/mhartington/oceanic-next">Oceanic-Next colorscheme</a> and removed the background from several highlight groups. This resulted in a very clean, minimal interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JZ1_lUrJZQTV6fdvCvYWpg.png" /><figcaption>The default UI.</figcaption></figure><p>However, I had an issue. When I tried to invoke auto-complete, I had a hard time distinguishing between the editor window and the preview window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eYn0IgkcQ4rGLMMFWdwq6w.png" /><figcaption>Example of preview window with function signature blending into code</figcaption></figure><p>Before winhighlight this was a difficult task. Preview windows had the same background as your normal window, and if your status line didn’t have a different background color, everything ran together. Fortunately, this can also be fixed with winhighlight :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d7cf457fc30442fe84c3c0bc0f112af/href">https://medium.com/media/6d7cf457fc30442fe84c3c0bc0f112af/href</a></iframe><p>That’s all it takes. Just by checking the &amp;previewwindow variable, we can specifically target the preview window. I replaced the Normal highlight group with the MarkdownError group because it suited my needs: only a subtle background difference. I could’ve created another custom highlight group, but this one worked just fine.</p><p>In case you’ve never messed with highlighting groups, you can see all the predefined highlight groups by running the command:</p><p>:so $VIMRUNTIME/syntax/hitest.vim</p><p>The end result is a subtle background change for the preview window that keeps the desired minimal UI, while still offering a clear distinction between the main window and the preview window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o7yHnl9WvOj4FTW8m-elIw.png" /><figcaption>Subtle background change for preview window for better UI</figcaption></figure><p>You can also target the Neovim terminal window. If you use the feature and want to customize anything about the highlighting groups, you can do it by checking the &amp;buftype variable:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4bb98ee5b898dcaf7b0737c1d385085f/href">https://medium.com/media/4bb98ee5b898dcaf7b0737c1d385085f/href</a></iframe><p>That about wraps it up. I hope the was a useful intro into the winhighlight feature. Let me know if I missed anything or if there are any other good examples of window-local highlights.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a08f2d02b4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>