<?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>Forem: Trent Yang</title>
    <description>The latest articles on Forem by Trent Yang (@trentyang).</description>
    <link>https://forem.com/trentyang</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%2F125368%2F44efdaf5-0349-4486-8ac9-11fb22697da1.jpeg</url>
      <title>Forem: Trent Yang</title>
      <link>https://forem.com/trentyang</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/trentyang"/>
    <language>en</language>
    <item>
      <title>Git ABC - Start remembering and stop googling</title>
      <dc:creator>Trent Yang</dc:creator>
      <pubDate>Mon, 27 May 2019 21:39:54 +0000</pubDate>
      <link>https://forem.com/trentyang/git-abc-start-remembering-and-stop-googling-2e18</link>
      <guid>https://forem.com/trentyang/git-abc-start-remembering-and-stop-googling-2e18</guid>
      <description>&lt;p&gt;I was once a Git googler (I mean I google Git a lot :P) until one day I sit down and decide to spend a bit of time remembering the most common commands. My approach was to develop an easy-to-understand framework and use systematic aliases to replace Git commands. If that sounds interesting, I present you the Git ABC.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/3o6Zti2G1pq3skGxKE/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3o6Zti2G1pq3skGxKE/giphy.gif" alt="git abc"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Git ABC
&lt;/h2&gt;

&lt;p&gt;There are three stages a file change (for example adding a new line) need to go through in Git. I use A, B and C to represent them.&lt;/p&gt;
&lt;h4&gt;
  
  
  Stage A
&lt;/h4&gt;

&lt;p&gt;Unstaged changes and untracked files are in stage A. &lt;code&gt;git status&lt;/code&gt; will show them in red.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sI3muWTv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/git-a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sI3muWTv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/git-a.png" alt="Stage A"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Stage B
&lt;/h4&gt;

&lt;p&gt;Once we &lt;code&gt;git add -A&lt;/code&gt;, changes will be moved to stage B. &lt;code&gt;git status&lt;/code&gt; will show them in green.&lt;br&gt;
In Git lingo, these changes are now 'staged'.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oPtzM_iX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/git-b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oPtzM_iX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/git-b.png" alt="Stage B"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Stage C
&lt;/h4&gt;

&lt;p&gt;After we &lt;code&gt;git commit -m&lt;/code&gt;, changes will be moved to stage C (committed stage).&lt;/p&gt;
&lt;h2&gt;
  
  
  Alias
&lt;/h2&gt;

&lt;p&gt;Now comes the fun part.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RsrbOxXc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/git-abc.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RsrbOxXc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/git-abc.svg" alt="Git ABC"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Move forward
&lt;/h4&gt;

&lt;p&gt;Git users should already be familiar with &lt;code&gt;git add&lt;/code&gt; and &lt;code&gt;git commit&lt;/code&gt; so I choose the following aliases to move changes forward&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;alias ga='git add -A'&lt;/code&gt; (Git Add) move changes from stage A to B&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alias gc='git commit -m'&lt;/code&gt; (Git Commit) move changes from stage B to C&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Move backward
&lt;/h4&gt;

&lt;p&gt;I use &lt;code&gt;go&lt;/code&gt; to undo changes. We can think of it as 'go away' :)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;alias go='git checkout'&lt;/code&gt; undo changes from A&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alias gou='git clean -id'&lt;/code&gt; (GO Untracked) remove un-tracked files from A&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alias gob='git reset HEAD'&lt;/code&gt; (GO from B) move changes from B to A&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alias goc='git reset --soft HEAD~1'&lt;/code&gt; (GO from C) move changes from C to B&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alias gocc='git reset --hard HEAD~1'&lt;/code&gt; (GO from C Confirm) remove the whole commit from C&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Check differences between stages
&lt;/h4&gt;

&lt;p&gt;I use &lt;code&gt;gd&lt;/code&gt; (Git Diff) to check the difference.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;alias gd='git diff'&lt;/code&gt; Difference between A and B&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alias gdbc='git diff --cached'&lt;/code&gt; Difference between B and C&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alias gdac='git diff HEAD'&lt;/code&gt; Difference between A and C&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alias gdc='git diff HEAD^ HEAD'&lt;/code&gt; All changes from the last Commit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here I listed all the aliases bellow so that you can copy and paste into your shell config files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# move forward
alias ga='git add -A'
alias gc='git commit -m'

