<?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: Rishiraj Purohit</title>
    <description>The latest articles on DEV Community by Rishiraj Purohit (@ri5hirajp).</description>
    <link>https://dev.to/ri5hirajp</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%2F182496%2F8f88709c-5c5a-4e59-bda2-0607d582b419.jpeg</url>
      <title>DEV Community: Rishiraj Purohit</title>
      <link>https://dev.to/ri5hirajp</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ri5hirajp"/>
    <language>en</language>
    <item>
      <title>NextJs Job Board with Airtable as CMS</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Sat, 20 Aug 2022 17:06:35 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/nextjs-job-board-with-airtable-as-cms-5cn0</link>
      <guid>https://dev.to/ri5hirajp/nextjs-job-board-with-airtable-as-cms-5cn0</guid>
      <description>&lt;p&gt;Just made the source code for dynolist public.&lt;/p&gt;

&lt;p&gt;It's a #NextJs based job board that uses #airtable as CMS built with #TypeScript #tailwindcss&lt;/p&gt;

&lt;p&gt;Demo Site: &lt;a href="https://dynolist.vercel.app"&gt;https://dynolist.vercel.app&lt;/a&gt;&lt;br&gt;
Airtable Base: &lt;a href="https://airtable.com/shrYry2CNtlBV2Cgx"&gt;https://airtable.com/shrYry2CNtlBV2Cgx&lt;/a&gt;&lt;br&gt;
Source Code: &lt;a href="https://github.com/ri5h/dynolist"&gt;https://github.com/ri5h/dynolist&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  buildinpublic
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qvJ_5fXv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lhvuzadm0vomu1hcnoyh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qvJ_5fXv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lhvuzadm0vomu1hcnoyh.png" alt="Job Expanded" width="880" height="709"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Np7q6amh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c0p5n9vbza4sh77gke9o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Np7q6amh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c0p5n9vbza4sh77gke9o.png" alt="Home Page" width="880" height="729"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you like this and would love to hear more from me, you can connect with me on &lt;a href="https://twitter.com/ri5hirajp"&gt;https://twitter.com/ri5hirajp&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Create toggle with tailwind and alpinejs</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Tue, 12 Apr 2022 17:19:58 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/create-toggle-with-tailwind-and-alpinejs-4jb1</link>
      <guid>https://dev.to/ri5hirajp/create-toggle-with-tailwind-and-alpinejs-4jb1</guid>
      <description>&lt;p&gt;I know this is pretty dry read, but it's here in case someone or future me does a google search.&lt;/p&gt;

&lt;p&gt;If you have any question please let me know in comments&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Role --&amp;gt;
&amp;lt;div class="my-4 mx-auto"&amp;gt;
    &amp;lt;h2 class="text-xl font-bold text-gray-700 text-center w-full w-full text-center border-l-0 py-4"&amp;gt;I
        Want to:&amp;lt;/h2&amp;gt;
    &amp;lt;div class="flex flex-row justify-center w-full shadow-sm text-center" x-data="{ rvalue : 'student' }"&amp;gt;
        &amp;lt;label for="student" class="rounded-l-md shadow-sm border-gray-300 font-bold border w-full py-2 px-4"
                :class="{'bg-violet-800 text-white' : rvalue === 'student'}"&amp;gt;
            &amp;lt;div class="cursor-pointer"&amp;gt;
                &amp;lt;input x-model="rvalue"
                        type="radio"
                        id="student"
                        name="role"
                        value="student"
                        class="hidden"
                        checked /&amp;gt;Find a Teacher
            &amp;lt;/div&amp;gt;
        &amp;lt;/label&amp;gt;

        &amp;lt;label for="teacher" class="rounded-r-md border-gray-300 font-bold border border-gray-400 border-l-0 w-full py-2 px-4"
                :class="{'bg-violet-800 text-white' : rvalue === 'teacher'}"&amp;gt;
            &amp;lt;div for="teacher" class="cursor-pointer"&amp;gt;
                &amp;lt;input x-model="rvalue"
                        type="radio"
                        id="teacher"
                        name="role"
                        value="teacher"
                        class="hidden"&amp;gt;Work as a Teacher
            &amp;lt;/div&amp;gt;
        &amp;lt;/label&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How it works:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;We set a &lt;code&gt;x-data&lt;/code&gt; with a default value&lt;/li&gt;
&lt;li&gt;Each radio uses same &lt;code&gt;x-model&lt;/code&gt; and updates value if &lt;code&gt;checked&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;We dynamically set tailwindcss class based on value of our model&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thanks 😅&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Programming at school</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Sat, 09 Apr 2022 08:22:13 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/programming-at-school-4lbo</link>
      <guid>https://dev.to/ri5hirajp/programming-at-school-4lbo</guid>
      <description>&lt;p&gt;My first time programming was in a high-school classroom, on a piece of paper. I distinctly remember the teacher whose favorite way to give a task was by saying “Write a program..” to do X. It usually was a small program to teach you a topic and practice programming.&lt;/p&gt;

