{"componentChunkName":"component---src-templates-blog-list-template-js","path":"/154","result":{"data":{"allMarkdownRemark":{"edges":[{"node":{"excerpt":"1. Nim Game Click to View Original Question This question is very easy once you figure out the trick behind the game.\nSince each time you…","fields":{"slug":"/engineering/nim-game-add-digits-maximum-depth-of-binary-tree/"},"html":"<h3 id=\"1-nim-game\" style=\"position:relative;\"><a href=\"#1-nim-game\" aria-label=\"1 nim game permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1. Nim Game</h3>\n<p><a href=\"https://leetcode.com/problems/nim-game/\">Click to View Original Question</a></p>\n<p>This question is very easy once you figure out the trick behind the game.\nSince each time you can only pick 3 stones at most, if there are 4 stones originally on the table, no matter how many you take ... your hopefully non-stupid friend can easily beat you. The same logic also applies when the number of stones is more than 4.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">/**</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">* </span><span class=\"mtk4\">@param</span><span class=\"mtk3\"> </span><span class=\"mtk10\">{number}</span><span class=\"mtk3\"> </span><span class=\"mtk12\">n</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">* </span><span class=\"mtk4\">@return</span><span class=\"mtk3\"> </span><span class=\"mtk10\">{boolean}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk11\">canWinNim</span><span class=\"mtk1\"> = </span><span class=\"mtk4\">function</span><span class=\"mtk1\">(</span><span class=\"mtk12\">n</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk12\">n</span><span class=\"mtk1\"> % </span><span class=\"mtk7\">4</span><span class=\"mtk1\"> === </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> ? </span><span class=\"mtk4\">false</span><span class=\"mtk1\"> : </span><span class=\"mtk4\">true</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">};</span></span></code></pre>\n<h3 id=\"\" style=\"position:relative;\"><a href=\"#\" aria-label=\" permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h3>\n<p>2. Add Digits</p>\n<p><a href=\"https://leetcode.com/problems/add-digits/\">Click to View Original Question</a></p>\n<p>This is a tricky question, the key is trying to find the repetitive pattern of the Digits Sum. If you can't get the pattern by observation then we can do some math to find the pattern.</p>\n<p>So assume we have a 4 digit number \"abcd\" or 1234, and we want to find out the sum of the digits which in expression is:</p>\n<p>var digitSum = a + b + c + d</p>\n<p>We still can't figure out the answer from this alone, so we need to find something else to help us to get the value. Then we can consider the actual value of \"abcd\" = 1000a + 100b + 10c + d.</p>\n<p>- If you're familiar with Ring Theory (pretty sure it's Ring Theory.. I could be wrong..) then perfect! Under Ring 9, the actual value of abcd === a + b + c + d.\n- And if you don't know about Ring Theory, think of this as getting the remainder of \"abcd\" divided by 9</p>\n<p>> (1000a + 100b + 10c + d) % 9 => (999a + a + 99b + b + 9c + c + d) % 9 => a + b + c + d</p>\n<p>So whatever the reminder is equals to the sum of the digits and that is more than enough information to solve the question.</p>\n<p><strong>Be careful with the number 0 !!</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">/**</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">* </span><span class=\"mtk4\">@param</span><span class=\"mtk3\"> </span><span class=\"mtk10\">{number}</span><span class=\"mtk3\"> </span><span class=\"mtk12\">num</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">* </span><span class=\"mtk4\">@return</span><span class=\"mtk3\"> </span><span class=\"mtk10\">{number}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">*/</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk11\">addDigits</span><span class=\"mtk1\"> = </span><span class=\"mtk4\">function</span><span class=\"mtk1\">(</span><span class=\"mtk12\">num</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">num</span><span class=\"mtk1\"> === </span><span class=\"mtk7\">0</span><span class=\"mtk1\">) </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk12\">num</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk12\">num</span><span class=\"mtk1\"> % </span><span class=\"mtk7\">9</span><span class=\"mtk1\"> === </span><span class=\"mtk7\">0</span><span class=\"mtk1\"> ? </span><span class=\"mtk7\">9</span><span class=\"mtk1\"> : </span><span class=\"mtk12\">num</span><span class=\"mtk1\"> % </span><span class=\"mtk7\">9</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">};</span></span></code></pre>\n<h3 id=\"-1\" style=\"position:relative;\"><a href=\"#-1\" aria-label=\" 1 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h3>\n<p>3. Maximum Depth of Binary Tree</p>\n<p><a href=\"https://leetcode.com/problems/maximum-depth-of-binary-tree/\">Click to View Original Question</a></p>\n<p>This is very typical of recursion problems, and recursion is always hard to explain in words</p>\n<p>(╯‵□′)╯︵┻━┻</p>\n<p>Regardless I will try my very best to describe it.</p>\n<p>1. You have a tree node, and check if it is an empty tree, if so return 0\n2. If it is not empty, use recursion to find the value\n3. The recursion will start with the left node of root, and iterate through the tree, and keep checking the depth of each node till reaching out to the leaves. Each node (small root) records its maximum depth value by a record count called \"\"currentLength\"\".\n4. Until the whole tree is traversed, the root will compare its leftLength and rightLength and return the answer!</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\"> </span><span class=\"mtk12\">rightLength</span><span class=\"mtk1\"> ? </span><span class=\"mtk12\">leftLength</span><span class=\"mtk1\"> : </span><span class=\"mtk12\">rightLength</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk12\">rootLength</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}--&gt;</span></span></code></pre>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n</style>","frontmatter":{"date":"November 24, 2015","updated_date":null,"description":null,"title":"Nim Game, Add Digits, Maximum Depth of Binary Tree","tags":["Nim","JavaScript"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/e9162a5f9c634d0d0932d5bc4a18b24e/6d161/nim-blog-150x150.png","srcSet":"/static/e9162a5f9c634d0d0932d5bc4a18b24e/6d161/nim-blog-150x150.png 150w","sizes":"(max-width: 150px) 100vw, 150px"}}},"author":{"id":"Lucius Yu","github":null,"avatar":null}}}},{"node":{"excerpt":"As a preface to this article: preprocessors can be used for a variety of file types, but this article is going to focus solely on CSS…","fields":{"slug":"/engineering/the-truth-about-css-preprocessors-and-how-they-can-help-you/"},"html":"<p>As a preface to this article: preprocessors can be used for a variety of file types, but this article is going to focus solely on CSS preprocessors. Additonally I'm going to try and avoid my personal bias and give a very generic description of CSS preprocessors rather than my preferred preprocessor.</p>\n<h2 id=\"introduction\" style=\"position:relative;\"><a href=\"#introduction\" aria-label=\"introduction permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Introduction</h2>\n<p>First off what is a preprocessor? To give you a simple analogy think of speaking with someone, in a language you understand, who has a strong accent or is speaking in a different dialect. They're technically speaking the same language as you, but actually understanding what they're saying can be next to impossible.</p>\n<p>In the context of CSS, the \"normal\" or unaccented language would be CSS and the accented version would be the preprocessor! What this means in practice is that you're writing out expressions that resemble standard CSS, but with some very distinct differences with regards to its syntax.</p>\n<p>As with regular spoken language, there's not a whole lot we can do with something we can't understand. Luckily there are translators, and the same is true of preprocessors. The preprocessor code can be processed (there are a number of different ways to accomplish this), and then out pops an understandable standard-syntax CSS file ready to be used.</p>\n<p>Now why would we want to write CSS in some weird way you might ask? An excellent question! Because our nonsense can be translated into regular CSS, this allows us to write some very robust and even dynamic CSS expressions.</p>\n<h2 id=\"new-toys\" style=\"position:relative;\"><a href=\"#new-toys\" aria-label=\"new toys permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>New Toys</h2>\n<p>With preprocessors we've got a bundle of features now available to be used along with all the standard CSS rules we're accustomed to writing.</p>\n<p>To name a few features supported by preprocessors we've got: functions, mixins, math, variables, operators, conditionals, iteration and more to help you be more organized and write less overall.</p>\n<h3 id=\"variables\" style=\"position:relative;\"><a href=\"#variables\" aria-label=\"variables permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Variables</h3>\n<p>Variables increase your maintainability drastically by making it so you only have to change a value in one place to affect it everywhere it was used. Imagine for example you want to add a Halloween theme to your site's colors.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.elementOne</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">orange</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.elementOne</span><span class=\"mtk1\"> </span><span class=\"mtk6\">p</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">black</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.elementTwo</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">orange</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">h3</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">color</span><span class=\"mtk1\">: </span><span class=\"mtk8\">black</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">a:hover</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">color</span><span class=\"mtk1\">:</span><span class=\"mtk8\">orange</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Changing them back would require you to go and change each instance of black or orange. However; with variables you can do something like this.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">$</span><span class=\"mtk4\">theme-color-1</span><span class=\"mtk1\">: orange;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">$</span><span class=\"mtk4\">theme-color-2</span><span class=\"mtk1\">: black;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.elementOne</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: $theme-color-1;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.elementOne</span><span class=\"mtk1\"> </span><span class=\"mtk6\">p</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">color</span><span class=\"mtk1\">: $theme-color-2;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.elementTwo</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">background-color</span><span class=\"mtk1\">: $theme-color-1;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">h3</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">color</span><span class=\"mtk1\">: $theme-color-2;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">a:hover</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">color</span><span class=\"mtk1\">: $theme-color-1;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Define the value of the variable in one place, and everywhere it gets used will be a reference to that value. Want to change all instances of black back to grey? Just change the variable definition and you're done.</p>\n<h3 id=\"functions--friends\" style=\"position:relative;\"><a href=\"#functions--friends\" aria-label=\"functions  friends permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Functions &#x26; Friends</h3>\n<p>Another one of the biggest features would be functions. With these you can set up one well written function definition and then sit back and let it do all the heavy lifting for you!</p>\n<p>Functions combined with math, variables, iteration, and conditionals allows you to write some very dynamic style rules. Think of sprite sheets where the value of the background position is being incremented with each statement. Instead of writing out each one by hand, make a function that uses math and iteration to change the background position.</p>\n<p>That's a very simple example, but I've seen some truly impressive and complicated designs created with the use of functions!</p>\n<h3 id=\"selectors\" style=\"position:relative;\"><a href=\"#selectors\" aria-label=\"selectors permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Selectors</h3>\n<p>One of my favorite features of preprocessors are the new selectors. The parent reference (&#x26;) allows you to group your rules so that everything pertaining to a specific element can be grouped together nicely.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.someElement</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    some-rule: some-value;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    &amp;:hover {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk8\">color</span><span class=\"mtk1\">: some-color;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Compiles to...</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.someElement</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    some-rule: some-value;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.someElement:hover</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">color</span><span class=\"mtk1\">: some-color;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>The parent selector takes whatever follows it immediately and tacks it on to the parent that it is nested under. In this case hover will be appended to .someElement. Another great one to check out is the root reference!</p>\n<h2 id=\"nesting-and-general-aesthetic\" style=\"position:relative;\"><a href=\"#nesting-and-general-aesthetic\" aria-label=\"nesting and general aesthetic permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Nesting and General Aesthetic</h2>\n<p>CSS's default format is ugly as sin. An endless tide of barely indented rules, hopefully organized in some meaningful way. With CSS preprocessors nesting is an awesome feature that helps your rules become more intuitive/logically grouped and increases readability. Nesting can give your CSS a much more distinct visual hierarchy not unlike HTML.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.someElement</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    some-rule: some-value;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    .someOtherElement {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        some-rule: another-value</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Compiles to...</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"css\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk6\">.someElement</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    some-rule: some-value;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk6\">.someElement</span><span class=\"mtk1\"> </span><span class=\"mtk6\">.someOtherElement</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    some-rule: another-value;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Full disclosure, your resulting CSS file will still likely look like someone dropped their bowl of Alphaghetti in their bowl of Alphabits and then threw that bowl at a wall. However; the file you actually work in will be considerably prettier, and that's all we care about.</p>\n<p>Some people have beef with preprocessors because of over done selectors which are a result of going a little too hard with nesting. An easy way to avoid this is by limiting your nesting to 3 levels deep. Any further than that gets pretty ugly, but hey I'm not your supervisor... if you feel it's necessary then you do what you gotta do.</p>\n<h2 id=\"processing-dependant\" style=\"position:relative;\"><a href=\"#processing-dependant\" aria-label=\"processing dependant permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Processing dependant</h2>\n<p>Now depending on how you choose to have your preprocessor code processed these features may or may not be more/less accessible. That being said I still feel they are worth mentioning.</p>\n<p>Auto updating the page you're working on is a small perk but I remember being quite happy to find out I could just save my project and not have to spam F5 like my little sister trying to buy front row Justin Bieber tickets online. Just save and it will update your project automatically.</p>\n<p>Another one is vendor prefixes. There are a handful of ways to stop writing these things out by hand each time. Whether it's via mixins, functions or a built in feature of the processor itself you can avoid writing out these dreadfully monotonous prefixes for good.</p>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>At first it might seem like a bunch of new stuff you have to learn and implement... but really if you already know CSS you're over halfway there. All you need to do is learn the specific syntax and familiarize yourself with the new features available to you with the preprocessor of your choice. It's a gentle learning curve with a surplus of benefits to integrate preprocessors into your workflow.</p>\n<p>This article is by no means all encompassing, but rather a sampler to create enough interest to try it out and learn more about preprocessors.</p>\n<p>On that note there are <a href=\"http://csspre.com/compile/\">resources</a> for comparing the preprocessors as well as trying them online. Each one has its own perks so try 'em out and find the one that fits your style!</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk6 { color: #D7BA7D; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n</style>","frontmatter":{"date":"November 17, 2015","updated_date":null,"description":null,"title":"The truth about CSS preprocessors and how they can help you","tags":["CSS"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/06a5f244323a7617c371dd411e68c861/6d161/desdev-150x150.png","srcSet":"/static/06a5f244323a7617c371dd411e68c861/6d161/desdev-150x150.png 150w","sizes":"(max-width: 150px) 100vw, 150px"}}},"author":{"id":"Zakary Hughes","github":null,"avatar":null}}}},{"node":{"excerpt":"In this blog, I will cover some of my favorite Sublime features. Use of these plugins will dramatically reduce the amount of tedious tasks…","fields":{"slug":"/engineering/beginners-guide-for-sublime-text-3-part-2/"},"html":"<p>In this blog, I will cover some of my favorite Sublime features. Use of these plugins will dramatically reduce the amount of tedious tasks you have to perform, and make your worktime really fun. I will start with some of the most basic features that come with fresh installation of Sublime. There are lots of good tutorials on Sublime shortcuts and plugins on the internet, but I feel there should be more about these fundamental features. I have seen many people who are familiar with the plugins but not with these cool built-in features. In this article we will be introducing \"Snippets\", \"Project\" and \"Macros\".</p>\n<p>Here we go:</p>\n<h3 id=\"snippets\" style=\"position:relative;\"><a href=\"#snippets\" aria-label=\"snippets permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Snippets</h3>\n<p><img src=\"/3e21aab686b29a54a248ccd545aca465/snippet-demo.gif\" alt=\"snippet-demo\"></p>\n<p>Back when i introduced Sublime editor to my friends,\"Snippets\" was among the first few features which really intrigued them. To give a quick peek what a snippet looks like:  </p>\n<p>This is definitely the feature you will use the most! To start using snippets, you can either create your own snippets according to your needs or download some ready-made snippets created by others to fulfill some generic coding needs. Like the one I demonstrated, it is pre-made from a plugin called <code>Html Page Snippets</code>, and command <code>docjq</code> will create a boiler template for a Html page that contains bootstrap and jQuery.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 113.23076923076923%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAXCAIAAACEf/j0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAC5klEQVQ4y8WTWU8TURiG+0sMBQqddrrM3oF2SktZ2lIWMeBaExXFQlFAIwkhaqKG6CUGA0QWwZa1BWY67Uw7nemGa0xMiFwYL/TC3+GRJmggpiQmmjwXJ1++57zfOSdHtcYlw1Ge5VMJURFEJSHI25zIxVJbrJAQQCWbTCoLkdzYdGY5KvHxNC9kRKnA8emUlFeNB4ceBIfujNx9/2F399Pnvb0v375+V+T8WX/PtcBQIHjrUk/w6eQMHxMWQxGWlyXl9au3HzO5d6NjD1WTTe5xh8vlcD9+MjE7MTUzOftsav7e/UdGpMaI2kyYrUqH998ciXDJjS1hfTPOi5l09k1CyvnaT6voxjbS6dWbLEYj2mSxuAnCSmEMgzsdNIYTlIXSQvDVwODKBre0HI2yopDOA3OTExvd7ar6hla7w2Mw0xRNNdbXeehal91uwigUJwmSsjFWvcHY2zc8v7Q2Mxfa5lMpZYeNS9OzL5u8nSpHg8/m8IAhNVqkGiZhpBazOBGyzkTYjZgNJZ06Iz0wPBrlxLnFtfA6K0h5MV2Ip7ItHWcOZBo2URaEpnArQtrNODit1YxbUcquhYne/tuh1e25xfWFUATskpR3Eum8t60byK1ARggGxZlatIYy0xBMQjBRRG+gyioMvf3DvKCE17ZWN1hRyiXlfExIN3tPFZO9EIyDsSsgpBJCqnXoAaB+Qg0F+ociUXbhRTgWE2Q5pyg5Wc66vSd/yaBVu88RWRfoG+S2Yyvh1ZSYysqZzD6H5aP8lMt1vddvsFvs85nZcGhZlmQpKWWVrKel8xiyGgoODPMcD5IL+cJOYQcAkps9HSVkrR6rrDYxjuau7gtd3X7/xZ4L/iuAc+cvo4SthFwE+GqNQV1pKKvQF1FXwlUQUnyqEjLIBw2HAPVjyX/ib2Xff0v+h2ODmwf8nuyp1mEarUmjNZekospYrjEU1yqHy8c4W1CSQQhbScAPt1gbnC4fRtoBPwBdFbML4QCTewAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"new-snippet\"\n        title=\"new-snippet\"\n        src=\"/static/1eaf59408b9d1b244c17eefe6b8d4c53/e5715/new-snippet.png\"\n        srcset=\"/static/1eaf59408b9d1b244c17eefe6b8d4c53/a6d36/new-snippet.png 650w,\n/static/1eaf59408b9d1b244c17eefe6b8d4c53/e5715/new-snippet.png 768w,\n/static/1eaf59408b9d1b244c17eefe6b8d4c53/b5a09/new-snippet.png 1360w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>To create your own snippet, go to \"Tools\" => \"New Snippet\", an interface to create your own snippet will pop up, it would look something like this:  </p>\n<ul>\n<li>Replace the default line with your snippet, the default one looks like this:</li>\n</ul>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">Hello, ${1:this} is a ${2:snippet}.</span></code></pre>\n<p>Note: The dollar sign \"$\" allows you to use tab key to jump between, so set it wisely!</p>\n<ul>\n<li>Uncomment this line to set up a tab trigger for the shortcut</li>\n</ul>\n<p>Now save it, but keep in mind putting it in the correct location is important!</p>\n<p>If you can not find it, go to \"Sublime\" - > \"Preferences\" -> \"Browse Packages\", and create a folder called \"User\" if there isn't one already, and save it there.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 67.23076923076923%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAIAAAAmMtkJAAAACXBIWXMAAAsTAAALEwEAmpwYAAACWUlEQVQoz5WQ708ScRjA759QRF8IvgAEFj8PJGLOUvSQTQFXluvX5qrpuwxfWLn0RfaimmtFA0GOODjwDu5AOBQw8u7krsu01j/UF1ys2Wrrs2fPnu37/Xyf5/tAz7HjF2lpNS5uU0326OuR9IPjj/nmiSh9Fz5/a4qnIATx9Kh5LAgnHCeBmmXF2gHH8hLUZBs7eJomiXKRFnheEoXZ2Vm/z4cgE2Ojo+NuN8jIxATi8SAIMunxeCc9Xq93HBy43dDK+/p6rP5sq/4kcvg0yq+Ga/P3F2/fuXt97lZg5tr8vQfTvkBXV7esuxU9MlmfvKe3t0+pVMrlcmgjtv8O/xgm+ZcYu4E2XicPqN1qZocm8iUMJz9xYhLPOIcvuUYuD18ZNZrNRhMIk0ajGRwchJgyk0rhuRzFMEylzBToIp7Nv9oMReNYFMUanLi1HR8ZG7HCNgsMw0ND9otOm8Oh1eq0Wi2EE4VQBN2Kp+hSjaAZLEtRxQqKZZNpIkPSRaYaCkcdDgcQbTab2WwG2W63g2y1WqFSpU5QpUKpulc/rDd4ptqgdivbiXQMTQE/S9KxRNLepiXAVqC23oFho9EABWauTvsDUz7/1LTf55+5MXczS+aJHOi5V6keHPLNzTdvwYRqtVrTBhTgtyCrVCpIr9NdaGMwGMAll8uVy+fjaAJNfEjhuCh9CUciwAFX1X8AWSytRZwBaqfT+XhlZXk5GAw+Wlp6uLa+trC40Gl7DshkMll+A6xEp9Pp9fqBgQGFQtHf369QKDV/4bzcGQT42l/8h3zGP5wOPwH2xiZDG4OaRAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"browse-package\"\n        title=\"browse-package\"\n        src=\"/static/11a66afdbf80d36eaa9f4b484c95470e/e5715/browse-package.png\"\n        srcset=\"/static/11a66afdbf80d36eaa9f4b484c95470e/a6d36/browse-package.png 650w,\n/static/11a66afdbf80d36eaa9f4b484c95470e/e5715/browse-package.png 768w,\n/static/11a66afdbf80d36eaa9f4b484c95470e/e5ca1/browse-package.png 1332w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<h3 id=\"project\" style=\"position:relative;\"><a href=\"#project\" aria-label=\"project permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Project</h3>\n<p>Using \"Project\" feature to organize your projects is super easy and handy. It saves a lot of time that you'd normally waste finding different folders and then dragging and dropping to your Sublime each time. Additionally, it saves your previous location so you can just pick up where you left off. Let's see a quick demo:</p>\n<p>Saving and using your projects is very straightforward.</p>\n<ul>\n<li>First drag some folders and files that you want to open into Sublime</li>\n<li>\n<p>Then go to the menu, click \"Project\" -> \"Save Project As\"  </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 87.53846153846155%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAIAAADUsmlHAAAACXBIWXMAAAsTAAALEwEAmpwYAAADCklEQVQ4y31T604TQRjdp4BEEloo7d63uzOz9xvdbgsKMQokGh9ANCbcQawkGhMfwAfwB4FwU2ClpS2UOwgmyjv5bQsJ/NCT2Wl3mjPnfOf7Sq0tL29G1b3GSb1xUqkdlKuNWuMY9kr9sL5/uBidfVk/36wcXFxdn19d1xqna9+jrajSODqr7R9RQa8XBIHnur7nwcIYe47TVyzAiSiK70ulaDtaXFot7+6dnl/9/PVnamYunUkLgsALPJVzTNd1JUkSm+hOpZDAODgrCGJ7e9voqzer36Kvi8tbUXm31gDBl6Ov29rakl1dnYkEFTrayGBBVhBC8cNxPBK5nOcSTed5fnJ6trp3uBmV642j3frB8dnl+OR0VzIJP7EsS2GMir7tOK5KCJDhNJPJFB8O9D8axKo2M/dua6e6tLKxtrH1o1I/Pr8cG59MJhMcxzEMQyGEiar6vm/bNiEkvpKm84U+WB0dDyamZrZ3akBeWd8sV/cvrn7Pzs0nEp03ZEhIVVXHcTRNUxQFSmVoOgiLhmmmUqmnQ8Ozb0tjE1PzpYXSwoePnz4PDY/AOXhuKisKkF3XM02rSRY4liOagYhGsyzk191EV4wkoKenh7kFlc1mDcMoFIr5IIASwDaShLytF12jV80SWYQIQYe7RUvzhgxquq67EC8hLWWQfjw48GSgr98l8J35NyhZUaBaGI8WWYxrZjzfL4ZBTlf+R23VbOg6pA2jAuGBMBgDcpjzciaS+Ht0sHz3nTI14lmGAg0jGPrcnDshK8uKyOkSh0Q+naEhuQzDwGcPTCYd41b5PnhBxLKU8+xcWPCDfM61864Z2AYMUug7vo4tRZBFoUWPA7vDjQOTBFGRRAJJGKaqaZAFGAFbhqapGArhwNxNn++TQVkAZmCRPgsHBir4lm+qoYFVhNIMS7MwBGBO5Hjunm1IC/Ys/LN4dtjHzwM1MPFQ6DwLjRehMZy34C6PSLIUt49v9jseEnAFm9RcwIbBsHA2XhoxCbJVxdMUT5UdFVlYVgROZGmeyaTT6b9jGyDPrkScaAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"save-proj\"\n        title=\"save-proj\"\n        src=\"/static/1d33a60947256a60d36a7a16d86e4645/e5715/save-proj.png\"\n        srcset=\"/static/1d33a60947256a60d36a7a16d86e4645/a6d36/save-proj.png 650w,\n/static/1d33a60947256a60d36a7a16d86e4645/e5715/save-proj.png 768w,\n/static/1d33a60947256a60d36a7a16d86e4645/019a6/save-proj.png 1818w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n</li>\n<li>Note the extension is \".sublime-project\" and you may want to put all your project files in one central location</li>\n</ul>\n<p>That's it! You're done! Super easy right?</p>\n<h3 id=\"macros\" style=\"position:relative;\"><a href=\"#macros\" aria-label=\"macros permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Macros</h3>\n<p><img src=\"/e8a218bdc92e2c8c118faeb6fec384e0/without-macro.gif\" alt=\"without-macro\"></p>\n<p>Do you always feel frustrated by repeating the same tedious task again &#x26; again? Hmm... at least that's how I feel when I need to covert a vertical line of data into an array. Tasks like these are pretty common when you need to copy a line of data from spreadsheets. Using shortcuts, the best way I can come up with to accomplish this would be like so:  </p>\n<p>It takes about 8 shortcuts to finish each process, that's including the first paste action and then adding a space character after each comma. Imagine having to do this for each line of a table, and for every single spreadsheet you have to work on. It would be hundreds of shortcuts you need to press and each time you are just repeating the exact same sequence of keys.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 600px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 73.5%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAIAAABr+ngCAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB60lEQVQoz42SO2/aUBTHmZu5eQw4ahEIItqqhrIWGNKhjSAhaYmdoSoPp2lIJSBT+hX6EapUCiY2MsQBbONr+/ptnh+qV3RB7YB/w9E9R/qd/xluQOv3eL5vmGPPW7ju3PXmhuk6zhQ9UOs4s7E35aTZT3r6OHI0aGu6ZzkzBbqWPQ2c5A+Oj48KhUI+l8svOTo8zOVymUwmnU5ns9lUKvXj5kbXtPY9OxSACi1vshhPFpe1q8CLl69e43g8Ht9bIRqNbm1vP93c3NrZebKxQZBngqRwvX63NxiKYASgqtvvPxwEEjieSCSSyeSbFVAbi8XQCrQIw7BSqfLwKLTabPehj0xxpA4lcPKxGMCX8j+g4apcrlD8QKIZTpBUWTVR7XC8X7lUriL5122rzXASSgYQaNanIrFe3t3FPn8pobPvaOaOZvmBKCu6bo2Lp4Sf5GC1SgHVYDpdrscDVVc0Q4Wmr2R0NkVRsiwzDCuKoq7rEEL0K0iSXC8HMeycqgJR6HYYCGQbolxlYlskcepLpiplIAxav28797ShyFCW5q59Rvg4OxgMfvt6rskjjmU805g4lmeZM9cl18qohkKhd/v732u1y4uL60ajWa836vXrZjOdfrtG/ks4HH6+5NkKkUjEl4zee/+Bhn8A5NVCgeRFjYMAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"start-macro\"\n        title=\"start-macro\"\n        src=\"/static/2387091fee10d76618c295145185f7f3/0a47e/start-macro.png\"\n        srcset=\"/static/2387091fee10d76618c295145185f7f3/0a47e/start-macro.png 600w\"\n        sizes=\"(max-width: 600px) 100vw, 600px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>Well you might think there must be a better way! You bet there is! \"Macros\" are designed to handle this kind of nasty situation and save you from all that boring work. Here I made a very quick and easy example, it converts a vertical line of data into an array:  </p>\n<p>Magic! Lots of time and lives will be saved by this little gadget. So now, how to make your very own macros. First of all I would recommend trying out your set of operations several times to make sure it will get recorded correctly. When you are ready, open a new window/tab in Sublime, clear your mind, take several deep breaths, and here we go.</p>\n<ul>\n<li>\n<p>Go to \"Tools\" -> \"Record Mac  </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 600px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 73.5%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAIAAABr+ngCAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB60lEQVQoz42SO2/aUBTHmZu5eQw4ahEIItqqhrIWGNKhjSAhaYmdoSoPp2lIJSBT+hX6EapUCiY2MsQBbONr+/ptnh+qV3RB7YB/w9E9R/qd/xluQOv3eL5vmGPPW7ju3PXmhuk6zhQ9UOs4s7E35aTZT3r6OHI0aGu6ZzkzBbqWPQ2c5A+Oj48KhUI+l8svOTo8zOVymUwmnU5ns9lUKvXj5kbXtPY9OxSACi1vshhPFpe1q8CLl69e43g8Ht9bIRqNbm1vP93c3NrZebKxQZBngqRwvX63NxiKYASgqtvvPxwEEjieSCSSyeSbFVAbi8XQCrQIw7BSqfLwKLTabPehj0xxpA4lcPKxGMCX8j+g4apcrlD8QKIZTpBUWTVR7XC8X7lUriL5122rzXASSgYQaNanIrFe3t3FPn8pobPvaOaOZvmBKCu6bo2Lp4Sf5GC1SgHVYDpdrscDVVc0Q4Wmr2R0NkVRsiwzDCuKoq7rEEL0K0iSXC8HMeycqgJR6HYYCGQbolxlYlskcepLpiplIAxav28797ShyFCW5q59Rvg4OxgMfvt6rskjjmU805g4lmeZM9cl18qohkKhd/v732u1y4uL60ajWa836vXrZjOdfrtG/ks4HH6+5NkKkUjEl4zee/+Bhn8A5NVCgeRFjYMAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"start-macro1\"\n        title=\"start-macro1\"\n        src=\"/static/2387091fee10d76618c295145185f7f3/0a47e/start-macro1.png\"\n        srcset=\"/static/2387091fee10d76618c295145185f7f3/0a47e/start-macro1.png 600w\"\n        sizes=\"(max-width: 600px) 100vw, 600px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n</li>\n<li>Do your operations</li>\n</ul>\n<p>Usually you would have something copied in your clipboard, so it could start with a \"Paste\" command. Now it's your time to shine, do a clean and precise set of operations to format the data.</p>\n<ul>\n<li>\n<p>Stop your macro  </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 600px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 78.66666666666667%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAQCAIAAACZeshMAAAACXBIWXMAAAsTAAALEwEAmpwYAAACPElEQVQoz3WS22/SYBiH+QPmpdzaSgasJhu0w6gX88qVecsNLPGKk/FGF6Nu46SJ2fRmGU5jXIyZEYaU0gOltbT9Wk5zbAkG0MzDX+M3BAICT95++drmyft7+9VklHW1ftRs/uh8//OtddZq/zo5bbXaP+Et3Lc7vzuds/dc6/HbhgyOjcqxXm6Uq6ea8RW+NYVDd/z3guHQ3UAgGAyGgoFQOBT2+/1er9fn9a36Vj0ez/67fYEXMp/polgyyvXGSROuD+6vmebnFxwLjjkMm+uBwf2sdfZiF7PZPHNhZu3ho4KoMJwIS5KBCirSF+3a9RsmArIIcS26ugUv11UnjtvtdpvNBlcEQdY3oiwnZnMsV5BkRZdkjRfkW8ukCYcQxHnh/SIIh9Np7wKToCi6uRlLpalMNl+UFEU1BLH06ZAiSXdXxodkYpIcjVM09+EgnWcFBWYuAYYrDsn41M6XUfTJeoSi+XSGhsUXSwqoqqA62nkQHsqOgYzBzpFoXJTUXJ6naDZLMYIow7GXezMPAo/FxrBzOZ5IMAyXSh0WCkUAdF03gKa73f/FJsbk7syJWFRgWZbOlYFW1UEFaIamut3klNijciyyIfJs+uMBl89VNMVQ5JoO3CQ51nl0ZhgbnvPzZ09BSeaZ/FHFaNSrjVqlpuu3V1b65zz9a1sslqDf/3J7+8XW1pu9V6+Tyb3k7u7Ozs2lpaGfZFLsf0Af9kcR5BIE6WG1WsfOmZggY32uDMAw+Hys8yR5Gn8B3ZNS+eilX44AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"stop-macro\"\n        title=\"stop-macro\"\n        src=\"/static/d4f4fae1e0e00915e1b1ae2c8845c33d/0a47e/stop-macro.png\"\n        srcset=\"/static/d4f4fae1e0e00915e1b1ae2c8845c33d/0a47e/stop-macro.png 600w\"\n        sizes=\"(max-width: 600px) 100vw, 600px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n</li>\n<li>Playback</li>\n</ul>\n<p>You can find it under the same \"Tools\" menu. Just use it to make sure it did what you want, sometimes even though you recorded it properly, the macro doesn't recognize the operations correctly. For this reason it's important to make sure everything is correct and smooth, and if it's not, try find some alternatives for your operations.</p>\n<ul>\n<li>Save It!</li>\n</ul>\n<p>Similar to other Sublime tools, it will be saved with an extension called \".sublime-macro\", after it gets saved you will be able to find it in your Macro User List.</p>\n<h3 id=\"to-be-continued-\" style=\"position:relative;\"><a href=\"#to-be-continued-\" aria-label=\"to be continued  permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>To Be Continued ..</h3>\n<p>I hope you had fun and learned something new about Sublime. Next time we will cover some really good packages/plugins that you should consider using to make your life and work even simpler.\nHappy coding!!!</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n</style>","frontmatter":{"date":"November 10, 2015","updated_date":null,"description":"Getting started with one of the lightweight Code Editor Sublime Text and introduction to Snippets, Project and Macros","title":"Beginner's Guide for Sublime Text 3 Plugins","tags":["SublimeText","CodeEditor"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/fe6e52be480d783d993428df72436141/7d145/Beginner-Guide-Sublime-Text.png","srcSet":"/static/fe6e52be480d783d993428df72436141/69585/Beginner-Guide-Sublime-Text.png 200w,\n/static/fe6e52be480d783d993428df72436141/497c6/Beginner-Guide-Sublime-Text.png 400w,\n/static/fe6e52be480d783d993428df72436141/7d145/Beginner-Guide-Sublime-Text.png 610w","sizes":"(max-width: 610px) 100vw, 610px"}}},"author":{"id":"Team LoginRadius","github":"LoginRadius","avatar":null}}}},{"node":{"excerpt":"In order to display your LoginRadius Login Interface in a pop-up you can leverage Jquery-ui which is a well documented, easy-to-use library…","fields":{"slug":"/engineering/displaying-the-loginradius-interface-in-a-pop-up/"},"html":"<p>In order to display your LoginRadius Login Interface in a pop-up you can leverage Jquery-ui which is a well documented, easy-to-use library that allows you to handle some common functionality such as pop-up dialogs and other UI features. In this article we go over the steps to use Jquery-ui to display a pop-up on your page with a LoginRadius login interface using the LoginRadius HTML SDK.</p>\n<p>1. Get the required references this guide relies on: Jquery and Jquery-ui. You can include the hosted reference files in the header of your page:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&lt;!--</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">--&gt;</span></span></code></pre>\n<p>2. Include the LoginRadius Interface Javascript and HTML5 SDK reference:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&lt;!--</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">options</span><span class=\"mtk1\">={};</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">options</span><span class=\"mtk1\">.</span><span class=\"mtk12\">login</span><span class=\"mtk1\">=</span><span class=\"mtk4\">true</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">LoginRadius_SocialLogin</span><span class=\"mtk1\">.</span><span class=\"mtk12\">util</span><span class=\"mtk1\">.</span><span class=\"mtk11\">ready</span><span class=\"mtk1\">(</span><span class=\"mtk4\">function</span><span class=\"mtk1\"> () {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$ui</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">LoginRadius_SocialLogin</span><span class=\"mtk1\">.</span><span class=\"mtk12\">lr_login_settings</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$ui</span><span class=\"mtk1\">.</span><span class=\"mtk12\">interfacesize</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$ui</span><span class=\"mtk1\">.</span><span class=\"mtk12\">apikey</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$ui</span><span class=\"mtk1\">.</span><span class=\"mtk12\">callback</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">$ui</span><span class=\"mtk1\">.</span><span class=\"mtk12\">lrinterfacecontainer</span><span class=\"mtk1\"> =</span><span class=\"mtk8\">&quot;interfacecontainerdiv&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">LoginRadius_SocialLogin</span><span class=\"mtk1\">.</span><span class=\"mtk11\">init</span><span class=\"mtk1\">(</span><span class=\"mtk12\">options</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">});</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">--&gt;</span></span></code></pre>\n<p>3. Create the HTML structure for your page. Below we have created a button to trigger our pop-up display as well as the dialog container that will be displayed in the custom pop-up which is hidden by default. We have also included a div to display profile data after successfully authenticating.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&lt;!--</span><span class=\"mtk12\">Login</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> --&gt;</span></span></code></pre>\n<p>4. Create a JavaScript function to handle the display of the pop-up dialog. The below function utilizes Jquery-ui functions to display the dialog and the LoginRadius login interface initialization function to render the login interface on the popup:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">Login</span><span class=\"mtk1\">(){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk11\">$</span><span class=\"mtk1\">( </span><span class=\"mtk8\">&quot;#dialog&quot;</span><span class=\"mtk1\"> ).</span><span class=\"mtk11\">dialog</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">LoginRadius_SocialLogin</span><span class=\"mtk1\">.</span><span class=\"mtk11\">init</span><span class=\"mtk1\">(</span><span class=\"mtk12\">options</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>5. Include the JavaScript callback script to handle a successful authentication and display the profile data.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">LoginRadiusSDK</span><span class=\"mtk1\">.</span><span class=\"mtk11\">setLoginCallback</span><span class=\"mtk1\">(</span><span class=\"mtk12\">Successfullylogin</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">Successfullylogin</span><span class=\"mtk1\">(){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">LoginRadiusSDK</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getUserprofile</span><span class=\"mtk1\">( </span><span class=\"mtk4\">function</span><span class=\"mtk1\">( </span><span class=\"mtk12\">data</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk11\">$</span><span class=\"mtk1\">( </span><span class=\"mtk8\">&quot;#dialog&quot;</span><span class=\"mtk1\"> ).</span><span class=\"mtk11\">dialog</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;close&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementById</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;profile&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk12\">innerHTML</span><span class=\"mtk1\"> = </span><span class=\"mtk10\">JSON</span><span class=\"mtk1\">.</span><span class=\"mtk11\">stringify</span><span class=\"mtk1\">(</span><span class=\"mtk12\">data</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    });</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Full Example:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">&lt;!--</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">options</span><span class=\"mtk1\">={};</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">options</span><span class=\"mtk1\">.</span><span class=\"mtk12\">login</span><span class=\"mtk1\">=</span><span class=\"mtk4\">true</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">LoginRadius_SocialLogin</span><span class=\"mtk1\">.</span><span class=\"mtk12\">util</span><span class=\"mtk1\">.</span><span class=\"mtk11\">ready</span><span class=\"mtk1\">(</span><span class=\"mtk4\">function</span><span class=\"mtk1\"> () {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">$ui</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">LoginRadius_SocialLogin</span><span class=\"mtk1\">.</span><span class=\"mtk12\">lr_login_settings</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">$ui</span><span class=\"mtk1\">.</span><span class=\"mtk12\">interfacesize</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">$ui</span><span class=\"mtk1\">.</span><span class=\"mtk12\">apikey</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">$ui</span><span class=\"mtk1\">.</span><span class=\"mtk12\">callback</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">$ui</span><span class=\"mtk1\">.</span><span class=\"mtk12\">lrinterfacecontainer</span><span class=\"mtk1\"> =</span><span class=\"mtk8\">&quot;interfacecontainerdiv&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">LoginRadius_SocialLogin</span><span class=\"mtk1\">.</span><span class=\"mtk11\">init</span><span class=\"mtk1\">(</span><span class=\"mtk12\">options</span><span class=\"mtk1\">); }); </span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">Login</span><span class=\"mtk1\">(){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk11\">$</span><span class=\"mtk1\">( </span><span class=\"mtk8\">&quot;#dialog&quot;</span><span class=\"mtk1\"> ).</span><span class=\"mtk11\">dialog</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">LoginRadius_SocialLogin</span><span class=\"mtk1\">.</span><span class=\"mtk11\">init</span><span class=\"mtk1\">(</span><span class=\"mtk12\">options</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">LoginRadiusSDK</span><span class=\"mtk1\">.</span><span class=\"mtk11\">setLoginCallback</span><span class=\"mtk1\">(</span><span class=\"mtk12\">Successfullylogin</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">Successfullylogin</span><span class=\"mtk1\">(){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">LoginRadiusSDK</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getUserprofile</span><span class=\"mtk1\">( </span><span class=\"mtk4\">function</span><span class=\"mtk1\">( </span><span class=\"mtk12\">data</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk11\">$</span><span class=\"mtk1\">( </span><span class=\"mtk8\">&quot;#dialog&quot;</span><span class=\"mtk1\"> ).</span><span class=\"mtk11\">dialog</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;close&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementById</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;profile&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk12\">innerHTML</span><span class=\"mtk1\"> = </span><span class=\"mtk10\">JSON</span><span class=\"mtk1\">.</span><span class=\"mtk11\">stringify</span><span class=\"mtk1\">(</span><span class=\"mtk12\">data</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    });</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">Login</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">--&gt;</span></span></code></pre>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n</style>","frontmatter":{"date":"November 09, 2015","updated_date":null,"description":null,"title":"Displaying the LoginRadius interface in a pop-up","tags":["HTML","Login","UI","LoginRadius Interface"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/af7b348bc73adfcd737b8df292359566/6d161/simplepop-150x150.png","srcSet":"/static/af7b348bc73adfcd737b8df292359566/6d161/simplepop-150x150.png 150w","sizes":"(max-width: 150px) 100vw, 150px"}}},"author":{"id":"Karl Wittig","github":null,"avatar":null}}}},{"node":{"excerpt":"Almost every active website worldwide uses jQuery, you can check stats here , but using it without optimization might make the DOM very slow…","fields":{"slug":"/engineering/optimize-jquery-sizzle-element-selector/"},"html":"<p>Almost every active website worldwide uses jQuery, you can check stats <a href=\"http://trends.builtwith.com/javascript/jQuery\">here</a> , but using it without optimization might make the DOM very slow. The same goes for other javascript libraries, such as SizzleJS. To ensure the performance of your DOM, you have to follow some best practices for it.</p>\n<p>In this article I am going to list down some of the most critical factors that you need to watch out. Even though this not a complete list; taking care of these will help you optimize those jQuery Selector.</p>\n<h3 id=\"lets-start\" style=\"position:relative;\"><a href=\"#lets-start\" aria-label=\"lets start permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><strong>Let's start!</strong></h3>\n<h4 id=\"always-cache-your-selector\" style=\"position:relative;\"><a href=\"#always-cache-your-selector\" aria-label=\"always cache your selector permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Always cache your selector</h4>\n<p>Whenever you apply any selector in jQuery or <a href=\"http://sizzlejs.com/\">SizzleJS</a>,  the selector engine goes through the whole DOM to find the specified element.</p>\n<p>For example, if you use the code below, it will go through the whole DOM twice in order to find \".myClass\" selector.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.myClass&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">show</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.myClass&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">addClass</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;anotherClass&quot;</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>But instead of that, if you make all the methods in a chained format like this. It will only try to find that class once.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.myClass&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">show</span><span class=\"mtk1\">().</span><span class=\"mtk11\">addClass</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;anotherClass&quot;</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>Or if you want to use this element in other places; you can do so by doing it in this way.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">myElem</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.myClass&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">myElem</span><span class=\"mtk1\">.</span><span class=\"mtk11\">show</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">myElem</span><span class=\"mtk1\">.</span><span class=\"mtk11\">addClass</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;anotherCLass&quot;</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>In both of these cases, the selector will be executed only once. Some selectors are very slow to traverse and passing them again and again will make your DOM very slow.</p>\n<p>Read on the next point to understand,  how the type of selector affects performance.</p>\n<h4 id=\"prioritizing-selectors-based-on-their-performance\" style=\"position:relative;\"><a href=\"#prioritizing-selectors-based-on-their-performance\" aria-label=\"prioritizing selectors based on their performance permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Prioritizing selectors based on their performance</h4>\n<p>Selector's type affects the performance of your site. SizzleJS is a smart selector engine that also uses native js APIs for finding specific element. This is the main reason why ID selector and tag selector perform faster than others. But, if you prefer using jQuery, it’s pretty much the same. Modern browsers also have an API to find an element by class name but, let’s just focus on jQuery and SizzleJS.</p>\n<ul>\n<li>The order of selector's performance (fast -> slow) is</li>\n<li>ID selector ($(\"#ID\")) = Fastest</li>\n<li>Tag ($(\"Tag\")) = Fast</li>\n<li>Class ($(\".Class\")) = Average</li>\n<li>Attribute ($(\"[Attribute='Value']\")) = Slow</li>\n<li>Pseudo ($(\":pseudo\")) = Slower</li>\n</ul>\n<p>You can verify performance. In some exceptional cases, the selection of those tags does not matter; It’s all in the combination of the selectors. Because, it affects the performance of your site, let's discuss this on next point.</p>\n<h4 id=\"selecting-id-selector-first-and-then-other-ones\" style=\"position:relative;\"><a href=\"#selecting-id-selector-first-and-then-other-ones\" aria-label=\"selecting id selector first and then other ones permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Selecting ID selector first and then other ones</h4>\n<p>If you have the combination of selectors, then the sequence of selectors matter for optimization. For example:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;#someId div .someClass&quot;</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>The same code can be written as:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;#someId&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">find</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;div .someClass&quot;</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>Both of these variant represent the same thing but in the term of performance, second one is better. The reason for that is because in the first code, Sizzle will go through the DOM 3 times to find #someId, div, and .someClass.</p>\n<p>In the second one, the selector engine will go through the DOM again but, this time, it’ll only look for #someId and then find the rest inside that element without going through the DOM again.</p>\n<p>See how this will affect performance.</p>\n<h4 id=\"being-more-specific-in-right-hand-side-instead-of-left-hand-side\" style=\"position:relative;\"><a href=\"#being-more-specific-in-right-hand-side-instead-of-left-hand-side\" aria-label=\"being more specific in right hand side instead of left hand side permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Being more specific in right hand side instead of left hand side</h4>\n<p>Sizzle executes selector from right to left so it will definitely  improve performance if applied in right except left.</p>\n<p><strong>Unoptimized code:</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">( </span><span class=\"mtk8\">&quot;div.myclass .myChildClass&quot;</span><span class=\"mtk1\"> );</span></span></code></pre>\n<p><strong>Optimized code:</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">( </span><span class=\"mtk8\">&quot;.myclass td.myChildClass&quot;</span><span class=\"mtk1\"> );</span></span></code></pre>\n<p>If you don’t see the difference, find the div and td.</p>\n<h4 id=\"selection-inside-a-parent-always-improves-performance\" style=\"position:relative;\"><a href=\"#selection-inside-a-parent-always-improves-performance\" aria-label=\"selection inside a parent always improves performance permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Selection inside a parent always improves performance</h4>\n<p>When you have a context, or any level of parent, then you can select an element inside that parent. It will perform better this way than selecting it directly. Because, in this case, the selector engine goes through the DOM once to find the parent.</p>\n<p>For example, assuming you are trying to find “.child” class:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.child&quot;</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>Is slower than</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">parent</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;#parent&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">parent</span><span class=\"mtk1\">.</span><span class=\"mtk11\">find</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.child&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">show</span><span class=\"mtk1\">();</span></span></code></pre>\n<p>You can also specify context by following syntax</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"9\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.child&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">parent</span><span class=\"mtk1\">).</span><span class=\"mtk11\">show</span><span class=\"mtk1\">();</span></span></code></pre>\n<h4 id=\"excessive-selector-slows-down-your-query\" style=\"position:relative;\"><a href=\"#excessive-selector-slows-down-your-query\" aria-label=\"excessive selector slows down your query permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Excessive selector slows down your query</h4>\n<p>The selector engine always checks every selector you have specified and it might traverse slowly. That being said, always make sure to specify minimum selectors in order to maintain the performance.</p>\n<p>For example, you are  trying to find “.myClass” using both of these code variants,</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"10\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;#div div span.myClass&quot;</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>Is slower than</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"11\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;#div&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">find</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.myClass&quot;</span><span class=\"mtk1\">);</span></span></code></pre>\n<h4 id=\"\" style=\"position:relative;\"><a href=\"#\" aria-label=\" permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h4>\n<p><strong>The .children() tag is quicker than .find()</strong></p>\n<p>In case, you are trying to find a children element, it is recommended to use .children() instead of .find(). Using .find() will tell jQuery to look on every level of children, while .children() will find only the first level children. Therefore .children() is faster than .find().</p>\n<p>For example, you are trying to find “.child” inside $parent and it is the first level children of the $parent.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"12\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">parent</span><span class=\"mtk1\">.</span><span class=\"mtk11\">find</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.child&quot;</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>Is slower than</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"13\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk12\">parent</span><span class=\"mtk1\">.</span><span class=\"mtk11\">children</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.child&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">show</span><span class=\"mtk1\">();</span></span></code></pre>\n<h4 id=\"-1\" style=\"position:relative;\"><a href=\"#-1\" aria-label=\" 1 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a></h4>\n<p>Use minimum DOM append</p>\n<p>DOM manipulation is very heavy so always try to ignore or minimize using it.</p>\n<p>For example, by using the code below, it will make the process sluggish because you didn’t apply any selector caching. Resulting in going through  the DOM ten times and appending an element.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"14\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">for</span><span class=\"mtk1\">( </span><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">i</span><span class=\"mtk1\"> = </span><span class=\"mtk7\">0</span><span class=\"mtk1\">; </span><span class=\"mtk12\">i</span><span class=\"mtk1\"> &lt; </span><span class=\"mtk7\">10</span><span class=\"mtk1\">; </span><span class=\"mtk12\">i</span><span class=\"mtk1\">++) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.myClass&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">append</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>But instead of using the above code, using the code below will solve the whole issue of appending and traversal. Not only that, it will merge the 10 times manipulation of DOM into a single call.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"15\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">myClassInnerHtml</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">for</span><span class=\"mtk1\">( </span><span class=\"mtk4\">var</span><span class=\"mtk1\"> </span><span class=\"mtk12\">i</span><span class=\"mtk1\"> = </span><span class=\"mtk7\">0</span><span class=\"mtk1\">; </span><span class=\"mtk12\">i</span><span class=\"mtk1\"> &lt; </span><span class=\"mtk7\">10</span><span class=\"mtk1\">; </span><span class=\"mtk12\">i</span><span class=\"mtk1\">++ ){</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk12\">myClassInnerHtml</span><span class=\"mtk1\"> += </span><span class=\"mtk8\">&quot;&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">$</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;.myClass&quot;</span><span class=\"mtk1\">).</span><span class=\"mtk11\">append</span><span class=\"mtk1\">(</span><span class=\"mtk12\">myClassInnerHtml</span><span class=\"mtk1\">);</span></span></code></pre>\n<p>All the tips I have mentioned above is highly dependant on your requirement but one thing is for sure; Optimization will definitely improve your process.  ‘SizzleJS’ is most the powerful and quick element selector. But, without writing optimized code you can’t prevent the DOM from freezing. With that being said,  jQuery is awesome but without optimized code it can get more DOM freezes and frustrate your users.</p>\n<p>I hope this help you optimize your element selecting. Thank you and have a great coding.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n</style>","frontmatter":{"date":"November 05, 2015","updated_date":null,"description":null,"title":"Optimize jQuery & Sizzle Element Selector","tags":["Engineering","JQuery"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1,"src":"/static/792265a42f42bb24e4108f2d9f5488be/6d161/jquery-sizzle-element-selector-150x150.png","srcSet":"/static/792265a42f42bb24e4108f2d9f5488be/6d161/jquery-sizzle-element-selector-150x150.png 150w","sizes":"(max-width: 150px) 100vw, 150px"}}},"author":{"id":"Kundan Singh","github":null,"avatar":null}}}},{"node":{"excerpt":"Hi guys! When you write test cases, do you face the problem of sharing your test cases with your team members or having to use multiple…","fields":{"slug":"/engineering/how-to-maintain-test-cases-in-excel-sheets/"},"html":"<p>Hi guys! When you write test cases, do you face the problem of sharing your test cases with your team members or having to use multiple colors for test cases?<br>\nI have a solution for these problems that is to maintain your test cases in an excel sheet.</p>\n<p><strong>Definition</strong><br>\nTest cases are the part of testing by which a product can be tested properly according to a set of requirements.</p>\n<p><strong>Advantages of using test cases in excel sheets</strong></p>\n<ol>\n<li>Easily handle the test cases in the sheet.</li>\n<li>Easily attach links.</li>\n<li>Easily share sheets with team members.</li>\n<li>Easily use multiple colors in a sheet.</li>\n</ol>\n<p><strong>Standard format of Test Cases</strong><br>\nSome common fields that are used in test case writing are:  </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 40.30769230769231%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAA1klEQVQY04WP2w7CIAyGef8H0sjmG2jmYZkX3pg4D8vcBkynOCgW8JSp8U9TPtqmP5AiXe5ntEiG1SJMo8EhDqok3ER0N6VsEW4mNJvRMgnX0SCPA4zthObzIB33VqM+EZwpeW5lo2RzvTQOTggYtiJ9pZHu2l5sC3PrhgkXwhijNWgwgACWETxbAPNqATgAP0YYY1hRSumH3rkj33pmwjl3znap1zt35FtuD/rpu/Pn+r/OeJKyKH89+5czqlVwlopkWXbI86rsCr9z/CZR10IIXh8LJm4ku8wX4gdfvQAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"1\"\n        title=\"1\"\n        src=\"/static/68dd86b15e802f578b434b0c0fb96f69/e5715/1.png\"\n        srcset=\"/static/68dd86b15e802f578b434b0c0fb96f69/a6d36/1.png 650w,\n/static/68dd86b15e802f578b434b0c0fb96f69/e5715/1.png 768w,\n/static/68dd86b15e802f578b434b0c0fb96f69/d0c2f/1.png 1362w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<ol>\n<li>\n<ol>\n<li>\n<p><strong>Test Case Id:</strong> This field is defined by what type of system we are testing. Below are the standard rules:</p>\n<ul>\n<li>If we are making a test case for any application which doesn’t belong to any specific module then ID would start as TEST_ID 1.</li>\n<li>If we are making test cases for any specific module then ID would be used as MOD_ID 1.</li>\n<li>If test case has more than one expected result then we can use test cases as TEST_ID 1.1,TEST_ID 1.2 etc. All these test cases are a sub-part of TEST_ID 1.</li>\n</ul>\n</li>\n</ol>\n</li>\n</ol>\n<p>In this way we can maintain all the test case IDs and if in the future we can get any requirement or change logs then easily add or change the test case using the following  standard rules without changing the test case IDs of previously written test cases.</p>\n<p><strong>Note:</strong> Test Case Id always uses capital letters.</p>\n<ol>\n<li><strong>Feature Of Product:</strong> This field defines the feature of a product for the type of product we are using.The main advantage of maintaining this field is, in the future if any requirements change then we can easily calculate how many test cases are affected by this and we will change or remove the test cases.**</li>\n<li><strong>Feature Description:</strong> This field explains what type of feature we will test on which condition.**</li>\n<li><strong>Steps To Execute:</strong> These are the steps to be executed on the system being tested to get the expected results. Steps should be understandable and correct. They are written and executed according to a sequence.**</li>\n<li><strong>Expected Result:</strong> These are the wanted outputs from the execution steps performed. Results should be clearly defined for every step. It specifies what are the specifications and what we will get from a particular specification.</li>\n<li><strong>Actual Result:</strong> This field has the real result after the performed execution steps on the system under testing. If the result matches with the expected result then we can write as expected.</li>\n<li><strong>Pass/Fail:</strong> If the result is showing according to the expected result, mark as pass and if not get the output according to the expected, result mark as fail. You are using color for status. Use the green color for Pass and red color for Fail.</li>\n<li><strong>Comment:</strong> This column is for additional information for e.g. if status is set to “cannot be tested”,  then tester can give the reason in this column.**</li>\n</ol>\n<p>Here I have explained a very general format, this will cover almost all the scenarios but we can not assure that all the requirements have been covered, you can proceed the following way to cover all requirements.</p>\n<p><strong>Knowing that all the Requirements have been covered</strong><br>\nTo know that all the requirements have been covered, you need to maintain a Traceability Matrix documentation. Let's take a look on how to create this document.</p>\n<p>Traceability Matrix is a document which provides linking between the requirements and the product which we have developed.<br>\nTraceability Matrix can be divided into 2 parts:-</p>\n<ul>\n<li>Summary</li>\n<li>Traceability Matrix</li>\n<li>\n<p><strong>Summary</strong> :-\nThis section contains a summary of requirements like</p>\n<p>1.1 <strong>Item</strong>: This field contains short descriptions of the items which will be tested.<br>\n1.2 <strong>Product Name</strong>: It contains the product name which you want to test.<br>\n1.3 <strong>Product Version</strong>: It contains the product version which you want to test.<br>\n1.4 <strong>Prerequisites</strong>: Prerequisites are the requirement of a system which are<br>\nneeded before we start testing. Prerequisites could be:</p>\n</li>\n<li>A certain page that a user needs to be on</li>\n<li>A certain data that should be in the system</li>\n<li>\n<p>A certain action to be performed before execution steps are performed.  </p>\n<p>Prerequisites should be satisfied before the test case execution starts.</p>\n<p>1.5 <strong>Change Prerequisites</strong>: Changes that were not necessary before but now are necessary for the system.<br>\n1.6 <strong>Exit Criteria</strong>: This field contains the requirements that must be fulfilled<br>\nin order to announce the completion of testing.<br>\n1.7 <strong>Test Summary</strong>: This field contains the status of the product: how many test<br>\ncases are passed, how many are failed, how many are on hold or how many   are  Invalid etc.  </p>\n</li>\n</ul>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 42%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAAsTAAALEwEAmpwYAAABBklEQVQY042Ou07DMBhG/Q4sPAGvigQzYmBBYspUwUDExEZZaFIGaBGKQpMSbMeXpHVc1TdcR6KV6NCjo0+f5ctvUMyLLM985rO8+qk455RSFvClbVvRdeIP33uFWAoBpm/Th0E8fk5fh8nXZ951nb+wOAzwXkxu0ug2i+9mcVKOGaYIQYxQ715gwBeQPkXR6fH9xcng/Gj0eMZavdnABGMCUU0Zl1KG/27plz5B+fECh1dtci1Hl8syEcoJqcTKeBdSr9bGOWet28WGtTEG8Kbx1YQDxlqttdlB70Mp5XOtFGg4C2/poHGHECZbP7moqjmEhFKE62+EtkIECak5/y/mbJOU/QLx+r0kxIjFkwAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"2\"\n        title=\"2\"\n        src=\"/static/62f1f5a9b79dcaf961c4f6cccdbc249d/e5715/2.png\"\n        srcset=\"/static/62f1f5a9b79dcaf961c4f6cccdbc249d/a6d36/2.png 650w,\n/static/62f1f5a9b79dcaf961c4f6cccdbc249d/e5715/2.png 768w,\n/static/62f1f5a9b79dcaf961c4f6cccdbc249d/d8104/2.png 1365w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<ol start=\"2\">\n<li>\n<p><strong>Traceability Matrix</strong> :  </p>\n<p>Traceability Matrix covers all the product requirements.We can say that it is a document which maps and traces requirements with test cases. Prime fields of this traceability matrix are</p>\n<p>2.1 <strong>Requirement Id</strong>: This field identifies all the testable requirements.<br>\n2.2 <strong>Requirement Description</strong>:  This field contains the short<br>\ndescription of requirements.<br>\n2.3 <strong>Test Case Id</strong>: According to requirements description which test case id is<br>\ncovered.<br>\n2.4 <strong>Status</strong>: Mention here the status of test cases such as passed, failed, on hold or<br>\ninvalid.</p>\n</li>\n</ol>\n<p>As per the image below:  </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 40.30769230769231%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAxUlEQVQY032P3Q6CMAyFef+HE5MhREi44EYT2GBM5n47x0YmRvFL05wsPT1d1nUdQuha11VVFajwvWmaPD+f8vxSlm3bPr8QYq1l4RkeBjYzSidCMOdcSimEGPpeKanU2gDABpKI2hiTYYy11t7C+eJ9zjmlze0+cGm1gWgwgSSi9q5sHEmcANhGtTFPaX1JveUcmiml8Yb9bQ7AwZvDs6dp2pvjevvJYfIf88/k9Lgm94HRf51gsrEJxtgjwAJJz/Pshe8vRI7PZbvl1Q4AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"3\"\n        title=\"3\"\n        src=\"/static/f312d4a5a4b6fe22df69c13a72eb8ee9/e5715/3.png\"\n        srcset=\"/static/f312d4a5a4b6fe22df69c13a72eb8ee9/a6d36/3.png 650w,\n/static/f312d4a5a4b6fe22df69c13a72eb8ee9/e5715/3.png 768w,\n/static/f312d4a5a4b6fe22df69c13a72eb8ee9/d2f5c/3.png 1363w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span><br>\nRequirement ID REQ_ID 1 covered in Test Case Id TEST_ID 1 and TEST_ID 2<br>\nRequirement ID REQ_ID 2 covered in Test Case Id TEST_ID 3 ,TEST_ID 4, TEST_ID 5</p>\n<p><strong>Advantages of using Traceability Matrix</strong></p>\n<ol>\n<li>Easily identify missing functionality.</li>\n<li>Easily cover all customer requirements.</li>\n<li>Make sure that all requirements are covered by developers in test cases</li>\n<li>If any change request is made we can easily change in test cases.</li>\n</ol>\n<p>So we can say that test cases are easily handled in excel sheets. We can use multiple colors in excel sheets for test cases, easily attach links with test cases and easily trace test cases.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"date":"November 03, 2015","updated_date":null,"description":"Learn how to maintain test cases in Excel sheets","title":"Maintain Test Cases in Excel Sheets","tags":["Excel","Tes"],"pinned":null,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.7699115044247788,"src":"/static/d52966b0ae7fdc28820f4c938e52f867/ee604/test_cases.png","srcSet":"/static/d52966b0ae7fdc28820f4c938e52f867/69585/test_cases.png 200w,\n/static/d52966b0ae7fdc28820f4c938e52f867/497c6/test_cases.png 400w,\n/static/d52966b0ae7fdc28820f4c938e52f867/ee604/test_cases.png 800w,\n/static/d52966b0ae7fdc28820f4c938e52f867/f3583/test_cases.png 1200w,\n/static/d52966b0ae7fdc28820f4c938e52f867/e4d72/test_cases.png 1280w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Shefali Yaduvanshi","github":null,"avatar":null}}}}]},"markdownRemark":{"excerpt":"Identity is evolving, and developers are at the forefront of this transformation. Every day brings a new learning—adapting to new standards…","fields":{"slug":"/identity/developer-first-identity-provider-loginradius/"},"html":"<p>Identity is evolving, and developers are at the forefront of this transformation. Every day brings a new learning—adapting to new standards and refining approaches to building secure, seamless experiences.</p>\n<p>We’re here to support developers on that journey. We know how important simplicity, efficiency, and well-structured documentation are when working with identity and access management solutions. That’s why we’ve redesigned the <a href=\"https://www.loginradius.com/\">LoginRadius website</a>—to be faster, more intuitive, and developer-first in every way.</p>\n<p>The goal? Having them spend less time searching and more time building.</p>\n<h2 id=\"whats-new-and-improved-on-the-loginradius-website\" style=\"position:relative;\"><a href=\"#whats-new-and-improved-on-the-loginradius-website\" aria-label=\"whats new and improved on the loginradius website permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What’s New and Improved on the LoginRadius Website?</h2>\n<p>LoginRadius’ vision is to give developers a product that simplifies identity management so they can focus on building, deploying, and scaling their applications. To enhance this experience, we’ve spent the last few months redesigning our interface— making navigation more intuitive and reassuring that essential resources are easily accessible.</p>\n<p>Here’s a closer look at what’s new and why it’s important:</p>\n<h3 id=\"a-developer-friendly-dark-theme\" style=\"position:relative;\"><a href=\"#a-developer-friendly-dark-theme\" aria-label=\"a developer friendly dark theme permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>A Developer-Friendly Dark Theme</h3>\n<p><img src=\"/f46881583c7518a93bb24e94c32320de/a-developer-friendly-dark-theme.webp\" alt=\"This image shows how LoginRadius offers several authentication methods like traditional login, social login, passwordless login, passkeys and more in a dark mode.\">    </p>\n<p>Developers spend long hours working in dark-themed IDEs and terminals, so we’ve designed the LoginRadius experience to be developer-friendly and align with that preference.</p>\n<p>The new dark mode reduces eye strain, enhances readability, and provides a seamless transition between a coding environment and our platform. Our new design features a clean, modern aesthetic with a consistent color scheme and Barlow typography, ensuring better readability. High-quality graphics and icons are thoughtfully placed to enhance the content without adding visual clutter.</p>\n<p>So, whether you’re navigating our API docs or configuring authentication into your system, our improved interface will make those extended development hours more comfortable and efficient.</p>\n<h3 id=\"clear-categorization-for-loginradius-capabilities\" style=\"position:relative;\"><a href=\"#clear-categorization-for-loginradius-capabilities\" aria-label=\"clear categorization for loginradius capabilities permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Clear Categorization for LoginRadius Capabilities</h3>\n<p><img src=\"/e5358b82be414940f3fb146013845933/capabilities.webp\" alt=\"This image shows a breakdown of all the LoginRadius CIAM capabilities, including authentication, security, UX, scalability and multi-brand management.\"></p>\n<p>We’ve restructured our website to provide a straightforward breakdown of our customer identity and access management platform capabilities, helping you quickly find what you need:</p>\n<ul>\n<li>Authentication: Easily understand <a href=\"https://www.loginradius.com/blog/identity/authentication-option-for-your-product/\">how to choose the right login method</a>, from traditional passwords and OTPs to social login, federated SSO, and passkeys with few lines of code.</li>\n<li>Security: Implement no-code security features like bot detection, IP throttling, breached password alerts, DDoS protection, and adaptive MFA to safeguard user accounts.</li>\n<li>User Experience: Leverage AI builder, hosted pages, and drag-and-drop workflows to create smooth, branded sign-up and login experiences.</li>\n<li>High Performance &#x26; Scalability: Confidently scale with sub-100ms API response times, 100% uptime, 240K+ RPS, and 28+ global data center regions.</li>\n<li>Multi-Brand Management: Efficiently manage multiple identity apps, choosing isolated or shared data stores based on your brand’s unique needs.</li>\n</ul>\n<p>This structured layout ensures you can quickly understand each capability and how it integrates into your identity ecosystem.</p>\n<h3 id=\"developer-first-navigation\" style=\"position:relative;\"><a href=\"#developer-first-navigation\" aria-label=\"developer first navigation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Developer-First Navigation</h3>\n<p><img src=\"/a8c155c2b6faf3d5f4b4de4e2b14d763/developers-menu.webp\" alt=\"This image shows the LoginRadius menu bar, highlighting the developer dropdown.\">   </p>\n<p>We’ve been analyzing developer workflows to identify how you access key resources. That’s why we redesigned our navigation with one goal in mind: to reduce clicks and make essential resources readily available.</p>\n<p>The new LoginRadius structure puts APIs, SDKs, and integration guides right at the menu bar under the Developers dropdown so you can get started faster. Our Products, Solutions, and Customer Services are also clearly categorized, helping development teams quickly find the right tools and make informed decisions.</p>\n<h3 id=\"quick-understanding-of-integration-benefits\" style=\"position:relative;\"><a href=\"#quick-understanding-of-integration-benefits\" aria-label=\"quick understanding of integration benefits permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Quick Understanding of Integration Benefits</h3>\n<p><img src=\"/b2f9a964a2da0ea83e2f8596b833bba7/we-support-your-tech-stack.webp\" alt=\"This image shows a list of popular programming languages and frameworks offered by LoginRadius.\"></p>\n<p>Developers now have a clear view of the tech stack available with LoginRadius, designed to support diverse business needs.</p>\n<p>Our platform offers pre-built SDKs for Node.js, Python, Java, and more, making CIAM integration seamless across popular programming languages and frameworks.</p>\n<h2 id=\"over-to-you-now\" style=\"position:relative;\"><a href=\"#over-to-you-now\" aria-label=\"over to you now permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Over to You Now!</h2>\n<p>Check out our <a href=\"https://www.loginradius.com/\">revamped LoginRadius website</a> and see how the improved experience makes it easier to build, scale, and secure your applications.</p>\n<p>Do not forget to explore the improved navigation and API documentation, and get started with our free trial today. We’re excited to see what you’ll build with LoginRadius!</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"date":"February 21, 2025","updated_date":null,"description":"LoginRadius’ vision is to give developers a product that simplifies identity management so they can focus on building, deploying, and scaling their applications. To enhance this experience, we’ve redesigned our website interface, making navigation more intuitive and reassuring that essential resources are easily accessible.","title":"Revamped & Ready: Introducing the New Developer-First LoginRadius Website","tags":["Developer tools","API","Identity Management","User Authentication"],"pinned":true,"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.7857142857142858,"src":"/static/80b4e4fbe176a10a327d273504607f32/58556/hero-section.webp","srcSet":"/static/80b4e4fbe176a10a327d273504607f32/61e93/hero-section.webp 200w,\n/static/80b4e4fbe176a10a327d273504607f32/1f5c5/hero-section.webp 400w,\n/static/80b4e4fbe176a10a327d273504607f32/58556/hero-section.webp 800w,\n/static/80b4e4fbe176a10a327d273504607f32/99238/hero-section.webp 1200w,\n/static/80b4e4fbe176a10a327d273504607f32/7c22d/hero-section.webp 1600w,\n/static/80b4e4fbe176a10a327d273504607f32/1258b/hero-section.webp 2732w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Rakesh Soni","github":"oyesoni","avatar":"rakesh-soni.jpg"}}}},"pageContext":{"limit":6,"skip":918,"currentPage":154,"type":"///","numPages":161,"pinned":"ee8a4479-3471-53b1-bf62-d0d8dc3faaeb"}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}