# move backward / undo
alias go='git checkout'
alias gou='git clean -id' # u means Untracked files
alias gob='git reset HEAD'
alias goc='git reset --soft HEAD~1'
alias gocc='git reset --hard HEAD~1' # c means Confirm

# check difference
alias gd='git diff'
alias gdbc='git diff --cached'
alias gdac='git diff HEAD'
alias gdc='git diff HEAD^ HEAD'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Bonus aliases
&lt;/h2&gt;

&lt;p&gt;Some of my fun aliases do not fit into the framework above so I lump them here :)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# status
alias gs='git status'

# log
alias gl='git log'
alias glo='git log --oneline --decorate'

# stash and apply
alias gst='git stash'
alias gap='git stash apply --index'

# rebase
alias gr='git rebase'
alias grm='git fetch origin master:master &amp;amp;&amp;amp; git rebase master'
alias grs='git rebase --skip'
alias grc='git rebase --continue'
alias gri='git rebase -i master'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Go above and beyond
&lt;/h2&gt;

&lt;p&gt;At last, I encourage you to go crazy and create your own aliases for profit and fun :)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/39xDh4ja5Tp6IpDyBU/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/39xDh4ja5Tp6IpDyBU/giphy.gif" alt="go crazy"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Who is the most liked author on dev.to? - Analysis of top 500 posts</title>
      <dc:creator>Trent Yang</dc:creator>
      <pubDate>Wed, 09 Jan 2019 23:09:25 +0000</pubDate>
      <link>https://forem.com/trentyang/who-is-the-most-liked-author-on-devto---analysis-of-top-500-posts-2kg</link>
      <guid>https://forem.com/trentyang/who-is-the-most-liked-author-on-devto---analysis-of-top-500-posts-2kg</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to"&gt;dev.to&lt;/a&gt; is a thriving community for programmers. Since 2016, a lot of good contents are created, shared and liked.&lt;/p&gt;

&lt;p&gt;As a newcomer, I am curious what people care about on dev.to since I want my posts to be relevant.&lt;/p&gt;

&lt;p&gt;So I decided to analyze the top 500 posts ever created on dev.to using javascript.&lt;/p&gt;

&lt;h2&gt;
  
  
  data gathering
&lt;/h2&gt;

&lt;p&gt;There is no API provided by dev.to. But they do already have the ranked posts on this page &lt;a href="https://dev.to/top/infinity"&gt;https://dev.to/top/infinity&lt;/a&gt;. All I needed to do was to scroll down until I get 500 posts and scrap the data. Here is the &lt;a href="https://gist.github.com/Chun-Yang/735cd1ef320b6baf313eebdfd210f463"&gt;script&lt;/a&gt; and &lt;a href="https://gist.github.com/Chun-Yang/c19fd8c3209212fd820831a9e816a9d7"&gt;data&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are so many things we can extract from the data. I am interested in the following questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;which author is most liked?&lt;/li&gt;
&lt;li&gt;which author gets the most comments?&lt;/li&gt;
&lt;li&gt;which tag is used most frequently?&lt;/li&gt;
&lt;li&gt;do popular posts have numbers in their title?&lt;/li&gt;
&lt;li&gt;vim vs emacs?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And I wrote a &lt;a href="https://gist.github.com/Chun-Yang/6acd00cf7f9a0f1dd29393175b2c25d8"&gt;script&lt;/a&gt; to answer them. Are you also curious? Drumroll, please!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/ogGmxeqA8L3sA/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/ogGmxeqA8L3sA/giphy.gif" alt="drumroll"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  which author is the most liked?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dev.to/aspittel"&gt;Ali Spittel&lt;/a&gt; with 23 posts in top 500 is absolutely the darling of dev.to! I personally find her posts on the topic of blogging really informative and actionable.&lt;/p&gt;

&lt;p&gt;Here are the top 10 most liked authors on dev.to!&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;likes&lt;/th&gt;
&lt;th&gt;rank&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ali Spittel&lt;/td&gt;
&lt;td&gt;9570&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ben Halpern&lt;/td&gt;
&lt;td&gt;8876&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alex 👨🏼‍💻FullStack.Cafe&lt;/td&gt;
&lt;td&gt;3099&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sarthak Sharma&lt;/td&gt;
&lt;td&gt;2288&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max Antonucci&lt;/td&gt;
&lt;td&gt;2156&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nikita Sobolev&lt;/td&gt;
&lt;td&gt;1987&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Emma Wedekind ✨&lt;/td&gt;
&lt;td&gt;1941&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Blaine Osepchuk&lt;/td&gt;
&lt;td&gt;1698&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kim Arnett &lt;/td&gt;
&lt;td&gt;1691&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Isaac Lyman&lt;/td&gt;
&lt;td&gt;1594&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  which author gets the most comments?
&lt;/h2&gt;

