<?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: Alex Cosmas</title>
    <description>The latest articles on DEV Community by Alex Cosmas (@alex-cosmas).</description>
    <link>https://dev.to/alex-cosmas</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%2F515908%2F54331aa5-384f-40d9-b8e5-043c6198cf62.jpeg</url>
      <title>DEV Community: Alex Cosmas</title>
      <link>https://dev.to/alex-cosmas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alex-cosmas"/>
    <language>en</language>
    <item>
      <title>Understanding Protocols in Elixir</title>
      <dc:creator>Alex Cosmas</dc:creator>
      <pubDate>Sat, 30 Mar 2024 18:10:41 +0000</pubDate>
      <link>https://dev.to/alex-cosmas/understanding-protocols-in-elixir-1lbf</link>
      <guid>https://dev.to/alex-cosmas/understanding-protocols-in-elixir-1lbf</guid>
      <description>&lt;p&gt;Protocols in Elixir are a way to define a set of functions that a module must implement. They are similar to interfaces in other programming languages.&lt;/p&gt;

&lt;p&gt;In Elixir, protocols are used to define a common set of functions that a module must implement, but they do not enforce the implementation details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example: Card Game&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's say you have a group of friends who want to play a game together. The game requires each player to have a set of skills, such as the ability to roll a dice, draw a card, or move a piece on a board. However, each player has their own unique way of implementing these skills.&lt;/p&gt;

&lt;p&gt;In Elixir, you can define a protocol for the game that specifies the functions that each player must implement. For example, the GamePlayer protocol might have functions like roll_dice, draw_card, and move_piece.&lt;/p&gt;

&lt;p&gt;Now, let's say you have two friends, Alice and Bob, who want to play the game. Alice is a beginner and wants to implement the GamePlayer protocol in a simple way, while Bob is an expert and wants to implement it in a more complex way.&lt;/p&gt;

&lt;p&gt;Alice might implement the roll_dice function by simply rolling a physical dice and returning the result. She might implement the draw_card function by drawing a card from a deck and returning its value. And she might implement the move_piece function by moving a piece on the board a certain number of spaces.&lt;/p&gt;

&lt;p&gt;Bob, on the other hand, might implement the roll_dice function by using a statistical model to simulate the roll of a dice. He might implement the draw_card function by using a machine learning algorithm to predict the value of the card. And he might implement the move_piece function by using a physics engine to simulate the movement of the piece on the board.&lt;/p&gt;

&lt;p&gt;Even though Alice and Bob have implemented the GamePlayer protocol in different ways, they can still play the game together because they both implement the same functions. This is similar to how protocols work in Elixir.&lt;/p&gt;

&lt;p&gt;In Elixir, you can define a protocol using the defprotocol macro. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defprotocol GamePlayer do
  def roll_dice
  def draw_card
  def move_piece
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, any module that wants to implement the GamePlayer protocol must implement these three functions.&lt;/p&gt;

&lt;p&gt;For example, Alice's simple implementation of the GamePlayer protocol might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule Alice do
  def roll_dice, do: 1 + 1
  def draw_card, do: 10
  def move_piece, do: 5
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bob's more complex implementation of the GamePlayer protocol might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule Bob do
  def roll_dice, do: simulate_dice_roll()
  def draw_card, do: predict_card_value()
  def move_piece, do: simulate_piece_movement(5)

  def simulate_dice_roll, do: ...
  def predict_card_value, do: ...
  def simulate_piece_movement(spaces), do: ...
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though Alice and Bob have implemented the GamePlayer protocol in different ways, they can still play the game together because they both implement the same functions.&lt;/p&gt;

&lt;p&gt;This is the power of protocols in Elixir. They allow different modules to implement the same functions in different ways, making it easier to write reusable code and create more flexible programs.&lt;/p&gt;

</description>
      <category>elixir</category>
    </item>
    <item>
      <title>Guards in Elixir</title>
      <dc:creator>Alex Cosmas</dc:creator>
      <pubDate>Tue, 28 Nov 2023 09:27:48 +0000</pubDate>
      <link>https://dev.to/alex-cosmas/guards-in-elixir-3dhl</link>
      <guid>https://dev.to/alex-cosmas/guards-in-elixir-3dhl</guid>
      <description>&lt;p&gt;Guards in Elixir are used within function definitions to impose constraints on the input parameters. They act as filters, allowing a function clause to be selected only when certain conditions are met.&lt;/p&gt;

