<?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 Ryan Rowland on Medium]]></title>
        <description><![CDATA[Stories by Ryan Rowland on Medium]]></description>
        <link>https://medium.com/@rrowland?source=rss-424598b3b385------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xTRY2eGCBoi6umVmrXiUyw.jpeg</url>
            <title>Stories by Ryan Rowland on Medium</title>
            <link>https://medium.com/@rrowland?source=rss-424598b3b385------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 14:11:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rrowland/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[Nimiq, the world’s first in-browser block chain, is gearing up for its debut]]></title>
            <link>https://medium.com/@rrowland/nimiq-the-worlds-first-in-browser-block-chain-is-gearing-up-for-its-debut-50264d5deab4?source=rss-424598b3b385------2</link>
            <guid isPermaLink="false">https://medium.com/p/50264d5deab4</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[nimiq]]></category>
            <dc:creator><![CDATA[Ryan Rowland]]></dc:creator>
            <pubDate>Thu, 31 May 2018 00:26:04 GMT</pubDate>
            <atom:updated>2018-05-31T00:26:20.258Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5peEdh3JR7Ggn5yj_nqAQw.png" /></figure><p><strong>This is a call to all savvy crypto investors, CPU miners, and GPU miners with spare CPU cycles!</strong></p><p>If you haven’t yet heard, <a href="https://nimiq.com/"><strong>Nimiq</strong></a><strong> (NIM) </strong>is the first browser-based crypto-currency and an exciting prospect for the future of crypto, having successfully deployed their main net just over a month ago. Using Nimiq’s <a href="https://github.com/nimiq-network">open source software</a>, any web developer can add a library to their page and allow users to connect to directly to the block chain from their browser.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FgegHBPy7QLg%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DgegHBPy7QLg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FgegHBPy7QLg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9059f0eeab39d47981c027a74136c3ed/href">https://medium.com/media/9059f0eeab39d47981c027a74136c3ed/href</a></iframe><p><strong>Nimiq</strong>’s<strong> </strong>core goals are:</p><ul><li><strong>To make payment easy.</strong> The <a href="https://safe.nimiq.com/">Nimiq Safe</a> is an extremely user-friendly and secure wallet that runs right in the browser. The interface is designed to be easy to use for people of all experience levels. Additionally, a <a href="https://github.com/sisou/nimiq-wallet-extension">wallet extension</a> is in the works, which will bring Nimiq up to parity with Ethereum in ease of access for participating sites.</li><li><strong>To bring crypto and mining to all devices.</strong> Being able to run in the browser means that anyone with a phone can participate in mining or connecting to the block chain. To most of us, this is a given, but in many parts of the world this is groundbreaking and opens the door to crypto to millions of people.</li></ul><p><strong>Nimiq</strong> is doing an amazing job at fulfilling these goals. With a <a href="https://nimiq.com/#team">team full of PhDs</a> working full-time on this project (living together in a house in Costa Rica, no less!) updates are coming rapidly. Some upcoming milestones include:</p><ul><li><strong>Ledger integration</strong>. The team has already written and submitted a fully working ledger application for NIM. This <a href="https://trello.com/c/3CeuCx9G/87-nimiq-support">application</a> has been pending for a while now, and has already received a preliminary thumbs up. This integration could be officially accepted any day now.</li><li><strong>Wallet extension</strong>. As mentioned above, a <a href="https://github.com/sisou/nimiq-wallet-extension">wallet extension</a> project has been started and promises to bring ease-of-use of PC users to parity with Ethereum.</li><li><strong>Exchange listing</strong>. Nimiq was recently listed on its <a href="https://tradesatoshi.com/Exchange/?market=NIM_BTC">first exchange</a> a couple days ago. Albeit a small exchange, being added has given NIM holders an easier way to trade NIM and has proven the stability of the price of the coin. Price jumped 20% the first day on the exchange, and has been steadily rising since (from 65 sats to 86 sats at the time of writing). Furthermore, plans are in place for addition to other, larger exchanges and I expect to see similar gains on a higher magnitude when that happens.</li><li><strong>Marketing</strong>. To now, the team has been very modest in marketing as they’ve been heads-down on the technology. This is due to change as the technology becomes more robust, the coin hits larger exchanges and has more exposure.</li></ul><h3>The Golden Opportunity</h3><p>This is an excellent opportunity to put some <strong>spare CPU cycles</strong> to use, as Nimiq mining uses the <a href="https://en.wikipedia.org/wiki/Argon2">argon2d algorithm</a>, which is GPU-resistant. Currently sitting at an average of <strong>600MH/s</strong> globally, this coin is in a prime position to be mined at an excellent cost efficiency. Currently, cloud mining using AWS, Azure or Google Compute Engine can see returns between 5% — 15% at the current exchange rate.</p><h3>Get Started</h3><p>Anyone interested in mining this coin should consider joining a pool for more consistent payouts. There are plenty of great pools in the Nimiq community, but the instructions for getting started are very simple over at <a href="https://porkypool.com/">https://porkypool.com</a>. Additionally, this pool offers AWS images that making deploying fleets extremely easy, and ensures your instances run at their full hashing potential. You can join the Discord and get assistance from the awesome community at <a href="https://discord.gg/2UcxkrK">https://discord.gg/2UcxkrK</a>.</p><p>Additionally, you can join the official Nimiq Discord at <a href="https://discord.gg/cMHemg8">https://discord.gg/cMHemg8</a> which has information on some other pools, and access to a very friendly community that will be more than happy to help newcomers get set up.</p><p>You can even mine <a href="https://miner.nimiq.com/">in your browser</a>!</p><h4>Hope to see you there!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50264d5deab4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ES6: Break it up]]></title>
            <link>https://medium.com/@rrowland/es6-break-it-up-53ad50dbbc5f?source=rss-424598b3b385------2</link>
            <guid isPermaLink="false">https://medium.com/p/53ad50dbbc5f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[functional-programming]]></category>
            <dc:creator><![CDATA[Ryan Rowland]]></dc:creator>
            <pubDate>Wed, 02 Mar 2016 06:04:04 GMT</pubDate>
            <atom:updated>2016-03-13T23:08:34.586Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*2ny5b9RC_AYAR3kSR4rndg.png" /></figure><p>With <strong>promises</strong>, <strong>arrow functions</strong>, and <strong>functional array chaining</strong> available to us natively as of ES6, we now have a myriad of ways to consolidate overly verbose code. The problem is simply that this is <strong>too fun</strong> and <strong>too novel</strong> and we all get carried away, cutting away code that isn’t necessary for compilation but improves readability, maintainability and in some cases testability.</p><p>This is an actual snippet of code I wrote for a personal project. The project is an <strong>Automated LendingClub Bot </strong>utilizing my <a href="https://www.npmjs.com/package/lc-api">NodeJS Lending Club API Implementation</a>, and this snippet represents its <strong>buy</strong> function. This method takes an array of filters as an argument, applies them to a list of new loans, and ultimately purchases a $25.00 note for each.</p><pre>Bot.prototype.buy = function buy(filters) {<br>  return this.api.loans.getNewListings().then(loans =&gt; {<br>    return filters.reduce((orders, filter) =&gt; {<br>      loans.filter(filter).forEach(loan =&gt; {<br>        if (!orders.has(loan.id)) {<br>          orders.set(loan.id, loan.createOrder(25.00));<br>        }<br>      });<br><br>      return orders;<br>    }, new Map());<br>  }).then(orders =&gt; this.api.account.submitOrders(Array.from(orders.values())));<br>};</pre><p>All of these <strong>promises</strong>, <strong>arrow functions</strong> and <strong>functional array chains</strong> allowed me to write a very compact sliver of code that takes care of many functions:</p><ol><li>Fetching a list of available new loans from our API,</li><li>Creating a list for each filter containing all the matching loans,</li><li>Merging the lists together,</li><li>Removing duplicates while maintaining insertion order,</li><li>Creating an order for each unique loan, and</li><li>Submitting those orders through our API.</li></ol><p>However, after a good night’s rest and returning to the code the next morning, I had trouble making modifications. First, it took me a few minutes to remember how the logic was working. Then, I realized I’d have to restructure a good portion of the code to implement a new step to the process.</p><p>This is when I realized I had gone too far and it was time to separate out the components by function.</p><p>Let’s walk through the steps we might take to make this method more legible, maintainable and testable.</p><h3>Step 1. Separate logic by function</h3><p>A good starting point is to separate the logic by function, and be verbose about it. Forget about trying to be efficient with our lines of code or performance; we can address those concerns later. Our immediate goal is simply to decouple:</p><pre>Bot.prototype.buy = function buy(filters) {<br>  // 1. Fetch a list of available new loans<br>  this.api.loans.getNewListings().then((loans) =&gt; {<br>    <br>    // 2. Create a list for each filter containing all the matching loans<br>    const filteredLists = filters.map(filter =&gt; loans.filter(filter));<br>    <br>    // 3. Merge the lists together<br>    const allMatches = [].concat.apply([], filteredLists);<br>    <br>    // 4. Remove any duplicates<br>    const uniquesById = new Map();<br>    <br>    allMatches.forEach(loan =&gt; {<br>      if (!uniquesById.has(loan.id)) {<br>        uniquesById.set(loan.id, loan);<br>      }<br>    });<br>    <br>    const uniques = Array.from(uniquesById.values());<br>    <br>    // 5. Create an order for each unique loan<br>    const orders = uniques.map(loan =&gt; loan.createOrder(25.00));<br>    <br>    // 6. Submit the orders<br>    return this.api.account.submitOrders(orders);<br>  });<br>};</pre><p>Now we’ve made the code fairly verbose, and declared a lot of variables, but each step of the method is running sequentially. We can clearly see where one step ends and the next begins. Legibility has already improved. But we can do better.</p><h3>Step 2. Create reasonable groupings</h3><p>We now should be thinking about breaking our logic out into their own methods based on their function. However, just as we don’t want all of our logic in one method, we also don’t want to assign each statement to its own method. We should slim our methods down to the <strong>smallest reasonable functionality</strong> and no smaller. For example, these steps may be useful on their own:</p><ul><li><strong>[1. getNewListings]</strong> and <strong>[6. submitOrders]</strong> — These are already separated, as methods of my API implementation.</li><li><strong>[5. createOrders]</strong> returns an array of orders for the array of loans passed in.</li></ul><p>But these steps are only marginally useful on their own:</p><ul><li><strong>[2. filterLists]</strong> returns an array of arrays. These arrays are more useful to us if they are flattened, and don’t contain duplicates.</li><li><strong>[3. flatten]</strong> returns an array, however it does not remove duplicates.</li><li><strong>[4. removeDuplicates]</strong> returns an array without duplicates.</li></ul><p>These steps can be grouped together to form larger, but more reasonable functions:</p><ol><li><strong>union</strong> is an established operation in programming that effectively <strong>flattens</strong> and <strong>removes duplicates</strong>.</li><li><strong>filterLists</strong> can return the <strong>union</strong> of the array of arrays. This way, the output of the method is requires no manipulation to be useful to us.</li></ol><p>Now that we’ve identified some useful groups, let’s break our steps our into their own methods:</p><pre>// Step 1: Fetching new loans is already defined in<br>// bot.api.loans.getNewListings()<br><br>// Steps [2,3,4]: Filter Loans<br>Bot.filterLoans = function filterLoans(loans, filters) {<br>  const filteredLoanArrays = filters.map(filter =&gt; loans.filter(filter));<br>  return unionBy(filteredLoanArrays, &#39;id&#39;);<br>};<br><br>// Steps [3,4]: Union By<br>function unionBy(arrays, keyProperty) {<br>  const flattened = [].concat.apply([], array);<br>  const uniqueItems = new Map();<br>  <br>  flattened.forEach(item =&gt; {<br>    const key = item[keyProperty] || item;<br>    <br>    if (!uniqueItems.has(key)) {<br>      uniqueItems.set(key, item);<br>    }<br>  });<br>  <br>  return Array.from(uniqueItems.values());<br>}<br><br>// Step 5: Create Orders<br>Bot.createOrders = function createOrders(loans, amount) {<br>  return loans.map(loan =&gt; loan.createOrder(amount));<br>};<br><br>// Step 6: Submitting orders is already defined in<br>// bot.api.account.submitOrders(orders)</pre><p>Now, our distinct logical groupings are re-usable, easy to read and create great targets for unit testing.</p><p>Note that<strong> filterLoans</strong> and <strong>createOrders</strong> are defined on the Bot class rather than its prototype. This is because these methods are related to the Bot use-case but are not tied to a specific instance of Bot. These methods are exposed because they may be useful to the user of our API outside the context of the <strong>buy </strong>method.</p><p>Additionally, unionBy has been decoupled from our loan logic. Now, it takes a customizable key property to check the array elements for uniqueness. This method can now be exported from this project’s code base into a more general tool-set to be used across projects. Or, we can re-use existing code from an existing library (such as <em>lodash</em>).</p><p>You may notice we’re missing the actual <strong>buy</strong> function. This brings me to the last step.</p><h3>Step 3. Rebuild</h3><p>Now that all of our pieces are separated into components, and not cluttering our <strong>buy</strong> method, we can rebuild the original method using our broken out pieces:</p><pre>Bot.prototype.buy = function buy(filters) {<br>  return this.api.loans.getNewListings()<br>    .then(loans =&gt; Bot.filterLoans(loans, filters))<br>    .then(loans =&gt; Bot.createOrders(loans, 25.00))<br>    .then(orders =&gt; this.api.account.submitOrders(orders));<br>};</pre><p>This method should require no inline comments; it lists very clear, discernible steps:</p><ol><li>Get the new loan listings via the loans API,</li><li>Then filter those loans with the specified filters,</li><li>Then create $25.00 orders for those loans,</li><li>Then submit those orders via the account API</li></ol><h3>End Product</h3><p>Here’s a snapshot of (roughly) how this code looks currently as it sits in my local git repository:</p><pre>import { unionBy } from &#39;lodash&#39;;<br>import LCApi from &#39;lc-api&#39;;<br><br>function Bot(apiKey, investorId) {<br>  this.api = new LCApi(apiKey, investorId);<br>}<br><br>Bot.filterLoans = function filterLoans(loans, filters) {<br>  const filteredLoanArrays = filters.map(filter =&gt; loans.filter(filter));<br>  return unionBy.apply(null, filteredLoanArrays.concat([&#39;id&#39;]));<br>};<br><br>Bot.createOrders = function createOrders(loans, amount) {<br>  return loans.map(loan =&gt; loan.createOrder(amount));<br>};<br><br>Bot.prototype.buy = function buy(filters) {<br>  return this.api.loans.getNewListings()<br>    .then(loans =&gt; Bot.filterLoans(loans, filters))<br>    .then(loans =&gt; Bot.createOrders(loans, 25.00))<br>    .then(orders =&gt; this.api.account.submitOrders(orders));<br>};</pre><p>Note that we’re still using <strong>promises</strong>, <strong>arrow functions</strong> and <strong>functional array chains</strong>, but instead of using them to reduce our code footprint, we’re striking a balance between readability and brevity. The result is a much more elegant set of methods that is a pleasure to look at. We also exposed some useful functionality to the users of our API in the process, and that’s priceless.</p><p>I love ES6. I am extremely excited about the future of JavaScript development. <strong>Promises </strong>and <strong>arrow functions</strong> are very powerful and we’re all having a blast seeing what they’re capable of. Let’s just keep in mind that at some point, readability may suffer from overuse / misuse. I truly believe that maintaining this balance between readability and brevity is an art.</p><p><strong><em>Ryan Rowland </em></strong><em>is an autodidact and aspiring writer whose areas of interest include achieving success in multiple facets of life: Programming, investing and personal growth.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53ad50dbbc5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>