<?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: Thibault</title>
    <description>The latest articles on DEV Community by Thibault (@eyewritecode).</description>
    <link>https://dev.to/eyewritecode</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%2F283164%2F70f2a990-2733-4ed0-a004-9cfe762c8af7.jpg</url>
      <title>DEV Community: Thibault</title>
      <link>https://dev.to/eyewritecode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eyewritecode"/>
    <language>en</language>
    <item>
      <title>TIL: Returning to your previous Git branch</title>
      <dc:creator>Thibault</dc:creator>
      <pubDate>Thu, 10 Apr 2025 13:59:47 +0000</pubDate>
      <link>https://dev.to/eyewritecode/til-returning-to-your-previous-git-branch-e7e</link>
      <guid>https://dev.to/eyewritecode/til-returning-to-your-previous-git-branch-e7e</guid>
      <description>&lt;p&gt;If you're a developer, you've probably experienced the same frustration I have; constantly switching between branches can become tedious, especially when you're deep into work on branch X and suddenly need to make a quick fix on branches Y or Z.&lt;/p&gt;

&lt;p&gt;The usual workflow involves stashing or committing your current changes, checking out another branch, making your fixes, and then navigating back to your original branch to resume work.&lt;/p&gt;

&lt;p&gt;Branch names can be particularly cumbersome to type depending on your team's conventions. At my company, branch names follow a specific format that includes the type (feature, bugfix, hotfix), sprint version, ticket number, and a descriptive text. That's a lot to type repeatedly!&lt;/p&gt;

&lt;p&gt;While some terminal plugins offer branch name autocomplete functionality, I recently discovered something even faster and simpler.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Command
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout -
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! Just a hyphen.&lt;/p&gt;

&lt;p&gt;This immediately returns you to your previously checked out branch, saving countless keystrokes throughout your day.&lt;/p&gt;

&lt;p&gt;If you're reading this and have other Git productivity tips, please share them in the comments.&lt;/p&gt;

</description>
      <category>github</category>
      <category>productivity</category>
      <category>developer</category>
    </item>
    <item>
      <title>Disabled: true vs Readonly: true in Rails</title>
      <dc:creator>Thibault</dc:creator>
      <pubDate>Tue, 08 Aug 2023 21:00:35 +0000</pubDate>
      <link>https://dev.to/eyewritecode/disabled-true-vs-readonly-true-in-rails-418o</link>
      <guid>https://dev.to/eyewritecode/disabled-true-vs-readonly-true-in-rails-418o</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;What did i want to accomplish:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I had a rails form where i wanted one of the required fields to auto fill with some values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;% if &lt;/span&gt;&lt;span class="vi"&gt;@issue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;safe_attribute?&lt;/span&gt; &lt;span class="s1"&gt;'subject'&lt;/span&gt; &lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;%= f.text_field :subject, value: @issue.project.name, :size =&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:maxlength&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:required&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt; &lt;span class="sx"&gt;%&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;% end &lt;/span&gt;&lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The goal being, a user editing the form should not be able to edit this specific field.&lt;/p&gt;

&lt;p&gt;If you're like me, your first thought would be to add &lt;code&gt;disabled: true&lt;/code&gt; to the code. This disabled the field but it was triggering validation errors saying &lt;code&gt;the field can't be blank&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After reading about the &lt;code&gt;disabled&lt;/code&gt; option, i realized disabled elements are not submitted with the form(thus triggering validation) while &lt;code&gt;readonly&lt;/code&gt; as its name says it, cannot be modified by a user interaction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly" rel="noopener noreferrer"&gt;More info here&lt;br&gt;
&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;How did i accomplish it:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Replace &lt;code&gt;disabled: true&lt;/code&gt; with &lt;code&gt;readonly: true&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;% if &lt;/span&gt;&lt;span class="vi"&gt;@issue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;safe_attribute?&lt;/span&gt; &lt;span class="s1"&gt;'subject'&lt;/span&gt; &lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;%= f.text_field :subject, value: @issue.project.name, readonly: true, :size =&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:maxlength&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:required&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt; &lt;span class="sx"&gt;%&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;% end &lt;/span&gt;&lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Moral of the story: Should've taken HTML course seriously😉 &lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>html</category>
    </item>
    <item>
      <title>My interview with Degica(Komoju) Japan: An unfortunate end to a promising opportunity</title>
      <dc:creator>Thibault</dc:creator>
      <pubDate>Tue, 02 May 2023 04:46:10 +0000</pubDate>
      <link>https://dev.to/eyewritecode/my-experience-with-degica-an-unfortunate-end-to-a-promising-opportunity-3ec3</link>
      <guid>https://dev.to/eyewritecode/my-experience-with-degica-an-unfortunate-end-to-a-promising-opportunity-3ec3</guid>
      <description>&lt;p&gt;Degica is a leading provider of Japanese digital commerce solutions. One of their product is Komoju, a payment gateway platform that enables businesses to accept payments from customers in Japan and around the world.&lt;/p&gt;

