<?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 Nick Harris on Medium]]></title>
        <description><![CDATA[Stories by Nick Harris on Medium]]></description>
        <link>https://medium.com/@nhtahoe?source=rss-2eb5aabe3759------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3C2qzjWVPdRaWhJ_.</url>
            <title>Stories by Nick Harris on Medium</title>
            <link>https://medium.com/@nhtahoe?source=rss-2eb5aabe3759------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:39:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nhtahoe/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[Improving Performance of Appending Many Lines to a File in Laravel]]></title>
            <link>https://medium.com/@nhtahoe/improving-performance-of-appending-many-lines-to-a-file-in-laravel-174ae337a4df?source=rss-2eb5aabe3759------2</link>
            <guid isPermaLink="false">https://medium.com/p/174ae337a4df</guid>
            <category><![CDATA[feeds]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[amazon-selling-tips]]></category>
            <dc:creator><![CDATA[Nick Harris]]></dc:creator>
            <pubDate>Mon, 20 Aug 2018 23:32:56 GMT</pubDate>
            <atom:updated>2018-08-20T23:32:56.724Z</atom:updated>
            <content:encoded><![CDATA[<p>I spend a lot of time generating Amazon inventory feeds for large product catalogs. I’ve recently started converting some of my PHP feed generation scripts to Laravel and have been using the Storage facade.</p><p>The typical feed generation workflow is: 1. Create a new file and write feed header. 2. Append feed lines for each SKU to that file.</p><p>One of the product catalogs I manage contains over 100,000 SKUs and I found that using Storage::append(‘feed.txt’, $line); for each SKU takes forever.</p><p>So my solution was to write the entire feed to a Redis string and then write the file all at once like in the following pseudo-code:</p><pre>$feedFile    = Storage::put(&#39;feed.txt&#39;, &#39;feed header content&#39;);<br>Redis::set(&#39;feedLines&#39;, &#39;&#39;);</pre><pre>foreach ($allSkus as $sku) {<br>  Redis::append(&#39;feedLines&#39;, &#39;sku feed line&#39;);<br>}</pre><pre>Storage::append(&#39;feed.txt&#39;, Redis::get(&#39;feedLines&#39;));</pre><p>Before, it would take over an hour to write the file using Laravel’s Storage::append(). Now the whole thing is done in a few seconds.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=174ae337a4df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shell Script That Detects Git Branch and Runs ‘npm run production’ if on master then ‘git push’]]></title>
            <link>https://medium.com/@nhtahoe/shell-script-that-detects-git-branch-and-runs-npm-run-production-if-on-master-then-git-push-25637b62e73d?source=rss-2eb5aabe3759------2</link>
            <guid isPermaLink="false">https://medium.com/p/25637b62e73d</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[shell-script]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[laravel-forge]]></category>
            <dc:creator><![CDATA[Nick Harris]]></dc:creator>
            <pubDate>Sat, 23 Jun 2018 22:36:01 GMT</pubDate>
            <atom:updated>2018-06-26T05:45:14.367Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve made the mistake of pushing updates to the master branch of my project when my npm dependencies on the server I’m pushing from were compiled with ‘npm run dev’ or ‘npm run watch.’</p><p>I use Laravel Forge “Quick Deploy” so my forgetfulness can cause some headaches on the production server. So here is a little shell script I wrote.</p><pre>#!/bin/sh<br># Runs git add, commit and push<br># &#39;npm run production&#39; command if trying to git push to master</pre><pre># Grab the git commit message<br>commitMessage=$1</pre><pre># Quit if no commit message<br>if [ -z &quot;$commitMessage&quot; ]; then <br>    echo &quot;Forgot to include commit message&quot;<br>    exit 1;<br>fi</pre><pre># Determine what the current git branch is<br>branch=$(git symbolic-ref HEAD | sed -e &#39;s,.*/\(.*\),\1,&#39;)</pre><pre># If on master branch, compile to production and add to commit message<br>if [ $branch == &quot;master&quot; ]; then<br>    commitMessage+=&quot; Pushing to master so compiling assets to production.&quot;;<br>    echo &quot;$commitMessage&quot;;<br>    npm run production<br>fi</pre><pre># Add, commit and push!<br>git add .<br>git commit -m &quot;$commitMessage&quot;<br>git push</pre><p>I aliased it as:</p><pre>alias gpush=”bash ~/ita-git-push.sh”</pre><p>So now when I’m ready to commit and push I simply run:</p><pre>gpush ‘Here is my commit message’</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25637b62e73d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>