<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nir Lanka ニル</title>
    <description>The latest articles on DEV Community by Nir Lanka ニル (@nirlanka).</description>
    <link>https://dev.to/nirlanka</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F40281%2Ff9b25b19-1b40-477a-bc16-dbc361ef73ee.jpeg</url>
      <title>DEV Community: Nir Lanka ニル</title>
      <link>https://dev.to/nirlanka</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nirlanka"/>
    <language>en</language>
    <item>
      <title>git diff&gt; &amp; apply vs stash </title>
      <dc:creator>Nir Lanka ニル</dc:creator>
      <pubDate>Wed, 03 Jun 2020 10:20:25 +0000</pubDate>
      <link>https://dev.to/nirlanka/git-diff-apply-vs-stash-1eo</link>
      <guid>https://dev.to/nirlanka/git-diff-apply-vs-stash-1eo</guid>
      <description>&lt;p&gt;I never use &lt;code&gt;git stash&lt;/code&gt; and prefer to use &lt;code&gt;git diff HEAD &amp;gt; ../diffs/whatever.diff&lt;/code&gt; and later &lt;code&gt;git apply ../diffs/whatever.diff -3&lt;/code&gt; (&lt;code&gt;-3&lt;/code&gt; for 3-way merge enabled).&lt;/p&gt;

&lt;p&gt;I know a lot of people use &lt;code&gt;git stash&lt;/code&gt;, but I'm not sure it's because they prefer it over &lt;code&gt;git diff&lt;/code&gt;, but rather because they haven't considered it.&lt;/p&gt;

&lt;p&gt;It could be just me, but I prefer to have my code snippets and changes to be as "tangible" as possible. Ability to back them up, add to git, reuse and all that is much more reliable and convenient with diff &amp;gt; apply.&lt;/p&gt;

&lt;p&gt;What are your thoughts?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>git</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Can we support including parts of others' posts in ours to help reduce duplicate tutorial problem?</title>
      <dc:creator>Nir Lanka ニル</dc:creator>
      <pubDate>Wed, 27 May 2020 08:23:21 +0000</pubDate>
      <link>https://dev.to/nirlanka/can-we-support-including-parts-of-others-posts-in-ours-to-help-reduce-duplicate-tutorial-problem-44ng</link>
      <guid>https://dev.to/nirlanka/can-we-support-including-parts-of-others-posts-in-ours-to-help-reduce-duplicate-tutorial-problem-44ng</guid>
      <description>&lt;p&gt;I see a lot of similar sounding titled posts appearing in a weekly and even sometimes almost daily basis. And they sometimes rehash similar points and examples. &lt;/p&gt;

&lt;p&gt;I realise there's a market for certain types of introduction and comparison posts, and I appreciate their writers and content. But I think it'll be effective to have a way to add to the existing content or reuse existing content (with back referrals) so that the content and contributors (writers, commenters) can build upon each other and be more efficient and valuable. &lt;/p&gt;

&lt;p&gt;Example topics are "&lt;em&gt;framework 1&lt;/em&gt; vs. &lt;em&gt;framework 2&lt;/em&gt;" and "what is &lt;em&gt;this cool feature&lt;/em&gt;". &lt;/p&gt;

</description>
      <category>discuss</category>
      <category>meta</category>
    </item>
    <item>
      <title>Are most small mobile apps just vanity projects?</title>
      <dc:creator>Nir Lanka ニル</dc:creator>
      <pubDate>Mon, 25 May 2020 11:11:22 +0000</pubDate>
      <link>https://dev.to/nirlanka/are-most-small-mobile-apps-just-vanity-projects-question-4pjp</link>
      <guid>https://dev.to/nirlanka/are-most-small-mobile-apps-just-vanity-projects-question-4pjp</guid>
      <description>&lt;p&gt;I feel that most mobile apps that come out don't have anything that's not possible to do as a web app (responsive + progressive). Of course there are a lot of apps that need to be installable apps, but I feel most small apps are apps just to be cool, and look established.&lt;/p&gt;