&lt;p&gt;For example, Write a program to see if a string is a palindrome.&lt;/p&gt;

&lt;p&gt;Then he’d spend a few minutes explaining what palindrome was and then some logic we can use. On a board, he’d write using a lot of shortcuts. The languages were java and some famous ones were, “SOPL(System.out.println)”, “WAP(write a program)”, and “ISR(InputStreamReader)”, “BR(BufferedReader)”. &lt;br&gt;
All questions were so similar that we were usually told to write the program ourselves up until ISR/BR and then he’ll explain the logic.&lt;/p&gt;

&lt;p&gt;This was very different than other classes, there was not a lot of information to digest and remember, just some logic to understand. It was almost like maths but without the need of so many formulae that you can’t even clearly see the logic. By the time I learned that maths also has logic that applies to similar problems it was too late for me.&lt;/p&gt;

&lt;p&gt;In those classroom days, every subject was about remembering stuff, but programming was different it was about coming up with a clever way to do stuff, so for someone like me who hated memorizing stuff just for exams falling in love with programming was, to quote Spock, only logical.&lt;/p&gt;

&lt;p&gt;This was before I had a computer or laptop, I had seen and used one in past at a friend’s house or in a lab at school but I had no way to go home and actually see if I can do this stuff on a computer, to actually see if it works.&lt;/p&gt;

&lt;p&gt;One day, the teacher and I had an argument. In his usual fashion, he asked us to write a program to print a pattern, it was somewhat like a triangle made of stars and because we have been practicing I knew we need to use 2 for-loops.&lt;/p&gt;

&lt;p&gt;After I was done writing the solution on paper, he came over, looked at it and said, it's wrong. I asked him why and he didn’t say why. This was my first experience with a shitty compiler before even knowing what a compiler was. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I must tell you before I continue, that this teacher was really one of the best ones I’ve had in my life, even though that interaction is bad, he actually motivated me a lot, guided me, and instilled a passion for programming and logic in me. For some reason, because he never cared about the whole program or whether he imported a library or not, most of his programs began with a statement, then a quick explanation of the topic, and then the logic that will come after ISR/BR. He taught me to focus only on the logic and not the actual semantics of the language or the tool, which to this day is the best tool I have in my arsenal.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Back to the argument. After the interaction with the shitty compiler, I tried to debug my code, going through iterations of 2 for-loops, trying to see what it’ll print (also, something that he taught me) and I could not figure out what was wrong. Since the teacher wasn’t going to tell and because we didn’t have open access to the lab, the next time I will be able to run it and test it would be during the next lab hour probably after 15 days, while we have to test some other program as well. This motivated me to figure out how I can find a way to run the program somewhere else.&lt;/p&gt;

&lt;p&gt;The first stop was finding the java installer disc and convincing a friend with a computer that it is a good idea to install it on his computer.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Sidenote: while we were installing it his father had already given around 20 dollars to an email claiming that he have won a lottery by a random draw of emails. (Another story idea: My father always taught me about scams and how to never trust someone when they say you are lucky)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It took a few hours to actually install it, this was before I knew we could google our errors, in fact, the internet was not readily available on this computer and you’d have to search it on a 2g Nokia phone, on a small screen and try to understand what it said. It was a nightmare.&lt;/p&gt;

&lt;p&gt;But we were able to install it and run a hello world program. We were overjoyed by something, that by today’s standards feels like a very simple thing to do, but I guess most students when they see setups/installers, missing DLLs, drivers for the first time also think it's a huge ordeal.&lt;/p&gt;

&lt;p&gt;I don’t remember if I ever ran the program and found what the error was, somehow it didn’t matter once I achieved something bigger like installing and running java. The program did haunt me for years and if I have to say what I was best at the end of high school, it was printing patterns in java. I gave it all and got very good at it. Today I know that I am motivated by things that I cannot do, or fail clearly. Somehow it pushes me to keep trying until I can do it so well that I don’t care about it anymore. This is the reason I fell in love with bouldering the first time I tried it.&lt;/p&gt;

&lt;p&gt;I guess that is the secret tool that I have been developing for years that helps me call myself very good at debugging and making things work. Because when I face errors, I try to see why and I keep trying again and again until I succeed.&lt;/p&gt;

