<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muse'</title>
    <description>The latest articles on DEV Community by Muse' (@umpp101).</description>
    <link>https://dev.to/umpp101</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F241586%2F8026c2a3-4bbb-49fe-bd79-463a2a3a3c6a.jpeg</url>
      <title>DEV Community: Muse'</title>
      <link>https://dev.to/umpp101</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/umpp101"/>
    <language>en</language>
    <item>
      <title>Auth in your react app!</title>
      <dc:creator>Muse'</dc:creator>
      <pubDate>Sun, 28 Jun 2020 21:37:09 +0000</pubDate>
      <link>https://dev.to/umpp101/auth-in-your-react-app-48b5</link>
      <guid>https://dev.to/umpp101/auth-in-your-react-app-48b5</guid>
      <description>&lt;p&gt;When starting a new project, it takes some effort to implement Login / Sign-up screens. We often have to repeat the same implementation again and again.&lt;/p&gt;

&lt;p&gt;Authentication should be simple to remove friction to build an MVP (Most Viable Product) or get users started. Authentication logic should be reused to save development time.&lt;/p&gt;

&lt;p&gt;There are a few online services that let you integrate your application with their Authentication APIs. But it doesn't really save much time when we have to go through long documentation to understand it, then spend more time learning and integrating.&lt;/p&gt;

&lt;p&gt;An Authentication Service should be simple to integrate with. Below is an example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 - Import and use Login Component&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3izH8LWP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/im3zxxjb70u428mz1bzy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3izH8LWP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/im3zxxjb70u428mz1bzy.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2 - Handle response&lt;/strong&gt;&lt;br&gt;
After user submitted the form (Sign up or Log in), the "afterSubmit" callback function will be called. Here you can handle the response (full User object) by redirecting user to the home page, dashboard, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7Os24oJz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hpsz7vnmrhqb85fquyud.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7Os24oJz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hpsz7vnmrhqb85fquyud.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;jwtData is the user object which has properties like: user uuid, accessToken, email, name, picUrl, etc. which can be used in the app (or store in localStorage).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's it!&lt;/strong&gt;&lt;br&gt;
There is no Step 3. In the next article, I will write more about how it works. In the meantime, there is more information in the link below:&lt;/p&gt;

