<?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: Darshan-Bajeja</title>
    <description>The latest articles on DEV Community by Darshan-Bajeja (@darshanbajeja).</description>
    <link>https://dev.to/darshanbajeja</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%2F683027%2Fb5885cbb-c7d3-402c-8675-003d2bdd421a.png</url>
      <title>DEV Community: Darshan-Bajeja</title>
      <link>https://dev.to/darshanbajeja</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/darshanbajeja"/>
    <language>en</language>
    <item>
      <title>Cricket Score Display App: #1 Intro and the server</title>
      <dc:creator>Darshan-Bajeja</dc:creator>
      <pubDate>Thu, 24 Mar 2022 17:45:33 +0000</pubDate>
      <link>https://dev.to/darshanbajeja/cricket-score-display-app-1-intro-and-the-server-3ffo</link>
      <guid>https://dev.to/darshanbajeja/cricket-score-display-app-1-intro-and-the-server-3ffo</guid>
      <description>&lt;p&gt;A blog post after a long time!&lt;/p&gt;

&lt;p&gt;Being Indians, me and my friends love playing cricket in our streets and colonies. I would invest 2 hours daily playing cricket with my friends in the evening. And why do I call that an investment? Because that's the only time where I do some physical stuff to keep myself fit &lt;strong&gt;as a developer!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Recently we as friends have decided to play tournaments. Each one of us would choose a team, select few players from that team for the tournament, usually 5, and then play for our team.&lt;/p&gt;

&lt;p&gt;We wanted to log the data of tournaments so if we want to refer it in future we can do that. Or even when tournament is going on, we need to see points and total runs and stuff like that to know who plays the semi finals and the final match. So I took this as an opportunity to learn a new tech. I told them that I would build a PWA, where we can add players, make their teams, create tournaments and add matches and squads to those tournaments. We would also be able to see results of matches and points table and some similar stuff. &lt;/p&gt;

&lt;p&gt;So in this series I would like to document my journey building this PWA. &lt;br&gt;
But have I done anything till now? Yes. I have kind of planned in my mind what I would like to do in this app, and have chosen the techonologies that I would like to use. I chose to use Firebase for the backend, and React Ionic for the frontend. This is going to be my first app built with Ionic. Also I wanted to learn firebase by building this app. I have built few apps with firebase but never did it myself, I have only taken few tutorials on firebase. &lt;br&gt;
But even though I want to learn firebase by building this PWA, I don't want to dedicate much time or money in this, because this is something which I and only 5 of my friends will be using. But how do I make sure that only we can add data to the app? What if someone else, who lands on my website tries to do something fishy? There are two ways to do that: &lt;br&gt;
1) Using security rules for database &lt;br&gt;
2) Adding a master password that only me and my friends know&lt;br&gt;
But I am not planning to add authentication to the app, so there's no using of security rules as well. Now for option 2, I would have to use cloud functions in firebase, but it is a paid feature as of now. And as I mentioned before, I don't want to pay for anything for this app. &lt;/p&gt;

&lt;p&gt;So I have done something for that already. I have set up a very simple express js server, with only 1 post route that checks for the master password, which I will request everytime I try to add or edit something.&lt;/p&gt;