&lt;p&gt;Here are some key points about guards:&lt;/p&gt;

&lt;p&gt;Guards are conditions added to function clauses using the &lt;code&gt;when&lt;/code&gt; keyword:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;some_function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;when&lt;/span&gt; &lt;span class="n"&gt;condition&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="c1"&gt;# Function body&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Supported Constructs:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Basic Operators:&lt;/strong&gt; Guards support basic comparison operators (&lt;code&gt;==&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;=&lt;/code&gt;, &lt;code&gt;&amp;lt;=&lt;/code&gt;) and boolean operators (&lt;code&gt;and&lt;/code&gt;, &lt;code&gt;or&lt;/code&gt;, &lt;code&gt;not&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Type Checks:&lt;/strong&gt; Type checks using &lt;code&gt;is_integer/1&lt;/code&gt;, &lt;code&gt;is_float/1&lt;/code&gt;, &lt;code&gt;is_atom/1&lt;/code&gt;, &lt;code&gt;is_boolean/1&lt;/code&gt;, &lt;code&gt;is_list/1&lt;/code&gt;, etc., to ensure the type of the argument.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pattern Matching:&lt;/strong&gt; Guards also allow pattern matching using the &lt;code&gt;match?/2&lt;/code&gt; function.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Examples:
&lt;/h3&gt;

&lt;p&gt;Here are some examples to illustrate guards in action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;
&lt;span class="c1"&gt;# Function to double a number if it's less than 10&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;double_if_less_than_ten&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;when&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="c1"&gt;# Function to greet if the argument is a string&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;greet_person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;when&lt;/span&gt; &lt;span class="n"&gt;is_binary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="s2"&gt;"Hello, &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;!"&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="c1"&gt;# Function to check if a list has more than 3 elements&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;has_more_than_three_elements&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;when&lt;/span&gt; &lt;span class="n"&gt;is_list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Limitations:
&lt;/h3&gt;

&lt;p&gt;Guard clauses have some limitations due to their constrained nature. They are executed in a restricted environment and therefore don't support arbitrary functions or complex computations. They must be pure and quick to execute, as they run before the function body and should not have side effects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Cases:
&lt;/h3&gt;

&lt;p&gt;Guards are beneficial when you want to specify conditions for function clauses based on the type or value of arguments. They help in making code more expressive and maintainable by separating different cases for function invocation.&lt;/p&gt;

&lt;p&gt;Elixir leverages guards extensively in pattern matching and function definition, allowing you to create more flexible and precise functions that handle various input scenarios elegantly.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is the -&gt; arrow in Elixir</title>
      <dc:creator>Alex Cosmas</dc:creator>
      <pubDate>Tue, 28 Nov 2023 08:12:18 +0000</pubDate>
      <link>https://dev.to/alex-cosmas/what-is-the-arrow-in-elixir-4dkg</link>
      <guid>https://dev.to/alex-cosmas/what-is-the-arrow-in-elixir-4dkg</guid>
      <description>&lt;p&gt;-&amp;gt; is a fundamental part of the Elixir syntax and plays several roles but first what is it. &lt;br&gt;
The -&amp;gt; arrow is used to denote function clauses, as well as to define anonymous functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Defining Function Clauses&lt;/strong&gt;&lt;br&gt;
In pattern matching, the -&amp;gt; arrow separates the function head (which includes the function name and its arguments) from the function body. &lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;defmodule Math do
  def sum(a, b) do
    a + b
  end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, def sum(a, b) do ... end is a function clause, and the -&amp;gt; arrow is implied within the do ... end block.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Anonymous Functions&lt;/strong&gt;&lt;br&gt;
When creating anonymous functions using the fn keyword, the -&amp;gt; arrow separates the arguments and body of the function. &lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add = fn a, b -&amp;gt; a + b end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, fn a, b -&amp;gt; a + b end defines an anonymous function that takes a and b as arguments and returns their sum (a + b). The -&amp;gt; arrow separates the arguments from the function body.&lt;/p&gt;