&lt;p&gt;AuthUI Repo - (&lt;a href="https://github.com/authui/authui"&gt;https://github.com/authui/authui&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Happy Coding! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>3 simple JS tricks to make life easier..</title>
      <dc:creator>Muse'</dc:creator>
      <pubDate>Mon, 22 Jun 2020 03:07:51 +0000</pubDate>
      <link>https://dev.to/umpp101/3-simple-js-tricks-to-make-life-easier-5920</link>
      <guid>https://dev.to/umpp101/3-simple-js-tricks-to-make-life-easier-5920</guid>
      <description>&lt;p&gt;I'm sure we all have our styles of writing code and are comfortable with but change and learning new ways to write code is essential as software engineers... &lt;/p&gt;

&lt;h1&gt;
  
  
  Here are some of the simple and clear tricks you can use to code faster!
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Format your JsonData:
&lt;/h2&gt;

&lt;p&gt;Many developers when using JSON.Stringify, use the first(required param) = &lt;em&gt;value&lt;/em&gt; but in reality, there is 2 other optional params: &lt;em&gt;replacer&lt;/em&gt; &amp;amp; &lt;em&gt;space&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let me show you how it works and you'll understand exactly what i mean! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1st Step: Construct your JSON Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jnezsYp---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5oy1fladvz74hvtzwh3e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jnezsYp---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5oy1fladvz74hvtzwh3e.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2nd Step: Format it&lt;/strong&gt;&lt;br&gt;
We want to format it by first name and last name for each reader, and we want to add a tab to each level.&lt;br&gt;
This how you'd write that: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R1WaUot9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uy4v9tou5hndo2nnuw1a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R1WaUot9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uy4v9tou5hndo2nnuw1a.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3rd Step: console.log/render that formatted JSON!&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xtXvX7Jy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ztuh5a37gs4tiaj8hgef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xtXvX7Jy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ztuh5a37gs4tiaj8hgef.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Drop the Array.Filter() and rely on Set():
&lt;/h2&gt;

&lt;p&gt;Make use of the native Set() object rather than filtering through the array to get unique values.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uD2A8BkD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hrs8inddlu87lh6zafcf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uD2A8BkD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hrs8inddlu87lh6zafcf.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Incorporate some spread operating in your code:
&lt;/h2&gt;

&lt;p&gt;Sometimes we all need to merge classes or objects together, spread operator can easily get the job done. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0ovTb0wz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a9468fj5cgyzdjzfmy1w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0ovTb0wz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/a9468fj5cgyzdjzfmy1w.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
The code above will combine all those objects into one object!&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;ES6 has not only made JavaScript more efficient but also more fun, So if you haven’t taken the time to play around, you definitely should.&lt;br&gt;
Let me know below in the comments if you have any favorite code tricks that you'd like to share :) &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding types of Errors and how to handle them! </title>
      <dc:creator>Muse'</dc:creator>
      <pubDate>Sun, 14 Jun 2020 23:29:07 +0000</pubDate>
      <link>https://dev.to/umpp101/understanding-types-of-errors-and-how-to-handle-them-56d1</link>
      <guid>https://dev.to/umpp101/understanding-types-of-errors-and-how-to-handle-them-56d1</guid>
      <description>&lt;p&gt;As Programmers, we all want to that works. And no one really enjoys getting errors, or the anxiety that comes from dealing with them. The best way around this would be to set up error detection and figure out the best way to handle them. My goal with this brief blog is to show you how to properly handle JavaScript and avoid shipping code that's messy and full of bugs. &lt;/p&gt;

&lt;p&gt;First, we must understand that errors have different types.&lt;br&gt;&lt;br&gt;
1) &lt;strong&gt;Syntax errors&lt;/strong&gt;: when your code is compiling. &lt;br&gt;
2) &lt;strong&gt;Runtime errors&lt;/strong&gt;: that are caused when executing/running your code.&lt;br&gt;
3) &lt;strong&gt;Logic errors&lt;/strong&gt;: that are caused by you as a programmer during your coding and writing functional logic. &lt;/p&gt;

&lt;p&gt;Example of &lt;strong&gt;Syntax Error&lt;/strong&gt;: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AFDiQRxi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jipn3nurlgfj35edlbur.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AFDiQRxi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/jipn3nurlgfj35edlbur.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This code: will cause a syntax error because it is missing a closing parenthesis, even though the code below it might run if it doesn't depend on it all. &lt;/p&gt;

&lt;p&gt;Example of &lt;strong&gt;Runtime Error&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QhTqEim9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dvp78hj53yzz4jzkdswg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QhTqEim9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dvp78hj53yzz4jzkdswg.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This code: will cause a runtime error because openObject is not a method in javascript nor does it even exist.&lt;/p&gt;

&lt;p&gt;Example of &lt;strong&gt;Logic Error&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lU9sSNwd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9f0nh252w7afmw5mv7a5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lU9sSNwd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9f0nh252w7afmw5mv7a5.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if the inputs were (5, 2.5) this code will also cause a error,  because it can’t handle fractional exponents, even though mathematically we can raise a number to the halfth power but in javascript this can be done with Math.pow()..&lt;/p&gt;

&lt;p&gt;So how can one avoid these errors and what are the best methods for error handling?&lt;/p&gt;