&lt;p&gt;What do you think?&lt;/p&gt;

</description>
      <category>ios</category>
      <category>android</category>
      <category>webdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Killing specific node processes (*ux)</title>
      <dc:creator>Nir Lanka ニル</dc:creator>
      <pubDate>Tue, 25 Feb 2020 07:39:06 +0000</pubDate>
      <link>https://dev.to/nirlanka/killing-specific-node-processes-ux-4g3g</link>
      <guid>https://dev.to/nirlanka/killing-specific-node-processes-ux-4g3g</guid>
      <description>&lt;p&gt;&lt;em&gt;Update: Instead of this post, check out &lt;a href="https://unix.stackexchange.com/a/351522/31207"&gt;this StackOverflow answer&lt;/a&gt; that gives a much better and convenient method of doing this by using &lt;code&gt;gid&lt;/code&gt; (group id). It puts my method to shame&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update: For Windows, run &lt;code&gt;netstat -a -n -o|findstr 8080&lt;/code&gt; (or any port) in CMD, run &lt;code&gt;taskkill /pid 20212 /f&lt;/code&gt; with that PID in place of &lt;code&gt;20212&lt;/code&gt; (or show PID column in Processes tab in Task Manager, find the PID in the first command output and kill it. Kinda messy, but works.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I had a VM hosting and running a codebase through NodeJS.&lt;/p&gt;

&lt;p&gt;I was accessing the code through ssh in VSCode, while the code ran through a custom script inside the VM itself. It was exposed through ssh port forwarding, but that irrelevant for this story.&lt;/p&gt;

&lt;p&gt;So, when I was switching branches, the server script tended to get frozen. I wanted to kill it and its descendants while not hurting the node processes of the VSCode server in the same VM. So I couldn't just run &lt;code&gt;killall node&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To get an overall idea about the process state, I first listed down the processes with &lt;code&gt;pstree | grep node&lt;/code&gt;. There, I could see which node processes spawned which, but without any pids.&lt;/p&gt;

&lt;p&gt;So I ran &lt;code&gt;ps aux | grep node&lt;/code&gt;, which gave me all the node processes with pid and other stats like memory. But it still contained VSCode server processes. So I excluded any line containing &lt;code&gt;vscode&lt;/code&gt;: &lt;code&gt;ps aux | grep node | grep -v vscode&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Voila!&lt;/p&gt;

&lt;p&gt;Now I had the pids of each unwanted node process, but I couldn't tell which column was the pid! So I ran &lt;code&gt;ps aux | head&lt;/code&gt; to find which column it was.&lt;/p&gt;

&lt;p&gt;Then I killed all of them with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;kill&lt;/span&gt; &lt;span class="nt"&gt;-15&lt;/span&gt; 2189 2240 &lt;span class="c"&gt;# ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Here, 2189, 2240, ... are the list of pids. &lt;code&gt;-15&lt;/code&gt; modifier means &lt;code&gt;SIGTERM&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After testing again with &lt;code&gt;ps aux | grep node | grep -v vscode&lt;/code&gt;, I saw some processes were too frozen to respond to &lt;code&gt;SIGTERM&lt;/code&gt;, which meant I then run &lt;code&gt;kill&lt;/code&gt; with &lt;code&gt;-9&lt;/code&gt; (&lt;code&gt;SIGKILL&lt;/code&gt;) instead of &lt;code&gt;-15&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So, that's all!&lt;/p&gt;

</description>
      <category>node</category>
      <category>terminal</category>
      <category>linux</category>
      <category>selfnote</category>
    </item>
    <item>
      <title>Easily select h1, h2, ... through SCSS functions</title>
      <dc:creator>Nir Lanka ニル</dc:creator>
      <pubDate>Mon, 20 Jan 2020 08:05:14 +0000</pubDate>
      <link>https://dev.to/nirlanka/h1-h2-all-through-scss-functions-4049</link>
      <guid>https://dev.to/nirlanka/h1-h2-all-through-scss-functions-4049</guid>
      <description>&lt;p&gt;I was writing styles for formatting inside a rich-text web component. &lt;/p&gt;

&lt;p&gt;There, due to limitations of the CMS and requirements, we wanted all &lt;code&gt;h1&lt;/code&gt;, &lt;code&gt;h2&lt;/code&gt;, ... &lt;code&gt;h6&lt;/code&gt; tags to have some similar presentations. &lt;/p&gt;

&lt;p&gt;Also, we had selectors like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; 
&lt;span class="nt"&gt;h2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; 
&lt;span class="c"&gt;/*...*/&lt;/span&gt;
&lt;span class="nt"&gt;h6&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="c"&gt;/*...*/&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Always writing selectors for all cases including all &lt;code&gt;h#&lt;/code&gt; tags is a nightmare. It's hard to maintain, too. So I decided to look into how to fix this in the simplest way, while still complying to different use cases.&lt;/p&gt;

&lt;p&gt;After going through forums and finding similar solutions, this is my end &lt;code&gt;.scss&lt;/code&gt; code:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;selector-helpers.scss&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 *  Select any range in {h1, h2, h3, h4, h5, h6}.
 * 
 *  e.g. usage
 *    #{headings('', 1, 6, '.--attr')} { ... }
 */&lt;/span&gt;

&lt;span class="k"&gt;@function&lt;/span&gt; &lt;span class="nf"&gt;headings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$before&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$from&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$to&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;6&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$after&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@if&lt;/span&gt; &lt;span class="nv"&gt;$from&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nv"&gt;$to&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;@return&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$before&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s1"&gt; h&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$from&lt;/span&gt;&lt;span class="si"&gt;}#{&lt;/span&gt;&lt;span class="nv"&gt;$after&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;@else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;@return&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$before&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s1"&gt; h&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nv"&gt;$from&lt;/span&gt;&lt;span class="si"&gt;}#{&lt;/span&gt;&lt;span class="nv"&gt;$after&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s1"&gt;, '&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;headings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$before&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$from&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$to&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$after&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Usage in &lt;code&gt;x-rich-text.scss&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s2"&gt;"./selector-helpers"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nt"&gt;x-rich-text&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="c1"&gt;// h1, ...&lt;/span&gt;
    &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nf"&gt;headings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// h1:first-child, ...&lt;/span&gt;
    &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nf"&gt;headings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$after&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;':first-child'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// h1 + p, ...&lt;/span&gt;
    &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nf"&gt;headings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$after&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;' + p'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// h1, h2 (only)&lt;/span&gt;
    &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nf"&gt;headings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$from&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$to&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// img + p, ...&lt;/span&gt;
    &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nf"&gt;headings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$before&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;'img + '&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// h1.--dark, h2.--dark, ...&lt;/span&gt;
    &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nf"&gt;headings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$after&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;'.--dark'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// h1 code, h2 code, ...&lt;/span&gt;
    &lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="nf"&gt;headings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$after&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s1"&gt;' code'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I believe this can handle all cases with prefixes, suffixes and selective ranges in &lt;code&gt;1..6&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So yeah. &lt;code&gt;:)&lt;/code&gt; Hope this helps you! Let me know if there's a better way of handling this.&lt;/p&gt;