&lt;p&gt;The -&amp;gt; arrow is crucial for indicating the separation between the arguments and the function body in both function definitions and anonymous functions in Elixir.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Google Geocoding API error: request denied</title>
      <dc:creator>Alex Cosmas</dc:creator>
      <pubDate>Sun, 23 Jul 2023 16:59:01 +0000</pubDate>
      <link>https://dev.to/alex-cosmas/google-geocoding-api-error-request-denied-50c3</link>
      <guid>https://dev.to/alex-cosmas/google-geocoding-api-error-request-denied-50c3</guid>
      <description>&lt;p&gt;I ran into this issue while trying to use the Geocode gem on my rails 7 app. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gitaD4TM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62gn2yv9ms60xvb88wxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gitaD4TM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62gn2yv9ms60xvb88wxl.png" alt="Image description" width="637" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you ran into this error, these are the steps that I used to debug. &lt;br&gt;
Google Bard was a great tool that helped with solving this bug.&lt;/p&gt;

&lt;p&gt;Why? Google Geocoding API error: request denied.&lt;/p&gt;

&lt;p&gt;The Google Geocoding API error "request denied" can occur for a few reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have not activated the Geocoding API in the Google Cloud Console.&lt;/li&gt;
&lt;li&gt;You have not specified the key parameter in your request.&lt;/li&gt;
&lt;li&gt;The key parameter does not match the API key in your Google Cloud Console.&lt;/li&gt;
&lt;li&gt;Your API key has not been correctly set up in the Google Cloud Console.&lt;/li&gt;
&lt;li&gt;You have exceeded your monthly quota for free requests.&lt;/li&gt;
&lt;li&gt;You are using a restricted IP address or country.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To troubleshoot this error, you can check the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure that the Geocoding API is activated in your Google Cloud Console.&lt;/li&gt;
&lt;li&gt;Check that you have specified the key parameter in your request.&lt;/li&gt;
&lt;li&gt;Verify that the key parameter matches the API key in your Google Cloud Console.&lt;/li&gt;
&lt;li&gt;Check your monthly quota for free requests.&lt;/li&gt;
&lt;li&gt;Check that you are not using a restricted IP address or country.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Installing the Geocode gem to rails&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install the Geocoder gem: &lt;br&gt;
&lt;code&gt;bundle add geocoder&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a config/initializers/geocoder.rb file and add the following code:&lt;br&gt;
&lt;code&gt;Ruby&lt;br&gt;
Geocoder.configure do |config|&lt;br&gt;
config.api_key = ENV['GEOCODER_API_KEY']&lt;br&gt;
config.lookup_adapter = :google&lt;br&gt;
end&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replace ENV['GEOCODER_API_KEY'] with your Google Geocoding API key. &lt;br&gt;
You can get your API key from the Google Cloud Console: &lt;a href="https://console.cloud.google.com/apis/credentials"&gt;https://console.cloud.google.com/apis/credentials&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In your Rails application, you can now use the Geocoder class to geocode addresses. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example, the following code will geocode the address "1600 Pennsylvania Avenue NW, Washington, DC 20500":&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ruby&lt;br&gt;
address = "1600 Pennsylvania Avenue NW, Washington, DC 20500"&lt;br&gt;
coordinates = Geocoder.search(address).first.coordinates&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The coordinates variable will now contain the latitude and longitude of the address.&lt;/p&gt;

&lt;p&gt;Here are some additional resources that you may find helpful:&lt;/p&gt;

&lt;p&gt;Geocoder gem documentation: &lt;a href="https://github.com/alexreisner/geocoder"&gt;https://github.com/alexreisner/geocoder&lt;/a&gt;&lt;br&gt;
Google Geocoding API documentation: &lt;a href="https://developers.google.com/maps/documentation/geocoding/"&gt;https://developers.google.com/maps/documentation/geocoding/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Results&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TOStG5uv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/utll1xe0do0w16d4xb3n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TOStG5uv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/utll1xe0do0w16d4xb3n.png" alt="Image description" width="646" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s----pgnj0L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0x89lq5d1aw5t0b90pn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s----pgnj0L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0x89lq5d1aw5t0b90pn.png" alt="Image description" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is the difference npm build and npm run build?</title>
      <dc:creator>Alex Cosmas</dc:creator>
      <pubDate>Thu, 23 Mar 2023 07:48:05 +0000</pubDate>
      <link>https://dev.to/alex-cosmas/what-is-the-difference-npm-build-and-npm-run-build-1o1l</link>
      <guid>https://dev.to/alex-cosmas/what-is-the-difference-npm-build-and-npm-run-build-1o1l</guid>
      <description>&lt;p&gt;One more thing, npm build and npm run build are two different things, npm run build will do custom work written inside package. json and npm build is a pre-defined script (not available to use directly).&lt;/p&gt;