&lt;p&gt;These are two of the many ways:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try &amp;amp; Catch:&lt;/strong&gt;&lt;br&gt;
try statements are statements that will execute. &lt;br&gt;
If an exception occurs, the exception is placed in e and the catch clause is executed otherwise, the catch clause is skipped. The last clause executes after the try statement is finished, &lt;br&gt;
it executes regardless of whether or not an exception was thrown or caught.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yc5XJ7B8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dzhcmt3e8k7bmfwa4if1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yc5XJ7B8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dzhcmt3e8k7bmfwa4if1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The onError():&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This error handling was the first event handler to facilitate and handle errors in JavaScript, it can be used in many different ways, below is example of how to use to to make sure pictures load properly! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nBiE9mC_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1mzmi8i4t8695rfd1xx2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nBiE9mC_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1mzmi8i4t8695rfd1xx2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As Programmers, we all knew there many rooms to improve and master our skillsets and coding functionality, there’s no harm in trying, and no shame in admitting failure. There will always be mistakes, it’s what we do about them that matters in the end. I hope that you learned from this blog as much i did reviewing and writing up this content! Happy coding! &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>codenewbie</category>
      <category>tutorial</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Naming Conventions Cheatsheet: Rails</title>
      <dc:creator>Muse'</dc:creator>
      <pubDate>Wed, 12 Feb 2020 23:57:38 +0000</pubDate>
      <link>https://dev.to/umpp101/naming-conventions-cheatsheet-rails-1gp0</link>
      <guid>https://dev.to/umpp101/naming-conventions-cheatsheet-rails-1gp0</guid>
      <description>&lt;p&gt;We all suffer from the stress that comes with realizing that you named something correctly but didn't follow the right convention... its 2020.. Let's put that stress to an end! &lt;br&gt;
Below ill give you a summary for ruby/rails naming conventions..&lt;/p&gt;

&lt;p&gt;We'll start with general ones than go into filesystem related conventions! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ruby&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(Class names) are CamelCase.&lt;/p&gt;

&lt;p&gt;(Methods) and (variables) are snake_case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;+--------------------------+&lt;br&gt;
| top_food_spots           |&lt;br&gt;
+------------+-------------+&lt;br&gt;
| id         | ID          |&lt;br&gt;
| sighted_at | DATETIME    |&lt;br&gt;
| location   | STRING      |&lt;br&gt;
+------------+-------------+&lt;/p&gt;

&lt;p&gt;+------------------------------+&lt;br&gt;
| Users                        |&lt;br&gt;
+---------------------+--------+&lt;br&gt;
| id                  | ID     |&lt;br&gt;
| name                | STRING |&lt;br&gt;
+---------------------+--------+&lt;/p&gt;