&lt;p&gt;As a ruby developer with an interest in fintech, I was excited about the opportunity to interview with Degica. I went through several interview stages and was offered a position with the company, but unfortunately, my experience did not end as I had hoped.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Story:
&lt;/h3&gt;

&lt;p&gt;I went through all interview stages successfully the first being a call with some of the team members to discuss about my side projects, why i'm interested in Degica, etc..&lt;/p&gt;

&lt;p&gt;Second interview was more technical and was given access to a private repo where i had to fix failing tests which was followed with a discussion about other technical questions in a real case scenario. Ex: We have this bug in production, why do you think it's happening? how would you go about fixing it?, etc...&lt;/p&gt;

&lt;p&gt;Third interview was with the management team(CTO and COO) where we discussed salaries, expectations, starting date among other things. Everything was going well so far.&lt;/p&gt;

&lt;p&gt;I received an offer, negotiated my salary and came to a mutual agreement of my salary. I also asked if i could start in August(2022) and take July as a month off to which they agreed to.&lt;/p&gt;

&lt;p&gt;I resigned to my previous job, travelled back to japan(since i couldn’t before, because of covid restrictions) and met with some of the team members over lunch. I told them about my plan to leave japan for a while and that i would start working with Degica remotely for the first months. Everything still good.&lt;/p&gt;

&lt;p&gt;A few weeks later, i received an email from Degica asking about my starting date, my expectation for remote work, etc.. we jumped on a call where they explained to me that onboarding have to be done in JST time zone and that they would require me to work JST timezone which was never mentioned during the interview process since it clearly said that they work Full remote and hires everywhere in the world.&lt;/p&gt;

&lt;p&gt;We ended the call with them apologizing that it should have been cleared from the beginning and that they would extend my starting date and told me to think about it and let them know 2 weeks before my return to Japan.&lt;/p&gt;

&lt;p&gt;A few weeks later(25th July) i send them an email informing them that i'll be traveling back to japan so we can arrange onboarding. All crickets until 2nd of August when i received an email from someone in the administration department saying that my offer has been rescinded because i do not fit Degica culture for 2 reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;My resume had a Japanese address(which was my address btw) but this was an issue since i was not "residing" there at the time of application&lt;/li&gt;
&lt;li&gt;I delayed to reply to their email (mind you we had agreed to let them know 2 weeks ahead of my return to japan as per the last correspondence i had with them)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that became the end of what i thought was going to be an interesting journey in my career.&lt;/p&gt;

&lt;p&gt;I believe the reasons they gave shouldn't be enough to cancel a contract but as we say in Kinyarwanda; "Ntawe uburana n'umuhamba" so we move 🏎💨 &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Even though my experience with Degica was disappointing, i believe it's a good company where one can strive especially if you are a ruby engineer.&lt;/p&gt;

&lt;p&gt;And if you're an engineer working in Japan, i would advise you to quit your current job right after receiving the actual contract. not just the offer 🦾&lt;/p&gt;

&lt;p&gt;In the meantime, if your company is into fintech/payment or developer tools and are looking for a passionate and skilled engineer, I'm open to new opportunities and would love to hear from you.&lt;/p&gt;

</description>
      <category>career</category>
      <category>interview</category>
    </item>
    <item>
      <title>It sucks to be an intermediate engineer</title>
      <dc:creator>Thibault</dc:creator>
      <pubDate>Tue, 02 May 2023 04:09:27 +0000</pubDate>
      <link>https://dev.to/eyewritecode/it-sucks-to-be-an-intermediate-engineer-4396</link>
      <guid>https://dev.to/eyewritecode/it-sucks-to-be-an-intermediate-engineer-4396</guid>
      <description>&lt;p&gt;One of the goal i set this year(2019) was to change my career from agency to in-house dev. Reason being that, as an engineer, there's a certain level of seniority i don't see myself reaching if i keep working in this kind of environment.&lt;/p&gt;

&lt;p&gt;Working in an agency means you get to work on various projects, explore different stacks, etc... but once you're done with a project, it's usually up to the customer to take care of the rest.&lt;/p&gt;

&lt;p&gt;There are pros and cons of this depending on what you want and where you are in your dev life but it has reached a point where i'm sure that the agency life isn't taking me where i want to be in my career.&lt;/p&gt;

&lt;h2&gt;
  
  
  The journey to becoming a Senior Engineer