&lt;p&gt;Resource&lt;br&gt;
&lt;a href="https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=2ahUKEwiAnbHGx_H9AhWexgIHHUu6AsIQFnoECAsQAQ&amp;amp;url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F43664200%2Fwhat-is-the-difference-between-npm-install-and-npm-run-build&amp;amp;usg=AOvVaw3u7JIq9QOJYXkUCxvrDsqn"&gt;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=2ahUKEwiAnbHGx_H9AhWexgIHHUu6AsIQFnoECAsQAQ&amp;amp;url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F43664200%2Fwhat-is-the-difference-between-npm-install-and-npm-run-build&amp;amp;usg=AOvVaw3u7JIq9QOJYXkUCxvrDsqn&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How do I comment out (multiline) in Rails?</title>
      <dc:creator>Alex Cosmas</dc:creator>
      <pubDate>Tue, 07 Mar 2023 14:16:18 +0000</pubDate>
      <link>https://dev.to/alex-cosmas/how-do-i-comment-out-multiline-in-rails-1p2i</link>
      <guid>https://dev.to/alex-cosmas/how-do-i-comment-out-multiline-in-rails-1p2i</guid>
      <description>&lt;p&gt;Easiest way out is to use &amp;lt;-- --&amp;gt;  to comment out your code as show below. &lt;br&gt;
&lt;code&gt;&amp;lt;!-- %= link_to "Make default", make_default_admin_state_path(state) % --&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sKSthP8u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mldt4p6prshe2olexz2h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sKSthP8u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mldt4p6prshe2olexz2h.png" alt="Image description" width="800" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learn more from this link. &lt;br&gt;
&lt;a href="https://stackoverflow.com/questions/8514946/how-do-i-comment-out-erb-in-rails"&gt;https://stackoverflow.com/questions/8514946/how-do-i-comment-out-erb-in-rails&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Dynamic Navigation - How to Render Nav-Items Dynamically in a Next App</title>
      <dc:creator>Alex Cosmas</dc:creator>
      <pubDate>Wed, 10 Nov 2021 13:31:07 +0000</pubDate>
      <link>https://dev.to/alex-cosmas/how-to-render-nav-items-dynamically-in-a-next-app-1gpc</link>
      <guid>https://dev.to/alex-cosmas/how-to-render-nav-items-dynamically-in-a-next-app-1gpc</guid>
      <description>&lt;p&gt;I came by this article by Caleb Olojo which I found quite useful. &lt;/p&gt;

&lt;p&gt;If you have a scenario where you need to render navigation links dynamically, you need to go through this link. &lt;/p&gt;

&lt;p&gt;He did a really great job explaining his process. &lt;/p&gt;

&lt;p&gt;Happy hacking and thanks again Caleb. &lt;/p&gt;

&lt;p&gt;Link: &lt;br&gt;
&lt;a href="https://www.freecodecamp.org/news/dynamic-navigation-in-nextjs/"&gt;https://www.freecodecamp.org/news/dynamic-navigation-in-nextjs/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.freecodecamp.org/news/author/calebolojo/"&gt;https://www.freecodecamp.org/news/author/calebolojo/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db</title>
      <dc:creator>Alex Cosmas</dc:creator>
      <pubDate>Thu, 28 Oct 2021 07:34:27 +0000</pubDate>
      <link>https://dev.to/alex-cosmas/browserslist-caniuse-lite-is-outdated-please-run-npx-browserslistlatest-update-db-591g</link>
      <guid>https://dev.to/alex-cosmas/browserslist-caniuse-lite-is-outdated-please-run-npx-browserslistlatest-update-db-591g</guid>
      <description>&lt;p&gt;While trying the run my server in NextJs, I encountered the below error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These following steps worked for me and I hope this help you out. &lt;/p&gt;

&lt;p&gt;Run the following commands, &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rm -rf node_modules/&lt;/li&gt;
&lt;li&gt;yarn&lt;/li&gt;
&lt;li&gt;yarn upgrade caniuse-lite browserlist&lt;/li&gt;
&lt;li&gt;restart your server &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you still encounter the same issue, try clearing your browser cache. &lt;/p&gt;

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