&lt;p&gt;(Database tables) = snake_case. &lt;br&gt;
(Table names) = plural.&lt;br&gt;
(Column names) in the database = snake_case (but are generally singular.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(Model class names) = CamelCase. &lt;br&gt;
These are singular, and will be writting automatically to the plural database table name.&lt;/p&gt;

&lt;p&gt;(Model attributes and methods) = snake_case &lt;br&gt;
and match the column names in the database.&lt;/p&gt;

&lt;p&gt;**&lt;br&gt;
app/models/bigfoot_sighting.rb&lt;/p&gt;

&lt;p&gt;class TopFoodSpots &amp;lt; ActiveRecord::Base&lt;br&gt;
  # This class will have these attributes: id, sighted_at, location&lt;br&gt;
end&lt;br&gt;
**&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Controllers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(Controller class names) = CamelCase &lt;br&gt;
but (The Controller suffix) is always singular. The name of the resource is usually plural.&lt;/p&gt;

&lt;p&gt;(Controller actions) = snake_case &lt;br&gt;
and usually match the standard route names Rails defines &lt;br&gt;
(index, show, new, create, edit, update, delete).&lt;/p&gt;

&lt;p&gt;app/controllers/profiles_controller.rb&lt;/p&gt;

&lt;p&gt;ProfilesController &amp;lt; ApplicationController&lt;br&gt;
  def show&lt;br&gt;
    # ...&lt;br&gt;
  end&lt;br&gt;
  # etc&lt;br&gt;
end&lt;/p&gt;

</description>
      <category>rails</category>
      <category>beginners</category>
      <category>ruby</category>
      <category>syntax</category>
    </item>
    <item>
      <title>Different Types of Pagination</title>
      <dc:creator>Muse'</dc:creator>
      <pubDate>Wed, 12 Feb 2020 23:38:35 +0000</pubDate>
      <link>https://dev.to/umpp101/different-types-of-pagination-3cgo</link>
      <guid>https://dev.to/umpp101/different-types-of-pagination-3cgo</guid>
      <description>&lt;p&gt;We all know that nothing makes us leave and abandon a site, &lt;br&gt;
than a site having a slow load time…&lt;/p&gt;

&lt;p&gt;To the simple site user, consumer.. api and api loading data is not their concern or even something they are aware of.. but as developers we must take into consideration all possible issues that may involve a user’s experience..&lt;/p&gt;

&lt;p&gt;One of the many ways, this can be accomplished… is by “optimizing api’s for peak efficiency”…. and this can be done with api pagination!&lt;/p&gt;

&lt;p&gt;So what is pagination?&lt;/p&gt;

&lt;p&gt;Have you ever been on commerce store and went through many products, and was able to flip through the products pages and view a certain amount of them per page…&lt;br&gt;
or scrolled through a gallery of images, only to be click next so that you may browse through another section.&lt;br&gt;
this is essentially pagination! &lt;/p&gt;

&lt;p&gt;Let's have a look at the most common pagination methods today! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keyset Pagination:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;it uses filtered values of a pages to determine the next group of items…&lt;/p&gt;

&lt;p&gt;for example:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Client wants to see the most recent 20 products GET /items?limit=20&lt;/li&gt;
&lt;li&gt;Upon clicking next, the query finds the minimum created date of 2019–01–20T00:00:00. That’s then used to create a “query filter” for the next page. GET /items?limit=20&amp;amp;created:lte:2020-01-20&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The benefit to this approach, is this can be done without requiring more backend logic, other than that initial URL parameter!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Offset Pagination&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;this is done using two main commands: “Limit” &amp;amp; ”Offset”, these are mostly popular with apps that hooked with SQL databases &lt;/p&gt;

&lt;p&gt;GET /items?limit=20&amp;amp;offset=50&lt;/p&gt;

&lt;p&gt;the benefit to this approach is, it requires almost no programming, its stateless server-side wise but it also comes with the cons of offsetting large values, because the api would be forced to scan through a 100,000 database entries before discarding them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Seek Pagination:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;this is done using the queries..”after_id” &amp;amp; “before_id”, because unique ID’s are more reliable than field names such as Category name or product name..&lt;/p&gt;

&lt;p&gt;Consider this example:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Client requests a list of the most recent items GET items?limit=20&lt;/li&gt;
&lt;li&gt;Client requests a list of the next 20 items, using the results of the first query GET /items?limit=20&amp;amp;after_id=20&lt;/li&gt;
&lt;li&gt;Client requests the next/scroll page, using the final entry from the second page as the starting point GET /items?limit=20&amp;amp;after_id=40&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;think of seek pagination as searching through a database using “WHERE”&lt;br&gt;
in the case where you are sorting items by id:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RD0tIQ3w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6rgyiyfiu1c9o1qn3z0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RD0tIQ3w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6rgyiyfiu1c9o1qn3z0y.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And what if you were searching by usernames:&lt;/p&gt;

&lt;p&gt;this would require two rounds of queries in the backend:&lt;br&gt;
the first would search the database for those usernames and then translate them into an ID &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RD0tIQ3w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6rgyiyfiu1c9o1qn3z0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RD0tIQ3w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6rgyiyfiu1c9o1qn3z0y.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and then a second query would use the id’s as “Where” value..&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2LBruJ4g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dcie7lhhl0pk4xpkwusa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2LBruJ4g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dcie7lhhl0pk4xpkwusa.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;the benefits of this method: it works really well and efficiently with large offsets.&lt;br&gt;
it consistently orders items and sorts the newly added ones as well.&lt;/p&gt;

&lt;p&gt;the biggest con is when there’s items deleted from the database … “start_id” may no longer be valid.&lt;/p&gt;

&lt;p&gt;I hope this was a nice intro to pagination, please make sure you continue to learn and try new logic with every new project :) Happy Coding! &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>rails</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Arrow Functions: What you should know.....</title>
      <dc:creator>Muse'</dc:creator>
      <pubDate>Fri, 07 Feb 2020 22:14:31 +0000</pubDate>
      <link>https://dev.to/umpp101/arrow-functions-what-you-should-know-5b4g</link>
      <guid>https://dev.to/umpp101/arrow-functions-what-you-should-know-5b4g</guid>
      <description>&lt;p&gt;ES5 to ES6 &lt;br&gt;