&lt;p&gt;As the founder of dev.to, &lt;a href="https://dev.to/ben"&gt;Ben Halpern&lt;/a&gt; gets the most comments. Thank you, Ben, for your effort to create such an amazing community!&lt;/p&gt;

&lt;p&gt;It should not be surprising that 5 out of top 10 here overlap with top 10 most liked authors.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;comments&lt;/th&gt;
&lt;th&gt;rank&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ben Halpern&lt;/td&gt;
&lt;td&gt;1355&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ali Spittel&lt;/td&gt;
&lt;td&gt;1114&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;dev.to staff&lt;/td&gt;
&lt;td&gt;895&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kim Arnett &lt;/td&gt;
&lt;td&gt;452&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Andrew Davis&lt;/td&gt;
&lt;td&gt;301&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saurabh sharma&lt;/td&gt;
&lt;td&gt;301&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;David Wickes&lt;/td&gt;
&lt;td&gt;271&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sarthak Sharma&lt;/td&gt;
&lt;td&gt;269&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dan Abramov&lt;/td&gt;
&lt;td&gt;244&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max Antonucci&lt;/td&gt;
&lt;td&gt;214&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  which tag is used most frequently?
&lt;/h2&gt;

&lt;p&gt;Turns out that the most popular tags of the top 500 posts are very similar to the tags on &lt;a href="https://dev.to/tags"&gt;https://dev.to/tags&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Front end engineering is very popular here #javascript, #react. The community seems to be very #beginners friendly.&lt;/p&gt;

&lt;p&gt;Aha! I think I can create some react related posts for beginners to get more likes.😜&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/MJW59l6PiMfew/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/MJW59l6PiMfew/giphy.gif" alt="lightbulb"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;tag&lt;/th&gt;
&lt;th&gt;used&lt;/th&gt;
&lt;th&gt;rank&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;#javascript&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#beginners&lt;/td&gt;
&lt;td&gt;126&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#career&lt;/td&gt;
&lt;td&gt;116&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#webdev&lt;/td&gt;
&lt;td&gt;106&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#productivity&lt;/td&gt;
&lt;td&gt;75&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#programming&lt;/td&gt;
&lt;td&gt;49&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#discuss&lt;/td&gt;
&lt;td&gt;39&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#learning&lt;/td&gt;
&lt;td&gt;29&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#react&lt;/td&gt;
&lt;td&gt;26&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;#git&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  do popular posts have numbers in their title?
&lt;/h2&gt;

&lt;p&gt;About 100 posts out of the top 500 have numbers in the title. There does not seem to be any strong correlation between numbers in post title and popularity.&lt;/p&gt;

&lt;h2&gt;
  
  
  vim vs emacs?
&lt;/h2&gt;

&lt;p&gt;There are 6 #vim and 0 #emacs posts in top 500. For all the vim users out there, I want to say &lt;strong&gt;WE ARE THE CHAMPIONS&lt;/strong&gt; on dev.to!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3o7TKC2QtRON2JhUfS/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3o7TKC2QtRON2JhUfS/giphy.gif" alt="we are the champion"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just kidding. dev.to is a very inclusive community. It seems neither vim or emacs are very popular topics in the community. I think modern editors like VC code are much more popular.&lt;/p&gt;

&lt;p&gt;That's it! And may the best posts win!&lt;/p&gt;

&lt;p&gt;Here is the my blog &lt;a href="https://trentyang.com/who-is-the-most-liked-author-on-dev-to-analysis-of-top-500-posts/"&gt;https://trentyang.com/who-is-the-most-liked-author-on-dev-to-analysis-of-top-500-posts/&lt;/a&gt; if you are interested.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>meta</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Replace lifecycle with hooks in React</title>
      <dc:creator>Trent Yang</dc:creator>
      <pubDate>Sun, 06 Jan 2019 06:03:34 +0000</pubDate>
      <link>https://forem.com/trentyang/replace-lifecycle-with-hooks-in-react-3d4n</link>
      <guid>https://forem.com/trentyang/replace-lifecycle-with-hooks-in-react-3d4n</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnfj704jm4rxo0dvaqir8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnfj704jm4rxo0dvaqir8.png" alt="react hooks"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have ever used React, you should be familiar with power of React lifecycles. The upcoming React hooks are about to change the way we handle lifecycles.&lt;/p&gt;