&lt;p&gt;There are cons to this as well, which I learned to balance recently, like trying too hard without taking a break, not asking for help, etc. But I can say that over time the pros outweigh the cons and you have to learn to avoid those cons any way to be a successful team member.&lt;/p&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;
      &lt;div class="ltag__twitter-tweet__media"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3rwKgOPp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/media/FPKixPoXMAQZ36X.jpg" alt="unknown tweet media content"&gt;
      &lt;/div&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--3J0hrlh3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1397987321379803139/qTYwCYi5_normal.jpg" alt="Rishiraj Purohit profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Rishiraj Purohit
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        &lt;a class="mentioned-user" href="https://dev.to/ri5hirajp"&gt;@ri5hirajp&lt;/a&gt;
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ir1kO05j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      Action creates momentum and momentum provides &lt;a href="https://twitter.com/hashtag/motivation"&gt;#motivation&lt;/a&gt;&lt;br&gt;&lt;br&gt;don't wait for motivation to come to you, do something for an hour, and then tell me if you are not motivated enough to keep working on it.&lt;br&gt;&lt;br&gt;A thread 🧵 about fighting &lt;a href="https://twitter.com/hashtag/procastination"&gt;#procastination&lt;/a&gt;&lt;br&gt;&lt;br&gt;... 
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      08:29 AM - 31 Mar 2022
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1509447810093101062" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fFnoeFxk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-reply-action-238fe0a37991706a6880ed13941c3efd6b371e4aefe288fe8e0db85250708bc4.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1509447810093101062" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k6dcrOn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-retweet-action-632c83532a4e7de573c5c08dbb090ee18b348b13e2793175fea914827bc42046.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/like?tweet_id=1509447810093101062" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SRQc9lOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-like-action-1ea89f4b87c7d37465b0eb78d51fcb7fe6c03a089805d7ea014ba71365be5171.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  Footnotes:
&lt;/h2&gt;

&lt;p&gt;I always wanted to write about my life and how I became the developer I am today. But I am not good at writing so if you read this, please tell me what I could’ve done better. I do have many stories that I want to tell and would love to write them in a way people will enjoy.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>discuss</category>
      <category>career</category>
    </item>
    <item>
      <title>Enable unicode support in vscode terminal</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Sat, 29 May 2021 13:33:27 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/enable-unicode-support-in-vscode-terminal-2ph5</link>
      <guid>https://dev.to/ri5hirajp/enable-unicode-support-in-vscode-terminal-2ph5</guid>
      <description>&lt;p&gt;&lt;strong&gt;TLDR;&lt;/strong&gt; &lt;br&gt;
&lt;a href="https://dev.to/ri5hirajp/enable-unicode-support-in-vscode-terminal-2ph5#understanding-your-tools-properly"&gt;Jump to solution&lt;/a&gt; or keep reading to find out why Tech support always asks you to try turning it off and on again 😉.&lt;/p&gt;

&lt;p&gt;If you think the heading is not exactly correct, you are right but it's intentional. Let me explain 🤓.&lt;/p&gt;

&lt;p&gt;Today I woke up with a strong feeling about being tired of looking at question marks inside my vscode integrated terminal.&lt;/p&gt;

&lt;p&gt;Here is what it looked like 🥺,&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F83j8l8mrusoqsf399naa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F83j8l8mrusoqsf399naa.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And it didn't make sense because the same thing had icons inside iterm itself. So I knew that this is something to do with vscode. Obviously, I started my search with the problem I could identify, ie. &lt;code&gt;vscode terminal in not behaving properly&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After searching, going through forums, stackoverflow, github issues I could not figure out what was wrong.&lt;br&gt;
I may be tried a dozen different settings but nothing worked.&lt;/p&gt;

&lt;p&gt;So I did what any rational person who cares about this and is free all day would do😉. &lt;/p&gt;

&lt;h2&gt;
  
  
  Reset everything and re-configure it
&lt;/h2&gt;

&lt;p&gt;Now, this is very easy and well developed strategy of fixing things, which I learned over the years. &lt;/p&gt;

&lt;p&gt;The only important thing I want you to remember if you are ever in a problem you don't understand let alone know how to solve it, &lt;code&gt;you start by defining boundaries in your *closed* system and keep expanding them, while attempting easiest and non-destructive approach first&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Try&lt;/strong&gt;&lt;br&gt;
In this situation, first step would be closing the terminal and starting it again, then doing same with vscode.&lt;/p&gt;