One of the biggest differences we all know of, is how functions have changed. &lt;br&gt;
With ES5 the function keyword syntax was popular, then in 2015 with the intro of ES6, there was no longer the need for the keyword nor a return statement. &lt;br&gt;
Functions have never been more clear and concise.&lt;br&gt;
think of arrow functions as how functions were before, both accept arguments and run a specific set of statements every-time their called.&lt;/p&gt;

&lt;p&gt;So what is the difference then?&lt;/p&gt;

&lt;p&gt;Syntax: arrow functions don't need the keywords anymore!&lt;br&gt;
Value: Arrow functions always inherited from the enclosing scope. and don't have their own value.&lt;br&gt;
Arguments: with ES5 theres an object that can be used to get all the arguments passed to the function. But with arrow functions, they are bound to arguments of enclosing scope.&lt;br&gt;
This: The value of this inside an arrow function remains the same throughout and its value is connected to the closest non-arrow parent function only..&lt;/p&gt;

&lt;p&gt;Here's an example below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gt5k7aSS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/se129e2y9yoweffgxtbd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gt5k7aSS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/se129e2y9yoweffgxtbd.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope this might have gave you a very simple example of how arrow functions work! Please make sure you refer to the docs for further reading! Happy coding&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>vscode</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Javascript Scopes Types .. Simplified! </title>
      <dc:creator>Muse'</dc:creator>
      <pubDate>Thu, 02 Jan 2020 21:35:52 +0000</pubDate>
      <link>https://dev.to/umpp101/javascript-scopes-types-simplified-3be7</link>
      <guid>https://dev.to/umpp101/javascript-scopes-types-simplified-3be7</guid>
      <description>&lt;p&gt;Just like with many programming languages, there’s fundamental concepts that might seem confusing even though they are essential to mastering the target language. We can all agree that Scope and Scope is one of them. &lt;/p&gt;

&lt;p&gt;Hopefully by the end of this blog post, you’ll be able to find it less confusing and you’ll be on your way to writing better, more efficient and cleaner code.&lt;/p&gt;

&lt;p&gt;What is Scope?&lt;/p&gt;

&lt;p&gt;Scope is the accessibility of variables. It refers to where and which part of your program can your variables be accessed/utilized. &lt;/p&gt;

&lt;p&gt;How Many types?&lt;/p&gt;

&lt;p&gt;Global Scope, Function Scope and Block Scope&lt;/p&gt;

&lt;p&gt;Is Scope even that important?&lt;/p&gt;

&lt;p&gt;Yes! And the main benefit is security and preventing changes to our variables through out our code and to also make sure we don’t end up with same variables.&lt;/p&gt;

&lt;p&gt;Global Scope:&lt;/p&gt;

&lt;p&gt;-&amp;gt; Not inside a function or block {}&lt;/p&gt;

&lt;p&gt;-&amp;gt; Can be accessed anywhere.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m_IxQTS6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zkw06t7qnk7kyjeekehk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m_IxQTS6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zkw06t7qnk7kyjeekehk.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Local Scope:&lt;/p&gt;

&lt;p&gt;-&amp;gt; Variable declared inside a function &lt;/p&gt;

&lt;p&gt;-&amp;gt; Only accessed in that function and no where else outside..&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z6UA5Lvk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tj9e7vxvvkjqkynyea5j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z6UA5Lvk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tj9e7vxvvkjqkynyea5j.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Block scope:&lt;/p&gt;

&lt;p&gt;-&amp;gt; They can be accessed within the nearest pair of curly braves,&lt;br&gt;
   but not outside of it.&lt;/p&gt;