</description>
      <category>css</category>
      <category>scss</category>
      <category>metaprogramming</category>
      <category>styling</category>
    </item>
    <item>
      <title>This is why I love Git (and Vim)! (also, is there a better solution?)</title>
      <dc:creator>Nir Lanka ニル</dc:creator>
      <pubDate>Fri, 17 Jan 2020 07:00:49 +0000</pubDate>
      <link>https://dev.to/nirlanka/this-is-why-i-love-git-and-vim-also-is-there-a-better-solution-3h35</link>
      <guid>https://dev.to/nirlanka/this-is-why-i-love-git-and-vim-also-is-there-a-better-solution-3h35</guid>
      <description>&lt;p&gt;Today I was pushing new commits to the remote pull-request branch which already had 5 commits. Then we realized it can't be tested with functionality in our main &lt;code&gt;develop&lt;/code&gt; branch since mine was too behind. Well, without merging from &lt;code&gt;develop&lt;/code&gt; to &lt;code&gt;my-feature&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The problem was not how to do this easily, as a simple &lt;code&gt;git checkout my-feature; git merge develop;&lt;/code&gt; and a bit of conflict resolution before &lt;code&gt;git add .; git commit&lt;/code&gt; should do the trick; but how to have a cleaner history. i.e. We wanted a single commit that can be tested and merged back to &lt;code&gt;develop&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And to top that, we wanted to squash all 6 commits in &lt;code&gt;my-feature&lt;/code&gt; into one, for ease of code-review.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclaimer: I don't like over-relying on &lt;code&gt;rebase&lt;/code&gt;, since it can be used to change history, which is (1) dishonest, and (2) dangerous. But in this case, we had to do it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So I got to work of fixing this issue.&lt;/p&gt;