&lt;p&gt;React hooks are a unification of existing features including state and lifecycles. In this post I am going to show you how to convert lifecycle class methods into React hooks to shine some light on React hooks.&lt;/p&gt;

&lt;p&gt;For each of the three most common lifecycle methods (componentDidMount, componentDidUpdate, componentWillUnmount), I will demonstrate a class style implementation and a hooks style counterpart followed by an explanation.&lt;/p&gt;

&lt;h2&gt;
  
  
  componentDidMount
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Example&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;componentDidMount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;I am mounted!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Example&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mounted&lt;/span&gt;&lt;span class="dl"&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;return&lt;/span&gt; &lt;span class="kc"&gt;null&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;&lt;a href="https://reactjs.org/docs/hooks-reference.html#useeffect" rel="noopener noreferrer"&gt;useEffect&lt;/a&gt; is a React hook where you can apply side effects, for example, getting data from server.&lt;/p&gt;

&lt;p&gt;The first argument is a callback that will be fired &lt;strong&gt;after&lt;/strong&gt; browser layout and paint. Therefore it does not block the painting process of the browser.&lt;/p&gt;

&lt;p&gt;The second argument is an array of values (usually props).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If any of the value in the array changes, the callback will be fired after every render.&lt;/li&gt;
&lt;li&gt;When it's not present, the callback will always be fired after every render.&lt;/li&gt;
&lt;li&gt;When it's an empty list, the callback will only be fired once, similar to componentDidMount.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  componentDidUpdate
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;componentDidMount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mounted or updated&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;componentDidUpdate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mounted or updated&lt;/span&gt;&lt;span class="dl"&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mounted or updated&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is not a straight forward implementation in hooks to replace componentDidUpdate. The &lt;code&gt;useEffect&lt;/code&gt; function can be used to trigger callbacks after every render of the component including after component mounts and component updates.&lt;/p&gt;

&lt;p&gt;However this is not a big problem since most of the time we place similar functions in componentDidMount and componentDidUpdate.&lt;/p&gt;

&lt;p&gt;Mimicing only componentDidUpdate can be a discussion of another post.&lt;/p&gt;

&lt;h2&gt;
  
  
  componentWillUnmount
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;componentWillUnmount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;will unmount&lt;/span&gt;&lt;span class="dl"&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;will unmount&lt;/span&gt;&lt;span class="dl"&gt;'&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;span class="p"&gt;[]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you return a function in the callback passed to &lt;code&gt;useEffect&lt;/code&gt;, the returned function will be called before the component is removed from the UI.&lt;/p&gt;

&lt;p&gt;As we discussed previously, we need to pass an empty list as the second argument for &lt;code&gt;useEffect&lt;/code&gt; so that the callback will only be called once. This apply to the returned function too.&lt;/p&gt;

&lt;p&gt;Normally we do cleanups in the componentWillUnmount. Let's say you want to create an event listener on componentDidMount and clean it up on componentDidUnmount. With hooks the code will be combined into one callback function.&lt;/p&gt;

&lt;p&gt;We can create multiple hooks for different side effects and reuse them. Grouping correlated code together and making state management reusable is one of the main purpose of React hooks.&lt;/p&gt;

&lt;h2&gt;
  
  
  useEffect vs useLayoutEffect
&lt;/h2&gt;

&lt;p&gt;Now we can convert componentDidMount, componentDidUpdate, and componentWillUnmount into React hooks, great!&lt;/p&gt;