&lt;p&gt;Did that and nothing happened😐, since I had already tweaked with settings, the next step was to reconfigure the powerlevel 10k theme.&lt;br&gt;
(ps. if you can't even see the theme working, maybe first make that working)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second Try&lt;/strong&gt;&lt;br&gt;
I copied the original file &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

cp ~/.p10k.zsh ~/.p10k.zsh.bkp
p10k configure


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

&lt;/div&gt;

&lt;p&gt;Going through the steps it asked me if I can see a lock,I said no hoping that it will do something about it 🤞🏻 but it just ignored the steps about icons and moved on 🥺. So it configured everything and now I just removed those icons from my iterm2 as well 🤦🏻‍♂️.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Third Try&lt;/strong&gt;&lt;br&gt;
Reading more about the problem, I thought maybe let's reinstall the p10k but wait going through the github page I see they mention the recommended font setting for vscode. I checked and I already had those font installed, then I checked the settings of my editor.&lt;/p&gt;

&lt;p&gt;oh, I was using &lt;code&gt;Fira Code&lt;/code&gt; as my editor font, I changed it to recommended one &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 "MesloLGS NF",

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

&lt;/div&gt;

&lt;p&gt;and restarted everything. &lt;/p&gt;

&lt;p&gt;It works 🎉🎉&lt;/p&gt;

&lt;p&gt;But now I had another problem, I don't want that font, I want &lt;code&gt;Fira Code&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Since, this post is about process of solving a problem and not the actual solution, let's take a minute to review.&lt;/p&gt;

&lt;p&gt;Now, we have few things clear.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The problem is definitely related to fonts.&lt;/li&gt;
&lt;li&gt;p10k and vscode are probably okay.&lt;/li&gt;
&lt;li&gt;There is a working solution available, we just need to find a similar but acceptable one.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ok, let's work on number 3.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding your tools properly
&lt;/h2&gt;

&lt;p&gt;The first thought came to me was, if vscode is made to be super configurable there must be some way to use different fonts. &lt;/p&gt;

&lt;p&gt;and there was, I quickly found that we can use a seperate font for terminal, let's try that.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

"editor.fontFamily": "Fira Code",
"terminal.integrated.fontFamily": "MesloLGS NF",


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

&lt;/div&gt;

&lt;p&gt;And, close and restart everything, just to be on safe side. Checking it again and it worked. &lt;/p&gt;

&lt;p&gt;Now we have recommended fonts inside terminal like it's supposed to and we have our favourite font inside the editor. (technically, whole thing is a editor but you know what I mean).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Aftermath&lt;/strong&gt;&lt;br&gt;
Just because you fixed the immediate problem doesn't mean you are done.&lt;br&gt;
You need to check what was affected by your solution. Now that can only be done if you understand the solution exactly. In this case, we do, so let's guess what could be affected.&lt;/p&gt;

&lt;p&gt;We changed the font on integrated terminal, which is inside vscode. The settings are also inside vscode. Since all changes are there probably nothing that comes from outside is broken.&lt;/p&gt;

&lt;p&gt;Also, we have a quick and non-destructive way to easily rollback if something do happen. &lt;/p&gt;

&lt;p&gt;Let's give a quick check to iterm2 itself, and it seems to work exactly as expected.&lt;/p&gt;

&lt;p&gt;Seems like everything is fine. Let's close this adventure and celebrate that we solved the problem. 🥳 🕺🏻.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed reading this post, while the problem was trivial I wanted to take my time and show you problem solving. It is very common approach, almost like an instinct, with some practice you can easily apply this to programming, os install, fixing you car, or almost anything else.&lt;/p&gt;

&lt;p&gt;Also, now you know, why it support asks you,&lt;br&gt;
&lt;a href="https://i.giphy.com/media/FspLvJQlQACXu/source.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/FspLvJQlQACXu/source.gif" alt="It Support GIF"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hey reader, I am a software engineer who loves learning new stuff and writing about it. I am currently learning AWS, NextJs, Typescript, Tailwind while building a product &lt;a href="https://twitter.com/dynolist" rel="noopener noreferrer"&gt;DynoList&lt;/a&gt; in public. You can follow the journey from day 1.&lt;/p&gt;

&lt;p&gt;Or &lt;a href="https://twitter.com/ri5hirajp" rel="noopener noreferrer"&gt;follow me on twitter&lt;/a&gt; and you will know whenever I add something interesting here or there 😁&lt;/p&gt;

&lt;p&gt;Have a great day ahead.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Enumeration in PHP</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Wed, 10 Feb 2021 17:45:56 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/enumeration-in-php-1ob</link>
      <guid>https://dev.to/ri5hirajp/enumeration-in-php-1ob</guid>
      <description>&lt;p&gt;&lt;strong&gt;tldr;&lt;/strong&gt; php 8.1 will introduce enum as a new data type derived from classes and will behave like objects.&lt;/p&gt;

&lt;p&gt;Enum syntax in PHP&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;enum&lt;/span&gt; &lt;span class="nc"&gt;Status&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Draft&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Published&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Archived&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;long gone are the days of php being mocked for the missing features. The world of php is catching up with new features introduced every release.&lt;/p&gt;

&lt;p&gt;In php 8.1 one of the most interesting feature being added to the language is the data type called enum (or Enumeration)&lt;/p&gt;

&lt;p&gt;enum have existed for a long time in other languages where it acts as a set of possible values grouped together in a structured way such that type safety can be guaranteed.&lt;/p&gt;

&lt;p&gt;For example, a model called post might have a field called status which can be supplied a string value from the code calling the function &lt;code&gt;setStatus(string $status)&lt;/code&gt;. Generally we would like to perform some validation as to make sure the status is one that makes sense.&lt;/p&gt;

&lt;p&gt;While there are many ways to do just that starting from a function checking the value using an &lt;code&gt;in_array($status, self::VALID_STATUS_ARRAY)&lt;/code&gt; to having a pojo class called &lt;code&gt;Status&lt;/code&gt; with methods to return status that you want to pass to the model.&lt;/p&gt;

&lt;p&gt;But the most widely accepted way is to have a specific data type called enum as shown above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;php 8.1&lt;/strong&gt; finally is in last stages of the &lt;a href="https://rishiraj.dev/post/new-features-in-php-8_1-enums/#--rfc-details"&gt;RFC&lt;/a&gt; that adds just that to the language along with few helpful functions like &lt;a href="https://rishiraj.dev/post/new-features-in-php-8_1-enums/#--new-enum_exists-function"&gt;&lt;code&gt;enum_exists&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enums will behave like standard php objects and will work with functions like &lt;code&gt;is_a&lt;/code&gt;, &lt;code&gt;get_class&lt;/code&gt; and will have magic methods like &lt;code&gt;__CLASS__&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I hope you liked this post, &lt;a href="https://rishiraj.dev/post/new-features-in-php-8_1-enums"&gt;I wrote about enum in details here&lt;/a&gt; where I go deep into the explaining all available features in php enum along with some limitations and restrictions.&lt;/p&gt;

&lt;p&gt;I also list possible ways to use enum today in your code using some well known packages.&lt;/p&gt;

&lt;p&gt;How do you feel about enum finally coming to php and do you think there are still some features you would like to be added to the language? let me know in the comments.&lt;/p&gt;

</description>
      <category>programming</category>
    </item>
    <item>
      <title>Server Side Public Licence</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Sun, 07 Feb 2021 13:01:51 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/server-side-public-licence-3dmg</link>
      <guid>https://dev.to/ri5hirajp/server-side-public-licence-3dmg</guid>
      <description>&lt;p&gt;If you have not heard, elasticsearch recently updated their licence to one based on sspl (server side public licence) created and adopted by mongoDB.&lt;br&gt;
&lt;a href="https://elastic.co/blog/licensing-change"&gt;https://elastic.co/blog/licensing-change&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you like watching more than reading, I talk about this in my latest video.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/xwQvfdSZWOw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt; 🤔&lt;/p&gt;

&lt;p&gt;While there are many reasons for it and most of them are a good read available here: &lt;a href="https://www.elastic.co/pricing/faq/licensing"&gt;https://www.elastic.co/pricing/faq/licensing&lt;/a&gt; but the most important reason is believed to be limiting the abuse by cloud providers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You may not provide the products to others as a managed service.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, this means while as a single user or a company the change in licence should not affect you. It only affects those companies who provide elasticsearch as a managed service.&lt;/p&gt;

&lt;p&gt;They go in more details about how AWS is a pain in the *** open-source on their blog here: &lt;a href="https://www.elastic.co/blog/why-license-change-AWS"&gt;https://www.elastic.co/blog/why-license-change-AWS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The result&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Most cloud providers have contract/agreement with elasticsearch and will be able to provide it as a service.&lt;/li&gt;
&lt;li&gt;Amazon, on the other hand, created a fork of the lastest release and will work on creating a new product managed by them.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You might think why Amazon would do such thing but turns out they did try to answer this in very details when they specifically talked about elasticsearch licence changes on their blog available here: &lt;a href="https://aws.amazon.com/blogs/opensource/stepping-up-for-a-truly-open-source-elasticsearch/"&gt;https://aws.amazon.com/blogs/opensource/stepping-up-for-a-truly-open-source-elasticsearch/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By the way if you are more interested in weather sspl can be called as open-source licence you may find the blog post by open source initiative interesting: &lt;a href="https://opensource.org/node/1099"&gt;https://opensource.org/node/1099&lt;/a&gt;&lt;/p&gt;

</description>
      <category>techtalks</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Get composer outdated packages w/o install</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Mon, 28 Sep 2020 23:02:40 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/get-composer-outdated-packages-w-o-install-4f7o</link>
      <guid>https://dev.to/ri5hirajp/get-composer-outdated-packages-w-o-install-4f7o</guid>
      <description>&lt;p&gt;Recently, I wanted to get a list of direct dependencies in our php source code that are outdated.&lt;br&gt;
&lt;a href="https://github.com/rishirajpurohit/composerOutdatedNoInstall/blob/master/outdated.py"&gt;final result&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The initial thought was running dependabot, while it opens a &lt;code&gt;pr&lt;/code&gt; for each minor upgrades, I thought it would be cool to see how I can do the same.&lt;/p&gt;

&lt;p&gt;Initially, I found the composer command for the same, we can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer outdated --direct -f json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;To get a list of outdated packages in a nice format 😍&lt;/p&gt;

&lt;p&gt;The next thought was to put it behind a service or have it on a server, which brought me to the next hurdle.&lt;/p&gt;

&lt;p&gt;I do not want to install the packages, or have post-install commands runs in a server that I won't be using for anything else.🤷🏻‍♂️&lt;/p&gt;

&lt;p&gt;🤔 How do we get a list of outdated packages without installing the packages, and do we even need composer for this?&lt;/p&gt;

&lt;p&gt;After some thought, I decided to use &lt;code&gt;composer.json&lt;/code&gt; and &lt;code&gt;composer.lock&lt;/code&gt; to get some info and find an API for package information from the packagist.🤞🏻&lt;/p&gt;

&lt;p&gt;The API is more of a url with json extension🤫. For example, to get package details for &lt;code&gt;monolog/monolog&lt;/code&gt; you can just append &lt;code&gt;.json&lt;/code&gt; at the end of the url. &lt;br&gt;
The url in packagist are pretty well formatted so for a package like &lt;code&gt;monolog/monolog&lt;/code&gt; the url becomes: &lt;code&gt;https://packagist.org/packages/monolog/monolog.json&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, equipped with constraints, current version and package information, it was time to write a script.🤓&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 1: Parsing the files
&lt;/h2&gt;

&lt;p&gt;I used &lt;code&gt;json&lt;/code&gt; library available in python to get the data out of those files.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Reading metadata from packagist
&lt;/h2&gt;

&lt;p&gt;I used the repo subdomain, but direct url works as well.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
 
&lt;h2&gt;
  
  
  Step 3: Working with &lt;em&gt;semantic versions&lt;/em&gt; 😯
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://semver.org/"&gt;Semantic Versioning&lt;/a&gt;🤓&lt;/li&gt;
&lt;li&gt;&lt;a href="https://python-semanticversion.readthedocs.io/en/latest/reference.html"&gt;Library Used, readthedocs.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.npmjs.com/misc/semver.html"&gt;semver package at npm for NpmSpec&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was the trickiest part because we need to handle different cases and there were some packages which referenced to git commit😒. But after some try-catch and playing around with &lt;code&gt;semantic-version&lt;/code&gt; library I was able to get the parsing handled. Once done with parsing, comparing versions and preparing the final result was a breeze.🥳&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; I had to switch to class &lt;code&gt;NpmSpec&lt;/code&gt; instead of &lt;code&gt;SimpleSpec&lt;/code&gt; to better handle the versions. This library uses the semantic version defined by &lt;a href="https://docs.npmjs.com/misc/semver.html"&gt;npm-semver&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While the script is just a starting point, it was quite fun to write and maybe I'll expand it to make it object oriented add test cases along with other bells and whistles 😉&lt;/p&gt;

&lt;p&gt;Hope you enjoyed reading it, and it provided you nice tools 💪🏻 to use when dealing with semantic versioning in your code. Let me know in comments if I should have explained the process differently.&lt;/p&gt;

&lt;p&gt;Make sure you follow, clap, throw some unicorns at me and share this post with your friends, family, neighbours and everyone you meet on road. 😄&lt;/p&gt;

</description>
      <category>php</category>
      <category>python</category>
      <category>productivity</category>
    </item>
    <item>
      <title>9 hidden gems of shell that beginners don’t know</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Sun, 21 Jun 2020 17:52:16 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/9-hidden-gems-of-shell-that-beginners-don-t-know-1825</link>
      <guid>https://dev.to/ri5hirajp/9-hidden-gems-of-shell-that-beginners-don-t-know-1825</guid>
      <description>&lt;p&gt;While I ran these commands in macos using iterm2, the tricks are valid for most of the terminals out there.&lt;/p&gt;

&lt;p&gt;Quick side-note: My username is rishirajpurohit but it will be your username for below examples/outputs/images when you run any of these commands.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;$PATH&lt;/strong&gt; variable&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your shell uses a variable called path to store all the directory and places &lt;strong&gt;separated by colon&lt;/strong&gt; where it can look for a program to run.&lt;/li&gt;
&lt;li&gt;You can update the path dynamically to add or replace a directory when running a program&lt;/li&gt;
&lt;li&gt;It can also help in finding the directory of certain programs.&lt;/li&gt;
&lt;li&gt;Most programs, if not done automatically, will require you to add their executable to the path so that you can directly use them from shell.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bWIcOgJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9pgnnj2jqsbw1b17dzhh.png" alt="demo path variable in bash"&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Which&lt;/strong&gt; program&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sometimes you want to see which version or what program will run when you type a command. For example, I have few versions of php set up in my system and sometimes certain scripts require certain version of php.&lt;/li&gt;
&lt;li&gt;Using which I can quickly see the path of the php that will run my script and change it if needed using the $PATH variable mentioned above.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zrGJqRsq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t21v2vc0jqdsvj899mvj.png" alt="demo which program in bash"&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;~&lt;/strong&gt; (tilde character) : Tilde is basically your home directory or a shorthand for &lt;code&gt;/Users/rishirajpurohit&lt;/code&gt;. So to navigate to &lt;code&gt;Sites&lt;/code&gt; folder in your home directory you can just use &lt;code&gt;~/Sites&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3Ba9LYLO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/93ytl7zicnp002yipeos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3Ba9LYLO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/93ytl7zicnp002yipeos.png" alt="Demo tilde character in bash"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;-&lt;/strong&gt; (dash character) : A dash represents the last place you were before coming to current directory and is very useful when you are jumping back and forth between directories.&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LMYUzmTA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/d2f1t4k9qvm54ed15mqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LMYUzmTA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/d2f1t4k9qvm54ed15mqj.png" alt="Demo dash character in bash"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ls with path&lt;/strong&gt; : &lt;code&gt;ls&lt;/code&gt; takes a path as an argument and can list the contents of the path you provide, so you don’t have to cd to a folder to see its contents. By default the path is set to &lt;code&gt;.&lt;/code&gt; or your current directory.&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9oCfuTDP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yd9olxtq8nbpsx0prkfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9oCfuTDP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yd9olxtq8nbpsx0prkfy.png" alt="Demo ls with path in bash"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using &amp;lt; for Input&lt;/strong&gt; : Not commonly used but sometimes a program might need large input and you may have it saved it in a file, you can use the &amp;lt; character to pass the contents of the file as input to the program.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using &amp;gt; for Output&lt;/strong&gt; : A lot of times we want to save the output of a program to a file instead of displaying it in a prompt. For example, &lt;code&gt;python fetch_results.py &amp;gt; ~/Sites/carz/sample_cars.json&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Using &amp;gt;&amp;gt; for Append&lt;/strong&gt; : Continuing the example from above, lets says you want to run the command every few hours to fetch additional data, and want to just append the result to the same file, you can use &amp;gt;&amp;gt; character. For example, &lt;code&gt;python fetch_results.py &amp;gt;&amp;gt; ~/Sites/carz/sample_cars.json&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ttyVQlOi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m7xc777oon91p2n1vs0r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ttyVQlOi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m7xc777oon91p2n1vs0r.png" alt="Demo io stream use in bash"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;| (pipe character)&lt;/strong&gt; : One of the most commonly used tricks to connect or chain programs when you want the output of a program as an input of another program. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To find all files containing .py : &lt;code&gt;ls | grep .py&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;To find a command you ran in the past: &lt;code&gt;history | grep docker&lt;/code&gt; will return the command.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xn7ZKE3t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wpeo5jk9iqteaq5ikukc.png" alt="Demo pipe character in bash"&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thank you for reading and comment below your tools and tricks that you learned over time and hope that you knew when starting.&lt;/p&gt;

&lt;p&gt;Also give claps, shouts, unicorns or anything else if you liked the post.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>productivity</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Arrow Functions in PHP</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Mon, 26 Aug 2019 16:34:00 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/arrow-functions-in-php-3c2c</link>
      <guid>https://dev.to/ri5hirajp/arrow-functions-in-php-3c2c</guid>
      <description>&lt;p&gt;Inspired from Javascript's arrow function, I guess? &lt;br&gt;
&lt;a href="https://hacks.mozilla.org/2015/06/es6-in-depth-arrow-functions/"&gt;es6-in-depth-arrow-functions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The short closures called arrow functions are one of the long due functionalities that &lt;code&gt;PHP 7.4&lt;/code&gt; will bring. It is proposed by Nikita Popov, Levi Morrison, and Bob Weinand and you can &lt;a href="https://wiki.php.net/rfc/arrow_functions_v2"&gt;read the original RFC here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;em&gt;Quick Example taken from &lt;a href="https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php"&gt;Doctrine DBAL&lt;/a&gt;&lt;/em&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="c1"&gt;//old way&lt;/span&gt;
&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;existingSchemaPaths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;array_filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$paths&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$names&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;in_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$names&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;//new way with arrow function&lt;/span&gt;
&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;existingSchemaPaths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;array_filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$paths&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;in_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$names&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Let's go through the rules
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;fn&lt;/code&gt; is a keyword and not a reserved function name.&lt;/li&gt;
&lt;li&gt;It can have only 1 expression and that is the return statement.&lt;/li&gt;
&lt;li&gt;No need to use &lt;code&gt;return&lt;/code&gt; and &lt;code&gt;use&lt;/code&gt; keywords.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$this&lt;/code&gt; variable, the scope and the LSB scope are automatically bound.&lt;/li&gt;
&lt;li&gt;You can type-hint the arguments and return types.&lt;/li&gt;
&lt;li&gt;You can even use references &lt;code&gt;&amp;amp;&lt;/code&gt; and &lt;a href="https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list"&gt;spread operator&lt;/a&gt; &lt;code&gt;...&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Few examples
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="c1"&gt;//scope example&lt;/span&gt;
&lt;span class="nv"&gt;$discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;array_map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$item&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nv"&gt;$discount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$items&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


&lt;span class="c1"&gt;//type hinting&lt;/span&gt;
&lt;span class="nv"&gt;$users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;array_map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;User&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$users&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;//spread operator&lt;/span&gt;
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;complement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;callable&lt;/span&gt; &lt;span class="nv"&gt;$f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nv"&gt;$args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nv"&gt;$f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;...&lt;/span&gt;&lt;span class="nv"&gt;$args&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//nesting&lt;/span&gt;
&lt;span class="nv"&gt;$z&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$fn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nv"&gt;$y&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nv"&gt;$z&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//valid function signatures&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nv"&gt;$rest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$rest&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Future Scope
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Multi-line arrow functions&lt;/li&gt;
&lt;li&gt;Allow arrow notation for real functions inside a class.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;
&lt;span class="c1"&gt;//valid now&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Test&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$fn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nv"&gt;$fn&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// object(Test)#1 { ... }&lt;/span&gt;

        &lt;span class="nv"&gt;$fn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;var_dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nv"&gt;$fn&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Error: Using $this when not in object context&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//maybe someday in future&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Test&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="nv"&gt;$foo&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="nv"&gt;$bar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="n"&gt;getFoo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;foo&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="n"&gt;getBar&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


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

&lt;/div&gt;



&lt;h2&gt;
  
  
  My Favorite takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Callbacks can be shorter&lt;/li&gt;
&lt;li&gt;No need for &lt;code&gt;use&lt;/code&gt; keyword, you can access variables.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Let me know what do you think about these updates and what are your favorite takeaways from this?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;till next time, &lt;a href="https://rishirajpurohit.in"&gt;rishiraj purohit&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>programming</category>
    </item>
    <item>
      <title>Should freelance be considered as experience?</title>
      <dc:creator>Rishiraj Purohit</dc:creator>
      <pubDate>Tue, 20 Aug 2019 19:26:05 +0000</pubDate>
      <link>https://dev.to/ri5hirajp/should-freelance-be-considered-as-experience-4452</link>
      <guid>https://dev.to/ri5hirajp/should-freelance-be-considered-as-experience-4452</guid>
      <description>&lt;p&gt;&lt;strong&gt;TLDR;&lt;/strong&gt; I did freelance before my first job so do I have 2.8 years of experience or 6 years?&lt;/p&gt;

&lt;p&gt;I am from India and way it works here is most of the student go to high-school, then an engineering college and then get a job.&lt;/p&gt;

&lt;p&gt;The problem is I fell in love with programming when I started high-school and while I was going through the studies and college, I used to write code and learn things.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fast-Forward to college:&lt;/strong&gt;&lt;br&gt;
when I found out that I can make money by writing code or creating websites, so I've created websites for local businesses, plugins and themes for WordPress, SAAS software products and whatnot. This is what I consider as my experience working long nights daily and continuously delivering projects for 4 years.&lt;/p&gt;

&lt;p&gt;During my college, I've also started an e-commerce store for technical books and ran that company for 2 years. &lt;/p&gt;

&lt;p&gt;During the last year of my college, I got very involved in helping my college with technical solutions like websites, hackathons, and android apps. This helped me convince the faculties to allow me to work full time as a software developer in a legit company before graduating. (not an internship, but an actual job where I was expected to perform similar to people with 2 years of experience)&lt;/p&gt;

&lt;p&gt;I have been working for the last 2.8 years and I graduated from my college 2 years ago.&lt;/p&gt;

&lt;p&gt;The reason I am writing all this is that I am actively looking for a job and want to ask your help on how to respond for the look on recruiter's face saying "&lt;code&gt;numbers don't add up&lt;/code&gt;".&lt;/p&gt;

&lt;p&gt;Whenever I am put with junior developers I feel I can do a lot better but every time I am out looking for a job, it becomes very hard to explain how I actually have the skills that I claim. &lt;/p&gt;

&lt;p&gt;Every time I fill a form and write 2-3 years as experience, I feel a bit sad.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ending Note:&lt;/strong&gt;&lt;br&gt;
I strongly believe that during freelance I did not only gain the skills of software development but I also learned end to end delivery of products and even some business skills. People paid me to build software for them, how is that not a legit experience?&lt;/p&gt;

&lt;p&gt;I've been coding for more than 6 years now and still have to write that I only have 2-3 years of experience, does that feel right to you?&lt;/p&gt;

&lt;p&gt;What can I do to explain this better? Should I just say I am 2.8 years experienced?&lt;/p&gt;

&lt;p&gt;PS. I don't like writing 2.8 for 2 yrs and 8 months as mathematically it means 80% of a year is passed but in reality, it's only around 66-67%. But that is a topic for another discussion as of now let's leave it to &lt;code&gt;Numbers don't add up.&lt;/code&gt;&lt;/p&gt;

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