<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Snipplr</title>
    <description>Recent snippets posted on Snipplr.com</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 09 Jun 2026 13:07:24 +0000</lastBuildDate>
    <item>
      <title>(JavaScript) Check if coordinates are adjacent - hellowouter</title>
      <link>https://snipplr.com/view/64354/check-if-coordinates-are-adjacent</link>
      <description>&lt;p&gt;This function returns true if the two sets of coordinates are neighbors and false if they ar not. The function easily determines whether they are neighbors by looking at the distance between the positions along both axes, also callled the Manhattan distance. The sum of the two distances must be exactly 1 if the positions are adjacent.&#13;
&#13;
Note: the coordinates should be integers&lt;/p&gt;</description>
      <pubDate>Wed, 04 Apr 2012 19:25:53 UTC</pubDate>
      <guid>https://snipplr.com/view/64354/check-if-coordinates-are-adjacent</guid>
    </item>
    <item>
      <title>(JavaScript) Alternative for \"for...in\" loop - hellowouter</title>
      <link>https://snipplr.com/view/64239/alternative-for-forin-loop</link>
      <description>&lt;p&gt;We are setting up two variables. The assignment in the middle part of the for loop is also tested for truthfulness â€” if it succeeds, the loop continues. Since i is incremented each time, items from the array will be assigned to item in sequential order. The loop stops when a "falsy" item is found (such as undefined).&#13;
&#13;
Note that this trick should only be used for arrays which you know do not contain "falsy" values (arrays of objects or DOM nodes for example). If you are iterating over numeric data that might include a 0 or string data that might include the empty string you should use a standard for loop.&#13;
&#13;
Note that if someone added new properties to Array.prototype, using a "for...in" loop is no option since the loop will also iterate over the new prototype properties.&lt;/p&gt;</description>
      <pubDate>Fri, 30 Mar 2012 19:10:51 UTC</pubDate>
      <guid>https://snipplr.com/view/64239/alternative-for-forin-loop</guid>
    </item>
    <item>
      <title>(JavaScript) Using call to invoke an anonymous function - hellowouter</title>
      <link>https://snipplr.com/view/64237/using-call-to-invoke-an-anonymous-function</link>
      <description>&lt;p&gt;In this purely constructed example, we create anonymous function and use call to invoke it on every object in an array. The main purpose of the anonymous function here is to add a print function to every object, which is able to print the right index of the object in the array. Passing the object as this value was not strictly necessary, but is done for explanatory purpose.&lt;/p&gt;</description>
      <pubDate>Fri, 30 Mar 2012 18:53:13 UTC</pubDate>
      <guid>https://snipplr.com/view/64237/using-call-to-invoke-an-anonymous-function</guid>
    </item>
    <item>
      <title>(JavaScript) Using Math.min and Math.max for an array - hellowouter</title>
      <link>https://snipplr.com/view/64235/using-mathmin-and-mathmax-for-an-array</link>
      <description>&lt;p&gt;Clever usage of apply allows you to use built-ins functions for some tasks that otherwise probably would have been written by looping over the array values. As an example here we are going to use Math.max/Math.min to find out the maximum/minimum value in an array.&lt;/p&gt;</description>
      <pubDate>Fri, 30 Mar 2012 18:36:05 UTC</pubDate>
      <guid>https://snipplr.com/view/64235/using-mathmin-and-mathmax-for-an-array</guid>
    </item>
  </channel>
</rss>