&lt;p&gt;I have already deployed it to Heroku (as I told you I don't want to pay anything for this). &lt;/p&gt;

&lt;p&gt;Also this is my second app where I am using gitlab for VCS. Otherwise mostly I use Github only.&lt;/p&gt;

&lt;p&gt;I have also setup a firebase project and generated the ionic project.&lt;/p&gt;

&lt;p&gt;So that's what I have done till now. Next I am planning to document and plan my database and some other stuff because the database structure will be a bit complex. Therefore, I can code easily. There's no meaning of designing a mockup or wireframe because I will be directly using components from Ionic.&lt;/p&gt;

&lt;p&gt;So as I am done with the documentation, I will be back with another post. &lt;/p&gt;

&lt;p&gt;Thank you for reading this post and hope you will enjoy my journey of building this app!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python Doesn't Care About The Extension!</title>
      <dc:creator>Darshan-Bajeja</dc:creator>
      <pubDate>Thu, 09 Dec 2021 16:36:17 +0000</pubDate>
      <link>https://dev.to/darshanbajeja/python-doesnt-care-about-the-extension-309g</link>
      <guid>https://dev.to/darshanbajeja/python-doesnt-care-about-the-extension-309g</guid>
      <description>&lt;p&gt;Once upon a time (don't go away, this isn't a story!), I wrote a python script to generate random phone numbers to as mock data for testing my express API (Yes Python helping JS!). I thought that it was a very simple script, so why not write it out in notepad instead of something like VS Code or PyCharm. So I wrote it down, and by mistake I saved it as text file and not python file (main.txt), and I even ran it. So as a dev, very quickly I opened up Powershell, just wrote &lt;code&gt;cd Des&lt;/code&gt;, hit tab and enter. Then just wrote &lt;code&gt;python m&lt;/code&gt;, and a quick tab and enter and to my surprise I got an error. Now you might say that, ok you ran a text file with python, what else do you expect except an error. But guys, the error wasn't that, the error was related to a bug in my script! And as I mentioned, I just typed &lt;code&gt;python m&lt;/code&gt; and hit tab, it showed &lt;code&gt;python main.txt&lt;/code&gt;, and I was surprised with that. Python running a text file!&lt;/p&gt;

&lt;p&gt;Then I thought Programming languages just see the text in the file and don't care about the extension. So I tried a similar program in Java, and it didn't work... So I thought may be its just with Python. Now I didn't try it out with other languages, but I am sure that Python doesn't care about your file extension. I tried the same with &lt;code&gt;.mp3&lt;/code&gt; file as well and it worked!!!&lt;/p&gt;

&lt;p&gt;So let's try it now:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open up the simplest text editor possible on your machine, that is Notepad on Windows, TextEdit on MacOS, or Gedit, Mousepad, or Text Editor on Linux.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Write any python code inside it. I will write the code to take a number as input and print out its square.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F5szq2fgu91ds8fm65kvu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5szq2fgu91ds8fm65kvu.png" alt="Python code..." width="621" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now let's save this file, but give any other extension except .py or .pyc as they are for Python specifically. I will give it the extension of sqlite3. (Yooo!)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fxicrbf22ms10xk9bi01t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fxicrbf22ms10xk9bi01t.png" alt="Python in SQL" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Finally use any CLI to run the code...
&lt;img src="https://media2.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%2Fro7l09oq6ab9wpoxlp0t.png" alt="Python code runs with sqlite3 extension!" width="800" height="156"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And it works....&lt;/p&gt;

&lt;p&gt;Now I don't have a good conclusion for this post, but I know you enjoyed the content, and liked the fun fact...!!&lt;/p&gt;

&lt;p&gt;And yes, if any of you pythonistas know the reason for this, please put down in comments below!&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>facts</category>
    </item>
    <item>
      <title>LERN GQL WITH ME: Schema Definition Language</title>
      <dc:creator>Darshan-Bajeja</dc:creator>
      <pubDate>Sun, 31 Oct 2021 16:32:05 +0000</pubDate>
      <link>https://dev.to/darshanbajeja/lern-gql-with-me-schema-definition-language-24h1</link>
      <guid>https://dev.to/darshanbajeja/lern-gql-with-me-schema-definition-language-24h1</guid>
      <description>&lt;p&gt;(Examples taken from howtographql)&lt;/p&gt;

&lt;p&gt;Welcome to the second part of Learn GraphQL With Me. In this post we will be learning about some core concepts related to GraphQL. These concepts are language independent, so it means that you do not need to know any particular language to understand these, as these are GraphQL specific, and once understood can be implemented in any language.&lt;/p&gt;

&lt;p&gt;One thing to keep in mind here is that as GraphQL is different from REST and SOAP, you need to try to understand this little differently as GraphQL has its own specific concepts, which are independent of any other type of API.&lt;/p&gt;

&lt;p&gt;So let's finally begin learning GraphQL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Schema Definition Language (SDL)
&lt;/h2&gt;

&lt;p&gt;GraphQL has its own type system for defining schemas, like we do for modelling the database tables (for SQL) and documents (for NoSQL). This is called the SDL or the Schema Definition Language. &lt;/p&gt;

&lt;p&gt;So this is how you define schemas or types in GraphQL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;!&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;!&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how we have &lt;code&gt;!&lt;/code&gt; after the data types String and Int. This tells that 'name' and 'age' are compulsory. If we just wrote name as &lt;code&gt;name: String&lt;/code&gt;, this would have meant that it is not compulsory that Person has a name.&lt;/p&gt;

&lt;p&gt;Let's also add a Post type to our schema:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Post&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;!&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now what if we want to have relations between the Post and the Person type. We can now use Person and Post as a data type, like we use String, Int. So let's define an author field, which is of type Person.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Post&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;!&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;!&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells that a Post will have an author who will be a Person. But we also want to say that a Person can write many posts, so how do we do that. Let's add a posts field to Person type which will be an array of type Post.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;!&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;!&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;!]!&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how we have ! after Post as well as after ], this tells that the array is compulsory as well as there has to be some data of type Post inside it.&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>typescript</category>
    </item>
    <item>
      <title>LEARN GQL WITH ME: Introduction to GQL and The Series</title>
      <dc:creator>Darshan-Bajeja</dc:creator>
      <pubDate>Thu, 28 Oct 2021 15:58:38 +0000</pubDate>
      <link>https://dev.to/darshanbajeja/learn-gql-with-me-introduction-to-gql-and-the-series-1o5b</link>
      <guid>https://dev.to/darshanbajeja/learn-gql-with-me-introduction-to-gql-and-the-series-1o5b</guid>
      <description>&lt;p&gt;So I have been building REST APIs for quite some time now. And I actually kind of like them, because when you build several REST APIs, then you find it very interesting and you keep on discovering many things. The people who have built REST APIs will understand what I am trying to express here. &lt;/p&gt;

&lt;p&gt;But since a long time I have been hearing about this new guy (at least new for me, actually its quite oldish) called GraphQL. They say that it can build the most efficient APIs. No API, including REST and SOAP APIs, are as good and efficient as GraphQL, because unlike REST, GraphQL has a single endpoint and gives you a flexible approach of fetching data from the server as a client. Just ask for what you need. Its like the objective type question that a client asks a server, the specific word or the specific data, and the server answers in exact number of words, or exact amount of data it was asked to give.&lt;/p&gt;

&lt;p&gt;If you don't get any of it, don't worry. In this series, I am going to be learning GraphQL myself, and whenever I think that okay, I have reached a checkpoint, or learnt enough about a topic in GraphQL or in short gql, that I can explain someone, then I will write a post here, teaching you whatever I learnt last. So this series is called LEARN GRAPHQL WITH ME! Where you literally 'learn graphql with me'....&lt;/p&gt;

&lt;p&gt;One thing to make clear, that GraphQL is in a way like REST, that it is a specification and not a module, package or library or framework, no! Its a specification. You can build REST APIs in many languages: JavaScript, Python, Java, C++, Go, PHP, Ruby, etc. Same way, GraphQL is also kind of API, and you can build it with any language. Right now there is no package for building GraphQL APIs in all languages, but in most of the major languages a package or module exists with which you can build GraphQL APIs. In this series, I am going to be learning using JavaScript, and then I even might migrate to TypeScript by the end of this series. But if you have been using a language, which currently does not have a package to implement GraphQL APIs, you have 2 options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Learn a new programming language&lt;/li&gt;
&lt;li&gt;Learn concepts of GraphQL, and be the first developer among the ones who use the same language as you do to build a package yourself, so that other people can use it (as well as you can use it) to build GraphQL APIs!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Alright so let's meet in the next post, where we will learn something new in GraphQL. And by the way, what I am going to use as a resource to learn GraphQL is called howtographql, developed by the devs at prisma.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/howtographql" rel="noopener noreferrer"&gt;
        howtographql
      &lt;/a&gt; / &lt;a href="https://github.com/howtographql/howtographql" rel="noopener noreferrer"&gt;
        howtographql
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      The Fullstack Tutorial for GraphQL
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;How to GraphQL 🎓&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://www.howtographql.com" rel="nofollow noopener noreferrer"&gt;How to GraphQL&lt;/a&gt; is a fullstack tutorial website to learn all about GraphQL! It was built by &lt;a href="https://www.prisma.io?utm_source=htg&amp;amp;utm_medium=readme" rel="nofollow noopener noreferrer"&gt;Prisma&lt;/a&gt; and many amazing contributors. All content on the site is completely free and open-source.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.howtographql.com" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/839850c1501a419f9b1b6435b380574cd554f67df0c4d648a67355509bf02866/687474703a2f2f692e696d6775722e636f6d2f36376f596539712e706e67" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: This repository is currently mostly unmaintained. We are looking for maintainers who can help cleaning up issues and PRs opened by the community. If you are interested in helping out, please &lt;a href="https://github.com/howtographql/howtographqlmailto:burk@prisma.io" rel="noopener noreferrer"&gt;reach out&lt;/a&gt;!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Content&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;The content for all tutorials is located in the  &lt;a href="https://github.com/howtographql/howtographql/tree/master/content" rel="noopener noreferrer"&gt;&lt;code&gt;/content&lt;/code&gt;&lt;/a&gt; directory. Here is an overview of all the tutorials that are available at the moment:&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;GraphQL&lt;/h4&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Fundamentals of GraphQL&lt;/li&gt;
&lt;li&gt;Advanced GraphQL&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;Frontend&lt;/h4&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;React &amp;amp; Apollo&lt;/li&gt;
&lt;li&gt;React &amp;amp; Relay (Out of date)&lt;/li&gt;
&lt;li&gt;Vue &amp;amp; Apollo (Out of date)&lt;/li&gt;
&lt;li&gt;Ember &amp;amp; Apollo (Out of date)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;Backend&lt;/h4&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;javascript-apollo / JavaScript &amp;amp; Apollo&lt;/li&gt;
&lt;li&gt;typescript-apollo / Typescript &amp;amp; Apollo&lt;/li&gt;
&lt;li&gt;typescript-helix / Typescript &amp;amp; Helix&lt;/li&gt;
&lt;li&gt;graphql-elixir / Absinthe &amp;amp; Elixir&lt;/li&gt;
&lt;li&gt;graphql-ruby / Ruby…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/howtographql/howtographql" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>graphql</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Coding Challenge #0</title>
      <dc:creator>Darshan-Bajeja</dc:creator>
      <pubDate>Sun, 24 Oct 2021 17:35:36 +0000</pubDate>
      <link>https://dev.to/darshanbajeja/coding-challenge-0-79</link>
      <guid>https://dev.to/darshanbajeja/coding-challenge-0-79</guid>
      <description>&lt;p&gt;In these challenges I ask you a question which you answer and I give shoutouts to correct answers. This is the first challenge, but for us devs it is 0th.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rules and Instructions
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;You need to solve the question within 24 hours of posting. However you can try it out even if you are late, just that you wouldn't get a shoutout here, but you will improve your knowledge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can use any technology or programming language you like, but need to write code, no website/app builders allowed. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Please try to submit a github or any other vcs hub repo instead of embedding code here. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To get the shoutout your answer should be correct and submitted within 24 hours of publishing of this post. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Task(Difficulty: Easy)
&lt;/h2&gt;

&lt;p&gt;Write some code (Use classes, structs, interface or functions) to create models for a course based application in which a user can be a student or instructor or admin. Courses should have a thumbnail image, video lessons with descriptions divided into sections, and also price. You can add as many features as you like but these features are minimum.&lt;/p&gt;

&lt;p&gt;All the best... &lt;/p&gt;

&lt;h2&gt;
  
  
  Shoutouts
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Shoutouts will come here
&lt;/h4&gt;

</description>
      <category>programming</category>
      <category>discuss</category>
      <category>database</category>
    </item>
    <item>
      <title>Halfmoon: The forgotten CSS Framework</title>
      <dc:creator>Darshan-Bajeja</dc:creator>
      <pubDate>Sat, 23 Oct 2021 13:51:15 +0000</pubDate>
      <link>https://dev.to/darshanbajeja/halfmoon-the-forgotten-css-framework-4g44</link>
      <guid>https://dev.to/darshanbajeja/halfmoon-the-forgotten-css-framework-4g44</guid>
      <description>&lt;p&gt;In this post you will learn about a very beautiful CSS framework, &lt;a href="https://www.gethalfmoon.com/"&gt;halfmoon css&lt;/a&gt; that you will rarely see someone using but is perfect for any person who wants to use a CSS framework.&lt;/p&gt;

&lt;p&gt;We often see people talking about &lt;a href="https://getbootstrap.com"&gt;bootstrap&lt;/a&gt;, &lt;a href="https://tailwindcss.com"&gt;Tailwind CSS&lt;/a&gt; or &lt;a href="https://bulma.io"&gt;Bulma CSS&lt;/a&gt; when it comes to CSS frameworks. Once I wanted to use some css framework for one of my projects, and I tried to find some new ones, and in a blog post I saw the mention of halfmoon css, I just saw it and I was really surprised, like such a beautiful framework and no one talks about, no one uses it, or only few use it, but you rarely hear or read about it! &lt;/p&gt;

&lt;p&gt;What I like about it is that having dark mode, a very difficult task for people who are not very good at front end, but want to develop a full stack app with a good front end having both light and dark modes! It is very easy to learn as well because its look and css classes are highly inspired from bootstrap. Its documentation as well is very easy to understand, so let's now go ahead and try to create a simple tip counter app in pure html and javascript, with a dark mode.&lt;/p&gt;

&lt;h3&gt;
  
  
  Building the tip calculator
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Full source code for this app available on Github:
&lt;/h4&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Darshan-Bajeja"&gt;
        Darshan-Bajeja
      &lt;/a&gt; / &lt;a href="https://github.com/Darshan-Bajeja/halfmoon-tip-calculator"&gt;
        halfmoon-tip-calculator
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A tip calculator using the halfmoon css framework for the design
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Halfmoon CSS Tip Calculator&lt;/h1&gt;
&lt;p&gt;This is a tip caluclator made in pure html and javascript and uses the halfmoon css framework for the UI. This was built for a blog post on dev.to, demonstrating the halfmoon css framework.&lt;br&gt;
&lt;strong&gt;Link to the post:&lt;/strong&gt; &lt;a href="https://dev.to/darshanbajeja/halfmoon-the-forgotten-css-framework-4g44" rel="nofollow"&gt;https://dev.to/darshanbajeja/halfmoon-the-forgotten-css-framework-4g44&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Darshan-Bajeja/halfmoon-tip-calculator"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Firstly let's create an empty directory for the project, and create 2 files inside it- &lt;code&gt;index.html&lt;/code&gt; and &lt;code&gt;script.js&lt;/code&gt;:&lt;/p&gt;

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

&lt;p&gt;Let's open it up in any code editor, and as most of you would have guessed, I am going to open it up in VS Code.&lt;/p&gt;

&lt;p&gt;Using emmet, let's add the html boiler plate code, and then link the javascript file to the html file. Also replace the title to Tip Calculator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;"X-UA-Compatible"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"IE=edge"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Tip Calculator&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"script.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's add an h1 tag just for testing purpose- which says our dear old &lt;code&gt;Hello, World!&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello World&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then open the html file in a browser. I am using Live Server extension to get hot reload.&lt;/p&gt;

&lt;p&gt;You would see and old school hello world there:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RiO7-y9b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o3i5l5fs0ykcwfa25fh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RiO7-y9b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o3i5l5fs0ykcwfa25fh5.png" alt="Hello World"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's visit half moon css website and move to the docs page. Click on 'Download' link on the sidebar, and scroll down to cdn section. Copy the link tag and paste in the head section and add script tag above the script tag which we added before. Now your code should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;"X-UA-Compatible"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"IE=edge"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Tip Calculator&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- Halfmoon CSS  --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt;
      &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/halfmoon@1.1.1/css/halfmoon-variables.min.css"&lt;/span&gt;
      &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Hello World&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- Halfmoon JS  --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/npm/halfmoon@1.1.1/js/halfmoon.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"script.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok so now in the browser you can see the difference in font in the html page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g3rF97KV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5qojl67nozi497oyl9yg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g3rF97KV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5qojl67nozi497oyl9yg.png" alt="hm hello world"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok so let's start making our tip calculator. Now I want everything to be in center, so let's create a div, which will be placed in the center of our web page, and give it the following classes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;h-half (For giving a half height, that is 50%)&lt;/li&gt;
&lt;li&gt;w-half (For giving a half width, that is 50%)&lt;/li&gt;
&lt;li&gt;border (For giving it a border)&lt;/li&gt;
&lt;li&gt;rounded (For giving it border-radius)&lt;/li&gt;
&lt;li&gt;shadow-lg (For giving it a shadow of large size)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have experience with bootstrap, you can see that these classes are very similar to it.&lt;/p&gt;

&lt;p&gt;Now to center this div, wrap it inside another div, with classes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;h-full (To give 100% height)&lt;/li&gt;
&lt;li&gt;w-full (To give 100% width)&lt;/li&gt;
&lt;li&gt;d-flex (To give a display: flex; property)&lt;/li&gt;
&lt;li&gt;flex-column (To give a flex direction of cloumn)&lt;/li&gt;
&lt;li&gt;justify-content-center (To justify the content center vertically (note that flex column makes the justify-content and align-items opposite))&lt;/li&gt;
&lt;li&gt;align-items-center (To align the items center horizontally)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So now you will have this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt;
      &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"
        h-full
        w-full
        d-flex
        flex-column
        justify-content-center
        align-items-center
      "&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"h-half w-half border rounded shadow-lg"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 (Please ignore the formatting done by prettier)&lt;/p&gt;

&lt;p&gt;and the output would be like this:&lt;/p&gt;

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

&lt;p&gt;Now let's give a header to our centered div. So create another div element with an h1, and a button with the text- toggle dark mode.&lt;/p&gt;

&lt;p&gt;To make this beautiful let's add some halfmoon classes. &lt;/p&gt;
&lt;h4&gt;
  
  
  DIV:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;d-flex&lt;/li&gt;
&lt;li&gt;justify-content-around&lt;/li&gt;
&lt;li&gt;align-items-center&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  H1
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;font-weight-bolder&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  BUTTON
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;btn &lt;/li&gt;
&lt;li&gt;btn-primary&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This will give us a beautiful header with a blue button.&lt;/p&gt;

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

&lt;p&gt;Now let's have another div below the header div, with classes d-flex, flex-column, h-three-quarter (for 75% height), align-items-center, justify-content-around, and add 2 input boxes, with type number, with placeholders total bill amount and tip percentage, and ids bill and percentage and a paragraph tag with the text: Tip amount is 0 and put the number '0' in a span with id of tip-amount.&lt;/p&gt;

&lt;p&gt;Next, to give it a good style let's add some classes. To the input boxes give the classes of form-control, form-control-lg and w-three-quarter. You pretty much now understand how the class names work in halfmoon. Also add the classes: &lt;code&gt;font-size-24&lt;/code&gt; and &lt;code&gt;font-weight-semi-bold&lt;/code&gt; to the paragraph tag to make it look good. Now finally your code inside the body tag should look like this (excluding the script tags):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt;
      &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"
        h-full
        w-full
        d-flex
        flex-column
        justify-content-center
        align-items-center
      "&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"h-half w-half border rounded shadow-lg"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"d-flex justify-content-around align-items-center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"font-weight-bolder"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Tip Calculator&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn btn-primary"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Toggle Dark Mode&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt;
          &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"
            d-flex
            flex-column
            align-items-center
            h-three-quarter
            justify-content-around
          "&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt;
            &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"number"&lt;/span&gt;
            &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"bill"&lt;/span&gt;
            &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Bill amount"&lt;/span&gt;
            &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"form-control form-control-lg w-three-quarter"&lt;/span&gt;
          &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt;
            &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"number"&lt;/span&gt;
            &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"percentage"&lt;/span&gt;
            &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Tip percentage"&lt;/span&gt;
            &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"form-control form-control-lg w-three-quarter"&lt;/span&gt;
          &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

          &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"font-size-24 font-weight-semi-bold"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            Tip amount is &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"tip-amount"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;0&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and the webpage should look like this:&lt;/p&gt;

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

&lt;p&gt;Now we have a beautiful UI. We now have to more goals to accomplish here.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make our calculator functional&lt;/li&gt;
&lt;li&gt;Make the Toggle Dark Mode button to work&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So let's do the first part, that is make our calculator functional,&lt;/p&gt;

&lt;p&gt;To do that, let's go to our javascript file and grab the html elements by their ids:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;billInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#bill&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;percentageInput&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#percentage&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tipSpan&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#tip-amount&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, let's create a function to calculate the tip and render it in the tip-amount span.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;calculateAndRenderTip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;billValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;billInput&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;percentageValue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;percentageInput&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;percentageValue&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;billValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;tipSpan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;tip&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;And let's add the change event listener to billInput and percentangeInput, and run the function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;billInput&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;change&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;calculateAndRenderTip&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;percentageInput&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;change&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;calculateAndRenderTip&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So now our calculator is functional, but note that as we have mentioned input type as number, you need to use arrow keys for incrementing and decrementing the number to trigger the change event, or if you prefer to type in the number, then you need press enter key after typing in the number to trigger the change event, otherwise browser won't detect the change event just when you type.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/iKaKvSSxXDA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Now the final part is to adding the darkmode toggling functionality. And in fact it is the easiest to do!&lt;/p&gt;

&lt;p&gt;So first in the button we created for toggle darkmode, add an onclick listener for a function which you might call, suppose, toggleTheme.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn btn-primary"&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"toggleTheme()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            Toggle Dark Mode
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and in javascript file, let's create this function which just uses the halfmoon variable which we get from the javascript cdn of halfmoon to call the toggleDarkMode function from it, and that's all you need to do for toggling dark mode in your website, really!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;toggleTheme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;halfmoon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toggleDarkMode&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/a8N1ZnLY-Ro"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To get the full source code of this app visit the github repository provided above the section where we started writing the code for this app.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So did you see how easy and cool is Halfmoon CSS. I hope you enjoyed using halfmoon and will use it in your future projects.&lt;/p&gt;

&lt;p&gt;If you make a project using halfmoon css, be sure to link it down below in the comments of this post, I will have good time looking at them!&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>html</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