&lt;p&gt;Not so fast, there is a catch: the effects are not exactly the same between the two styles.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Unlike componentDidMount and componentDidUpdate, the function passed to useEffect fires after layout and paint, during a deferred event.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Normally this is not a problem. But if you want to manipulate DOM in the effect, and want to make sure it happens before browser paint, you need to use &lt;a href="https://reactjs.org/docs/hooks-reference.html#uselayouteffect" rel="noopener noreferrer"&gt;useLayoutEffect&lt;/a&gt;. The syntax is the same as &lt;code&gt;useEffect&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;To sum it up, we can use &lt;code&gt;useEffect&lt;/code&gt; hook to replace lifecycle methods, but they are not exactly the same. Try to think in hooks when you use them!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/hooks-faq.html#from-classes-to-hooks" rel="noopener noreferrer"&gt;https://reactjs.org/docs/hooks-faq.html#from-classes-to-hooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/hooks-reference.html#useeffect" rel="noopener noreferrer"&gt;https://reactjs.org/docs/hooks-reference.html#useeffect&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you enjoy reading this, here is my blog &lt;a href="https://trentyang.com/replace-react-lifecycles-with-hooks/" rel="noopener noreferrer"&gt;https://trentyang.com/replace-react-lifecycles-with-hooks/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>reacthooks</category>
    </item>
    <item>
      <title>How to setup google domain for github pages</title>
      <dc:creator>Trent Yang</dc:creator>
      <pubDate>Wed, 02 Jan 2019 07:32:51 +0000</pubDate>
      <link>https://forem.com/trentyang/how-to-setup-google-domain-for-github-pages-1p58</link>
      <guid>https://forem.com/trentyang/how-to-setup-google-domain-for-github-pages-1p58</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fldp2wmqxna0upqvthxks.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fldp2wmqxna0upqvthxks.png" alt="google domains and github pages"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Github pages is easy to setup, but to attach a custom domain with google domains, you may run into problems. Here is how you can do it in 4 steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You have a &lt;a href="https://pages.github.com/" rel="noopener noreferrer"&gt;github pages&lt;/a&gt; repository, e.g. &lt;a href="https://github.com/Chun-Yang/Chun-Yang.github.io" rel="noopener noreferrer"&gt;https://github.com/Chun-Yang/Chun-Yang.github.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You purchased a domain on &lt;a href="https://www.domains.google" rel="noopener noreferrer"&gt;google domain&lt;/a&gt;, e.g. trentyang.com&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  STEP 1/4: Let gitHub pages know your custom domain
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to your github repository settings page&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxavcwt5c3ff16nzsh2vn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxavcwt5c3ff16nzsh2vn.png" alt="GitHub Settings"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add you custom domain name at Settings &amp;gt; GitHub Pages &amp;gt; Custom domain&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwmwqvri9161rzfnzubey.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwmwqvri9161rzfnzubey.png" alt="GitHub Settings Github Pages"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  STEP 2/4: Let your custom domain (trentyang.com) points to your github pages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;a href="https://domains.google.com/m/registrar/" rel="noopener noreferrer"&gt;registar&lt;/a&gt; page on your google domains, select your domain&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcw7ck884ofn648qdvmba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcw7ck884ofn648qdvmba.png" alt="Google Domain Register"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to DNS &amp;gt; Custom resource records&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo0rff58g1sbpn6a3trpj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo0rff58g1sbpn6a3trpj.png" alt="DNS Custom resource records"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the record shown in the screenshot bellow. Note that you need to use the "+" button to add more urls.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4vf963i33x2fxqezf5a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4vf963i33x2fxqezf5a.png" alt="A record"&gt;&lt;/a&gt;&lt;br&gt;
Here is the list of ips in the screenshot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;185.199.111.153&lt;/li&gt;
&lt;li&gt;185.199.110.153&lt;/li&gt;
&lt;li&gt;185.199.109.153&lt;/li&gt;
&lt;li&gt;185.199.108.153&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Incase these are outdated, you can also find the latest ones at &lt;a href="https://help.github.com/articles/setting-up-an-apex-domain/#configuring-a-records-with-your-dns-provider" rel="noopener noreferrer"&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To confirm that your DNS record is set up correctly, use the dig command to do a lookup of your domain
```console
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;$ dig trentyang.com +noall +answer&lt;br&gt;
  trentyang.com.  3600  IN  A  185.199.111.153&lt;br&gt;
  trentyang.com.  3600  IN  A  185.199.110.153&lt;br&gt;
  trentyang.com.  3600  IN  A  185.199.109.153&lt;br&gt;
  trentyang.com.  3600  IN  A  185.199.108.153&lt;/p&gt;




&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;ul&gt;
&lt;li&gt;Once the above is successful, your custom domain should work correctly. Go to your domain and take a look!&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  STEP 3/4: Let your www sub-domain (&lt;a href="http://www.trentyang.com" rel="noopener noreferrer"&gt;www.trentyang.com&lt;/a&gt;) point to your github pages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Add the following CNAME record&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90b7slkyg82fdcxesefo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90b7slkyg82fdcxesefo.png" alt="CNAME record"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can use the following dig command to confirm that your setup is correct&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;$ dig &lt;a href="http://www.trentyang.com" rel="noopener noreferrer"&gt;www.trentyang.com&lt;/a&gt; +nostats +nocomments +nocmd&lt;br&gt;
  &lt;a href="http://www.trentyang.com" rel="noopener noreferrer"&gt;www.trentyang.com&lt;/a&gt;.      IN      A&lt;br&gt;
  &lt;a href="http://www.trentyang.com" rel="noopener noreferrer"&gt;www.trentyang.com&lt;/a&gt;. 1263 IN      CNAME   chun-yang.github.io.&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  STEP 4/4: (optional but HIGHLY recommended) Enable HTTPS for your github pages&lt;br&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to your github repository settings page, under Settings &amp;gt; GitHub Pages &amp;gt; Custom domain
remove your custom domain and save.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwmwqvri9161rzfnzubey.png" alt="GitHub Settings Github Pages"&gt;
&lt;/li&gt;
&lt;li&gt;Then add it back and save again.&lt;/li&gt;
&lt;li&gt;Now you should be able to check the "Enforce HTTPS" checkbox and secure your site!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you enjoy reading it, here is my blog &lt;a href="https://trentyang.com/how-to-setup-google-domain-for-github-pages/" rel="noopener noreferrer"&gt;https://trentyang.com/how-to-setup-google-domain-for-github-pages/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>githubpages</category>
      <category>googledomain</category>
    </item>
    <item>
      <title>From a self-taught developer to Facebook engineer</title>
      <dc:creator>Trent Yang</dc:creator>
      <pubDate>Wed, 02 Jan 2019 07:29:59 +0000</pubDate>
      <link>https://forem.com/trentyang/from-a-self-taught-developer-to-facebook-engineer-1m65</link>
      <guid>https://forem.com/trentyang/from-a-self-taught-developer-to-facebook-engineer-1m65</guid>
      <description>

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ua5tnbEB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/self-taught-to-facebook/fang.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ua5tnbEB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/self-taught-to-facebook/fang.jpg" alt="Fang Companies"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are an experienced software developer without a CS degree like me, here is how you can get a job from top tech companies like Facebook.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;I had been working at Poetic Systems, a Houston based consulting company, for three years before I applied for Facebook. Here is my &lt;a href="https://www.linkedin.com/in/chun-trent-yang-247a8060/"&gt;Linkedin&lt;/a&gt; if you want to know more about me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Timeline
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;05/11/2017 I submitted my resume on Facebook Careers.&lt;/li&gt;
&lt;li&gt;08/21/2017 I was contacted by a Facebook recruiter and we setup the phone interview.&lt;/li&gt;
&lt;li&gt;09/26/2017 Phone interview.&lt;/li&gt;
&lt;li&gt;09/29/2017 The recruiter informed me that I passed the phone interview and we setup the on-site interview.&lt;/li&gt;
&lt;li&gt;10/16/2017 On-site interview.&lt;/li&gt;
&lt;li&gt;10/23/2017 I was told that Facebook need an additional phone interview to decide on my case and we scheduled another phone interview&lt;/li&gt;
&lt;li&gt;10/30/2017 Phone interview.&lt;/li&gt;
&lt;li&gt;11/09/2017 Recruiter told me I was hired.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Find the right job
&lt;/h2&gt;

&lt;p&gt;The job I applied for was "Software Engineer, Enterprise". In my previous company, I was exposed to different kinds of web applications. One project I was really proud of was a custom enterprise application builder. And I thought my expertise on this area can give me a better chance since this project is &lt;strong&gt;relevant&lt;/strong&gt; to what they are trying to hire.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write a concise resume
&lt;/h2&gt;

&lt;p&gt;Here is the &lt;a href="https://docs.google.com/document/d/1NYSpOMyNElvszKvXj628ifn0jerD7nR_2EOy-1Esznw"&gt;resume&lt;/a&gt; I submitted to &lt;a href="https://www.facebook.com/careers/"&gt;Facebook Careers&lt;/a&gt;. My awesome friend &lt;a href="https://www.linkedin.com/in/guangjie-jerry-shi-0ab14b38/"&gt;Jerry Shi&lt;/a&gt; at Google helped me a lot on my resume. One important thing I learnt was that my resume should be a &lt;strong&gt;one pager&lt;/strong&gt;. Recruiters do not have enough time to go over every projects that I worked on. I needed to help the recruiter by condensing my value into quickly consumable pieces of info.&lt;/p&gt;

&lt;p&gt;I have a habit of &lt;strong&gt;documenting projects&lt;/strong&gt; I worked on on Linkedin. This helped me prepareing my resume. Also before in-person interviews I reviewed my previous projects in order to bring up interesting problems I solved and lessons I learnt. The preparation calmed me down and boosted my confidence. Both the recruiter and the interviewers asked about my previous experience on some level of details. Being able to talk about some interesting projects was definitely a plus for me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interviews preparation
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1KJjah-s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/self-taught-to-facebook/leetcode.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1KJjah-s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://trentyang.com/assets/image/self-taught-to-facebook/leetcode.png" alt="Leetcode"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Read an algorithem book
&lt;/h3&gt;

&lt;p&gt;I did not have a CS degree, but I did read one algorithm book (Algorithms by Robert Sedgewick and Kevin Wayne) and finished several CS courses on Coursera and Udacity even before my first job. I would definitely recommend any software engineer to read an algorithm book especially when you do not hold a CS degree. This is not just tremendously helpful for the interviews, a software engineer absolutely need to know the fundamentals if he/her wants to develop decently complicated programs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Preparation strategy
&lt;/h3&gt;

&lt;p&gt;I mainly used leetcode to prepare for the interview questions since they have &lt;strong&gt;real&lt;/strong&gt; interview questions. Geeksforgeeks is another website I used to understand the fundamentals of algorithm implementations.&lt;/p&gt;

&lt;p&gt;I started preparing for the coding interviews around October 2016. Initially I was preparing for a Google interview around March 2017. It was a close call but unfortunately I did not get an offer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the first two weeks my preparation strategy was to bang my head on the questions. I tried to solve the questions by myself "organically". This was definitely not the right mentality. This approach was just too time consuming. And I did not learn too much since I just tried to solve those problems by myself.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After about two weeks I realized that there was just no way I can solve a significant amount of questions (300 was my goal) with my hard core strategy. I decided to read the solutions from leetcode forums. The leetcode forum is an absolute gold mine! The top solutions are very elegant, a lot of the solutions contain detailed explanation and some authors summarize and generalize for a class of problems!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After about one month, I realized that there are different topics for the problems, for example, dynamic programming, binary search, etc. I can cover more types of problems to go over each of the topics instead of just try to solve the problems by their index number which in hindsight seems sort of arbitrary. So I started to solve several problems from each topics.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There was a lot of back and forth from solving leetcode problems and brushing up my basic algorithm skills from re-reading the algorithm book. I felt it's a harding process for my understanding of algorithms. When I first read the book and followed the courses, I never solved an extensive amount of algorithm problems with real code. The leetcode challenges felt a long over due exercise.&lt;/p&gt;

&lt;p&gt;Algorithm training was a time consuming process. And I had a full time job to do and a new born baby to take care of. Luckily for me, my family were super supportive! My mother-in-law and my wife took care most of chores at home. I was really grateful!&lt;/p&gt;

&lt;p&gt;I end up coding the first 400 problems more than two times in python and Java. As a result the coding problems in the interviews did not feel too hard for me. Some of the interview questions actually were very similar to those from Leetcode.&lt;/p&gt;

&lt;h3&gt;
  
  
  Code in Java
&lt;/h3&gt;

&lt;p&gt;I would recommend Java if you are not familiar  with C or C++ already. Here are the reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;During my Facebook interview, the language did not matter. But it mattered for my Google interview. At Google, core languages, such as Java, C or C++, were required skills which I was only aware of at the last interview.&lt;/li&gt;
&lt;li&gt;Java contains a very extensive built-in data structures. For example the TreeMap class is an implementation of Red-Black tree. This data structure is not built-in for Javascript, Python or Ruby.&lt;/li&gt;
&lt;li&gt;Most of the folks working at the top tech companies hold CS degrees and more often than not they know Java because of their education. Using Java makes things easier for them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What I could have done better
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Spend less time stuck on a problem, get solution from the forum quicker (Spend 15 mins without any clue is a good indication to seek for help)&lt;/li&gt;
&lt;li&gt;Spend more time reading solutions in the forum since the best solutions are very elegant and worth learning even if I solved the problem my self&lt;/li&gt;
&lt;li&gt;Spend more time reviewing the previous solved questions instead of trying to conquer more problems, reviewing systematically and following a plan
focused on the algorithms when reviewing instead of coding the solution again which is really time consuming&lt;/li&gt;
&lt;li&gt;Buy the subscription and use the categorization by company feature&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Talk out loud in interviews
&lt;/h3&gt;

&lt;p&gt;Surely I could not have guess what the questions would be in the interviews, but I could prepare a strategy. One important thing to keep in mind is that the interviews are meant to evaluate your capability. And the best way you can help interviewers is to talk out loud. Whatever you are thinking, you should make it explicit. Coding correctly with the most efficient algorithm on a white board is very important, but conveying our thought process is also very valuable in an interview since this send more helpful signals to the interviewer, expecially when you are not doing very good at coding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interviews process
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o8eVYeMX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://trentyang.com/assets/image/self-taught-to-facebook/interview.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o8eVYeMX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://trentyang.com/assets/image/self-taught-to-facebook/interview.gif" alt="Interview from https://media.giphy.com/media/FcTdv3xQKhCIE/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Phone interview
&lt;/h3&gt;

&lt;p&gt;Phone interview is a screening process. It seems Facebook use this interview to quickly filter out unqualified candidates. I was asked to solve a algorithm problem in a coding environment like Google Docs. This interview is not too changeling for me.&lt;/p&gt;

&lt;h3&gt;
  
  
  On-site interview
&lt;/h3&gt;

&lt;p&gt;After I passed the phone interview I was invited to the onsite interview. Since I lived in Houston, I had to fly to Menlo Park just for the interview. Facebook scheduled and paid for the entire trip which was very generous of them.&lt;/p&gt;

&lt;p&gt;Here is the schedule on the day of the on-site interview:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;system design interview&lt;/li&gt;
&lt;li&gt;coding interview&lt;/li&gt;
&lt;li&gt;lunch with a engineer (I was not evaluated during lunch)&lt;/li&gt;
&lt;li&gt;coding interview&lt;/li&gt;
&lt;li&gt;coding interview&lt;/li&gt;
&lt;li&gt;coding interview&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each interview lasted around 45 mins. The whole process was intensive.&lt;/p&gt;

&lt;h4&gt;
  
  
  coding interviews
&lt;/h4&gt;

&lt;p&gt;The coding interviews are similar to leetcode problems just on a white board. I thought I did OK on three of them. And for one of them I presented several non-optimal solutions but eventually was guided to the optimal solution.&lt;/p&gt;

&lt;h4&gt;
  
  
  system design interviews
&lt;/h4&gt;

&lt;p&gt;I did not prepare too much for the system design interview except went through &lt;a href="https://www.hiredintech.com/system-design"&gt;this&lt;/a&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One reason was that it would be hard to prepare for a very interactive, fluid and relatively high level conversation from reading articles.&lt;/li&gt;
&lt;li&gt;The other reason was that I have several projects under my belt.
This interview actually went well for me.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Additional phone interview
&lt;/h3&gt;

&lt;p&gt;The additional phone interview was rare. The reason for this interview was to gather more signals for the hire committee did not agree on the hiring decision. This interview was exactly like the first phone interview I was given.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tips during interviews
&lt;/h3&gt;

&lt;p&gt;It's easy to be nervous when under pressure and the stake is high. I was more excited than nervous this time. Here's what I did to reduce the anxiety:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Be prepared. Having a plan is always a good thing even the plan did not end up working.&lt;/li&gt;
&lt;li&gt;Be relaxed. Getting rejected is really not a big deal. You may already had a job that you like. And you could always apply again. Do not get discouraged when rejected (And I was rejected by Google previously). There was a lot of luck involved including the interview questions, interviewers and the company's hiring plan.&lt;/li&gt;
&lt;li&gt;Be cooperative. The goal of the interviewer is to evaluate your capability as accurate as possible. Tell the interviewer what you think and listen for subtle cues when you get stuck.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;I tried to document my experience of getting a job at Facebook. The process should be very similar to the other tech giants. It would be my pleasure if you can get any value out of this post. Never stop improving!&lt;/p&gt;

&lt;p&gt;If you enjoy reading it, here is my blog &lt;a href="https://trentyang.com/from-a-self-taught-developer-to-facebook/"&gt;https://trentyang.com/from-a-self-taught-developer-to-facebook/&lt;/a&gt;&lt;/p&gt;


</description>
      <category>careerjob</category>
    </item>
  </channel>
</rss>