&lt;/h2&gt;

&lt;p&gt;A Senior dev can mean anything depending on who you ask but i like to think of it as &lt;em&gt;someone who's able to think ahead of time and notice possible flaws of a solution and decide accordingly&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As I embark on my journey towards becoming a Senior Engineer, I realize that it's not just about the technical skills. It's also about developing a certain mindset and approach to problem-solving.&lt;/p&gt;

&lt;p&gt;One of the things that I have found to be crucial in this journey is mentorship. It's important to find someone who has more experience and can guide you in your career. Unfortunately, in some environments, there might not be any senior or principal engineers to learn from. In that case, it's important to seek out mentorship from other sources such as online communities or attending conferences and meetups.&lt;/p&gt;

&lt;p&gt;Another important aspect is to focus on the long-term goals rather than just the immediate task at hand. As a Senior Engineer, one must have a broader perspective and think beyond the current project. It's important to understand the business goals and align them with the technical solutions being implemented.&lt;/p&gt;

&lt;p&gt;Communication is also crucial. As a Senior Engineer, you must be able to communicate effectively with different stakeholders including non-technical people. This means being able to explain technical concepts in simple terms that everyone can understand.&lt;/p&gt;

&lt;p&gt;In conclusion, becoming a senior engineer can be a challenging journey, especially when working in an environment with no senior or principal engineers. However, with persistence, dedication, and a willingness to learn and take on new challenges, you can still achieve your goal. &lt;/p&gt;

&lt;p&gt;Seeking mentorship, attending conferences and meetups, participating in online forums, and continuously expanding your knowledge and skills can all be valuable steps towards becoming a senior engineer.&lt;/p&gt;

&lt;p&gt;That being said, I would highly recommend &lt;a href="https://twitter.com/kaspth" rel="noopener noreferrer"&gt;Kasper's&lt;/a&gt; Discord &lt;a href="https://discord.gg/9pzDSyab" rel="noopener noreferrer"&gt;community&lt;/a&gt; for mid/intermediate ruby/rails engineer ;)&lt;/p&gt;

</description>
      <category>career</category>
      <category>ruby</category>
      <category>rails</category>
      <category>careerdevelopment</category>
    </item>
    <item>
      <title>Tracking Rails changed attributes</title>
      <dc:creator>Thibault</dc:creator>
      <pubDate>Fri, 01 May 2020 21:33:23 +0000</pubDate>
      <link>https://dev.to/eyewritecode/tracking-rails-changed-attributes-5gh8</link>
      <guid>https://dev.to/eyewritecode/tracking-rails-changed-attributes-5gh8</guid>
      <description>&lt;p&gt;On today's "&lt;em&gt;What did i want to achieve/how i achieved it&lt;/em&gt;", I had to fix this weird bug where one form field was triggering changes in the DB regardless of any user interaction.&lt;/p&gt;

&lt;p&gt;Take your typical rails form and add a map component(we deal a lot with location data at Georepublic). &lt;/p&gt;

&lt;p&gt;The bug was that, when a user edits one record's attribute and save, this would also update the location attributes(Latitude &amp;amp; Longitude) automatically by 1/1000000000 which isn't meaningful TBH but the issue was emailing subscribed users on such minimal changes!&lt;/p&gt;

&lt;p&gt;PS: &lt;em&gt;The purpose of this post is not fixing that value-change bug, but detecting and ignoring those small changes&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Meet &lt;a href="https://api.rubyonrails.org/classes/ActiveModel/Dirty.html" rel="noopener noreferrer"&gt;ActiveModel::Dirty&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rails comes with &lt;em&gt;ActiveModel::Dirty&lt;/em&gt; module that, as it's described, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Provides a way to track changes in your object in the same way as Active Record does.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This allows you to perform various operations whenever your attributes changes.&lt;/p&gt;

&lt;p&gt;Going back to my bug, i had to make sure the location changes were  "valid enough" to trigger our notification services.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Add callback
&lt;/h3&gt;

&lt;p&gt;Since our notification service is called on every update, it makes sense to check for these changes "before updating"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="ss"&gt;before_update: &lt;/span&gt;&lt;span class="n"&gt;ignore_small_changes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Track changes
&lt;/h3&gt;

&lt;p&gt;As mentioned earlier, this was a location attribute saved as a &lt;code&gt;geometry point&lt;/code&gt; in the db (cfr &lt;a href="https://github.com/rgeo/rgeo-activerecord" rel="noopener noreferrer"&gt;Rgeo&lt;/a&gt;) which basically mean that it's a collection of points a.k.a &lt;code&gt;[140.1250590699026,35.6097256061325]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Using Rails &lt;code&gt;ActiveModel::Dirty&lt;/code&gt; you can detect changes on any attribute using the following ways:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ApplicationRecord&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;
&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;address: &lt;/span&gt;&lt;span class="s2"&gt;"new address"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;address_changed?&lt;/span&gt; &lt;span class="c1"&gt;#returns true if user address has changed&lt;/span&gt;