&lt;p&gt;Now, I'm not a great Git hacker. I do know the concepts of git and bash and try to optimize the way I do things, but I am far from being able to hack out solutions like this without looking up stuff.&lt;/p&gt;

&lt;p&gt;So I thought how I'd manually do this.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Extract the changes&lt;/li&gt;
&lt;li&gt;Remove branch&lt;/li&gt;
&lt;li&gt;Add new branch&lt;/li&gt;
&lt;li&gt;Add changes&lt;/li&gt;
&lt;li&gt;Commit&lt;/li&gt;
&lt;li&gt;Force push&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Fun with &lt;code&gt;squash&lt;/code&gt; (in Vim)
&lt;/h2&gt;

&lt;p&gt;First I squashed the changes (which was redundant, as we later realize) with &lt;code&gt;git rebase -i &amp;lt;hash-last-commit-in-develop-branch&amp;gt;&lt;/code&gt;. At the rebase edit in Vim, I wanted to replace all but the first &lt;code&gt;pick&lt;/code&gt; commands with &lt;code&gt;s&lt;/code&gt; or &lt;code&gt;squash&lt;/code&gt;. I looked up and found &lt;code&gt;cgn&lt;/code&gt; which helps replace search items. I did these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to first line and search &lt;code&gt;pick&lt;/code&gt; by typing &lt;code&gt;/pick&lt;/code&gt;. Then press Enter.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;cgn&lt;/code&gt; and type in the new phrase to replace the old. Then press Esc.&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;.&lt;/code&gt; until all the adjacent lines I need are modified.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:wq&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Of course, this was totally unnecessary, since I'm using &lt;code&gt;git diff&lt;/code&gt; later, which I didn't plan at this stage.&lt;/p&gt;

&lt;p&gt;This is when I realized I have to delete this new squashed commit and start over! (because I would still have to merge from &lt;code&gt;develop&lt;/code&gt; and it would create a merge commit and would be messy).&lt;/p&gt;

&lt;h2&gt;
  
  
  Save the changes
&lt;/h2&gt;

&lt;p&gt;I'm not a huge fan of &lt;code&gt;git stash&lt;/code&gt;. I prefer something more tangible and reliable like &lt;code&gt;git diff &amp;gt; ./diff&lt;/code&gt;. Of course I may be ill-informed, but I find &lt;code&gt;git stash&lt;/code&gt; to be pretty limited and superficial, unlike &lt;code&gt;git diff&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So, to save the changes (which is now only in the current commit), I ran &lt;code&gt;git diff HEAD^ HEAD &amp;gt; ../diffs/my-feature.diff&lt;/code&gt;. This dumps all the changes (file updates, creates, deletes, everything) into a text file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Re-apply changes
&lt;/h2&gt;