&lt;p&gt;-&amp;gt; Unlike var, it doesn’t have that block scope limitation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pVUZ1Py0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nhxhr346alen1apvxvq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pVUZ1Py0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/nhxhr346alen1apvxvq8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*Quick tip: &lt;/p&gt;

&lt;p&gt;Scopes can be nested on top of each other..&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0c0ZbH7Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/chzpuimkkgo6wq6el6lc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0c0ZbH7Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/chzpuimkkgo6wq6el6lc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The let variable that’s a block scope, is inside of the local scope, which is nested inside the global scope.&lt;/p&gt;

&lt;p&gt;*Quick tip:&lt;/p&gt;

&lt;p&gt;Most modern day browsers support "Strict Mode"&lt;br&gt;
which basically means, undeclared variables are not automatically global.&lt;br&gt;
so if you were to assign a variable without const or var, this would throw an error. &lt;/p&gt;

&lt;p&gt;Scopes might seem very confusing at first, but with the more practice and detail you give to how you initially write out your code, the less errors and debugging your code will experience..! &lt;/p&gt;

&lt;p&gt;Happy coding! &lt;/p&gt;

</description>
      <category>scope</category>
      <category>javascript</category>
      <category>functional</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>The tough choice: Ruby or Javascript</title>
      <dc:creator>Muse'</dc:creator>
      <pubDate>Thu, 03 Oct 2019 20:26:46 +0000</pubDate>
      <link>https://dev.to/umpp101/the-tough-choice-ruby-or-javascript-b9c</link>
      <guid>https://dev.to/umpp101/the-tough-choice-ruby-or-javascript-b9c</guid>
      <description>&lt;p&gt;JavaScript versus Ruby. &lt;br&gt;
Which one do I like more and which one is better for me?&lt;br&gt;
When I first got interested in coding, I sought out to teach myself the basics without any help.&lt;br&gt;
I spent a long time deciding on which language I should start off with. And I went ahead with a language called Javascript and here’s why:&lt;/p&gt;

&lt;p&gt;JavaScript has a huge community: The JavaScript community continue to grow the language supports and library creations with every passing year. With that comes a huge pool of working professionals that you can work with. &lt;br&gt;
JavaScript can easily be setup: simply from launching google chrome and accessing the developer mode. A couple of clicks and you are ready to code away and build!&lt;/p&gt;

&lt;p&gt;JavaScript with the addition of Node: makes it a full stack platform to build pretty much any program you’d like, especially with how scalable the JavaScript language is in itself.  &lt;/p&gt;

&lt;p&gt;And for that and many other reasons, I set my path of self teaching geared at focusing on JavaScript and utilizing the online resources I could. Till I realized that without proper instruction/mentorship, I wouldn’t truly be maximizing my learning potential and even more with how sophisticated JavaScript can get at time. So I went on to compare languages till I realized that ruby might be a language that might be a better choice for me at the same that I am, a beginner. And no matter how much I do enjoy JavaScript..&lt;/p&gt;

&lt;p&gt;Ruby in my opinion is a better choice for a beginner and this is due:&lt;/p&gt;

&lt;p&gt;To the simplicity of the syntax, and how easily variables can be declared and having to not worry about curly braces and semi colons unlike with JavaScript.&lt;/p&gt;

&lt;p&gt;Also Because it truly lives us to the philosophy it was built on, “The Principle of Least astonishment”, its creator Mats, believed that computers are the slaves and we are the masters not the other way around. We should be in control! &lt;br&gt;
So he set out to make ruby as easily as possible, to ensure that with every build you are least surprised by your code because of user friendly and simple the language is. &lt;br&gt;
And lasty, we all know that with languages, your first new language that you try to pick up is the hardest on you. But as soon as you get familiar with one language, you realize that there’s always similarities between vocabularies and word roots but it’s the grammar and the structure that’s difficult, same goes with ruby and JavaScript, yes the syntax is different and yes JavaScript might seem more cool and popular but as a beginner I opened up to the idea of taking it slow and deciding to learn to code rather than coding in the language I love, that can always be done later on in life.&lt;/p&gt;

</description>
      <category>codingstudent</category>
      <category>books</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