&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;address_change&lt;/span&gt; &lt;span class="c1"&gt;# returns an array of [oldvalue, newvalue] or [nil] if there's no change&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Ignoring small changes
&lt;/h3&gt;

&lt;p&gt;Since we are dealing with a location point i.e &lt;em&gt;[lat,lng]&lt;/em&gt; calling &lt;code&gt;address_change&lt;/code&gt; on this would return a collection of this kind &lt;code&gt;[[lat, lng],[lat, lng]]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Thus, comparing changes(and ignoring small ones) in these two collections become a lot easier with &lt;a href="https://apidock.com/ruby/Array/zip" rel="noopener noreferrer"&gt;Ruby#Zip&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ignore_small_changes&lt;/span&gt;
  &lt;span class="k"&gt;unless&lt;/span&gt; &lt;span class="n"&gt;address_change&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;nil?&lt;/span&gt;
    &lt;span class="n"&gt;old_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;address_change&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;coordinates&lt;/span&gt;
    &lt;span class="n"&gt;new_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;address_change&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;coordinates&lt;/span&gt;
&lt;span class="c1"&gt;#Ignore changes if the difference is minimal&lt;/span&gt;
    &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;address&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;address_change&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;new_value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;old_value&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt; &lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;|&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="mf"&gt;0.00000001&lt;/span&gt;&lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;all?&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Although this was used to fix a bug in my case, you can always leverage these methods by using it as callbacks to performing different actions only when certain attributes have changed.&lt;/p&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Persisting flutter SnackBar until user interacts with it</title>
      <dc:creator>Thibault</dc:creator>
      <pubDate>Fri, 24 Apr 2020 13:28:12 +0000</pubDate>
      <link>https://dev.to/eyewritecode/persisting-flutter-snackbar-until-user-interacts-with-it-2583</link>
      <guid>https://dev.to/eyewritecode/persisting-flutter-snackbar-until-user-interacts-with-it-2583</guid>
      <description>&lt;p&gt;On today's "&lt;em&gt;What did i want to achieve/how i achieved it&lt;/em&gt;", i wanted to &lt;br&gt;
&lt;em&gt;Show a &lt;code&gt;SnackBar&lt;/code&gt; until a user interacts with it.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  How i achieved it
&lt;/h3&gt;

&lt;p&gt;Flutter's &lt;code&gt;SnackBar&lt;/code&gt; as described on its official documentation; is &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A lightweight message with an optional action which briefly displays at the bottom of the screen.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It comes with a &lt;code&gt;duration&lt;/code&gt; property that allows you to set how long you want the SnackBar to be visible. Values can be seconds, minutes, hours, days, etc...&lt;/p&gt;

&lt;p&gt;Point is, There's no way to tell when the user will interact with it. Leaving me with the only option of setting a longer &lt;strong&gt;duration&lt;/strong&gt;(read days) and hoping the user will interact with it within that time. Only then, it can disappear from the list of widgets.&lt;/p&gt;

&lt;p&gt;Key points being: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Setting a long duration&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="nl"&gt;duration:&lt;/span&gt; &lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;days:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Hiding the SnackBar when there's an interaction&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;Scaffold&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hideCurrentSnackBar&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Below is the code for the SnackBar widget. I'm using a &lt;code&gt;ListTile&lt;/code&gt; widget but anything with a callback would do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;SnackBar&lt;/span&gt; &lt;span class="n"&gt;sb&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SnackBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nl"&gt;duration:&lt;/span&gt; &lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;days:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="nl"&gt;content:&lt;/span&gt; &lt;span class="n"&gt;ListTile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nl"&gt;onTap:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;Scaffold&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hideCurrentSnackBar&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="s"&gt;"This is a title"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;style:&lt;/span&gt; &lt;span class="n"&gt;TextStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="nl"&gt;fontSize:&lt;/span&gt; &lt;span class="mf"&gt;24.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="nl"&gt;fontWeight:&lt;/span&gt; &lt;span class="n"&gt;FontWeight&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nl"&gt;subtitle:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s"&gt;"and i'm a subtitle"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nl"&gt;trailing:&lt;/span&gt; &lt;span class="n"&gt;Icon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Icons&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;check&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;_scaffoldKey&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;currentState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;showSnackBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sb&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>dart</category>
      <category>flutter</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