&lt;p&gt;Let's remove the local branch copy: &lt;code&gt;git branch -D my-feature&lt;/code&gt;. We can force push later to replace the remote branch copy.&lt;/p&gt;

&lt;p&gt;Now I re-created the branch new from develop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout develop
git pull
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; my-feature
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then I applied the diff back: &lt;code&gt;git apply ../diffs/my-feature.diff&lt;/code&gt;. That hit me in the face. Hard.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;... lots of lines
error: patch failed: ...
... more lines
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Of course, I should've expected this. This has conflicts! Hey, wouldn't it be great if applying a git diff could work like a branch merge? Well, I was in luck, as it turned out to not just be entirely possible, but also quite simple!&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git apply ../diffs/my-feature.diff -3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So simple! Just add &lt;code&gt;-3&lt;/code&gt;. Then it applied the diff with conflicts saved the same way &lt;code&gt;git merge&lt;/code&gt; does. All I had to do then was to resolve conflicts, &lt;code&gt;add&lt;/code&gt;, &lt;code&gt;commit&lt;/code&gt; everything, and do &lt;code&gt;git push origin my-feature --force&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That was all!&lt;/p&gt;

&lt;h2&gt;
  
  
  So &lt;em&gt;why&lt;/em&gt; do I love Git and Vim, again?
&lt;/h2&gt;

&lt;p&gt;Well, it's the crazy simplicity. Everything in Git can be represented as text. And everything, no matter how separate they seem, follow the same rules. Look at how &lt;code&gt;git diff&lt;/code&gt; can work similar to &lt;code&gt;git merge&lt;/code&gt;! They are completely different areas!&lt;/p&gt;

&lt;p&gt;Also, Vim. I love Sublime Text. I use it for quick advanced text-edits. I love its multi-cursor functionality. It's crazy. But Vim doesn't need a multi-cursor functionality! Instead, it makes the whole process simpler and more extensible! No limitations of simple GUI apps. You can do so much more with very little knowledge and concepts!&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: my git aliases
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;~/.gitconfig&lt;/code&gt; - &lt;code&gt;[alias]&lt;/code&gt; -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;co = checkouti
br = branch
ci = commit
cm = commit -m
a = add
st = status
unstage = reset HEAD --
last = log -1 HEAD
visual = !gitk
stage = add
df = diff
rb = rebase
undo = reset HEAD~1
redo = reset \"HEAD@{1}\"
amend = commit --amend
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I got these aliases from somewhere that I can't find right now. Sorry about not crediting the original writer. Thanks!&lt;/p&gt;

&lt;p&gt;Thanks for reading through this ramble! I hope it had some exciting new stuff that would help you. I may have been silly in how I did this, in which case I'd love to hear about how you'd solve it. :)&lt;/p&gt;

</description>
      <category>git</category>
      <category>hack</category>
      <category>quicknote</category>
      <category>storytime</category>
    </item>
    <item>
      <title>Will Svelte ever beat the giants?</title>
      <dc:creator>Nir Lanka ニル</dc:creator>
      <pubDate>Mon, 23 Dec 2019 10:45:37 +0000</pubDate>
      <link>https://dev.to/nirlanka/will-svelte-ever-beat-the-giants-1ged</link>
      <guid>https://dev.to/nirlanka/will-svelte-ever-beat-the-giants-1ged</guid>
      <description>&lt;p&gt;If you haven't already come across &lt;a href="https://svelte.dev/"&gt;Svelte&lt;/a&gt;, it's a new web framework/compiler that's gaining attention due to it's radically new -yet simple- approach to handling front-end data changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;whoami&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;I have worked for almost 9 years with multiple web technologies including vanilla Javascript, jQuery, AngularJS, Angular, Ionic Stencil and React. For a few years, I've been using the two big (pun intended) frameworks: Angular and React.&lt;/p&gt;

&lt;h2&gt;
  
  
  Angular, React, and their popularity
&lt;/h2&gt;

&lt;p&gt;Angular is backed by Google, while React is backed by Facebook. &lt;/p&gt;

&lt;p&gt;While they provide really great tools in app development with a lot of ground-breaking usability approaches and some inspired behind-the-scenes engineering, I see the major reason for their current popularity as the reputation of their parent companies and the extensive marketing done by them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Svelte
&lt;/h2&gt;

&lt;p&gt;I believe it's hard to deny how much Svelte changes the game from a technical point of view. It solves some of the largest baggage that comes with the big frameworks: performance, delivery size, complex reactivity, and less boilerplate. &lt;/p&gt;

&lt;p&gt;The way Svelte solves these issues is extremely simple and elegant:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Whereas traditional frameworks [...] do the bulk of their work in the browser, Svelte shifts that work into a compile step that happens when you build your app.&lt;br&gt;
(&lt;a href="https://svelte.dev"&gt;svelte.dev&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;To read more about how Svelte is truly "reactive", read &lt;a href="https://blog.logrocket.com/truly-reactive-programming-with-svelte-3-0-321b49b75969/"&gt;this article by Ovie Okeh on LogRocket&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Perks of being a compiler
&lt;/h3&gt;

&lt;p&gt;By not being a framework but a compiler, Svelte is able to do something that makes developers happy: get rid of boilerplate code. Instead of using decorators, hooks or &lt;code&gt;setState()&lt;/code&gt; methods, developers using Svelte can just assign to variables and expect the changes to be recognized. &lt;/p&gt;

&lt;p&gt;Svelte uses valid Javascript, but makes smart code additions to enable reactivity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Svelte is David to the two big Goliaths
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;(Is it Goliaths? or Goliathes? Golii?)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Svelte is getting a lot of recognition and generating interest among the front-end developer community. But the adoption rate is still relatively low, as expected of any newcomer front-end technology. It happened before, as seen with Vue, and will happen in the future too.&lt;/p&gt;

&lt;p&gt;However, Svelte's background is not the same as that of Vue's, at least not yet, in terms of "backing", or "killer projects" that really exposed it to the world. &lt;/p&gt;

&lt;p&gt;Svelte was mostly developed somewhat "under the radar", and the world only really started to see its impact by the release of version 3, which made a lot of visible and effective improvements.&lt;/p&gt;

&lt;p&gt;My observation has been that a lot of experienced engineers are really excited about Svelte and have begun using it for new projects whenever they have control over the choice of technology. It's a good trend because of the knowledge and experience of these people that solidifies the trust in anyone observing this.&lt;/p&gt;

&lt;p&gt;No matter the apparent advantages in developer happiness, lower cognitive overload as well as tangible advantages like time to market and performance, enterprise customers and new-comer developers are yet to discover Svelte's beauty.&lt;/p&gt;

&lt;p&gt;Enterprises are yet to find an incentive to use a technology without it being time-tested, backed and supported by other enterprises. This is not a problem for Angular and React due to their high-profit parent companies.&lt;/p&gt;

&lt;p&gt;On the other hand, new developers tend to go for the most popular technologies. Their incentive is the position of that technology in the job market and its stability.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, what'll happen?
&lt;/h2&gt;

&lt;p&gt;I don't think Svelte is just another hype. It may not fit all kinds of requirements other big frameworks help solve, but it seems to be very good at solving issues in the simplest and most elegant-yet-obvious ways, at the same time being as less intrusive as possible.&lt;/p&gt;

&lt;p&gt;I'm quite optimistic about Svelte's future. I believe it will be much more popular in the future. While it's hard to say if it would beat any of the big two: they may have a lot of problems, but the amount of professional fixes and updates, as well as the community support is very hard to beat without the backing of a successful company.&lt;/p&gt;

&lt;p&gt;I don't think Svelte will always be what it is today. It probably will head in new and exciting directions that we never thought of; because innovation is in its blood.&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>javascript</category>
      <category>popularity</category>
    </item>
  </channel>
</rss>
