<?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: John Josef</title>
    <description>The latest articles on DEV Community by John Josef (@yukinoyamiko).</description>
    <link>https://dev.to/yukinoyamiko</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%2F943059%2Fbbc88cb8-e3ee-4414-a691-a633449ff63c.jpeg</url>
      <title>DEV Community: John Josef</title>
      <link>https://dev.to/yukinoyamiko</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yukinoyamiko"/>
    <language>en</language>
    <item>
      <title>Creating an application using Ruby &amp; React</title>
      <dc:creator>John Josef</dc:creator>
      <pubDate>Mon, 30 Jan 2023 09:09:05 +0000</pubDate>
      <link>https://dev.to/yukinoyamiko/creating-an-application-from-ruby-3dc6</link>
      <guid>https://dev.to/yukinoyamiko/creating-an-application-from-ruby-3dc6</guid>
      <description>&lt;p&gt;My partner and I created an application that allows you to view a list of dad jokes that come from the database created using Ruby. I started by forking, then cloning the repository given to me by Flatiron's phase 3 project module which included a majority of the gems required for the project. I had to create 3 models, 2 having a 1-to-many relationship and the other one belonging to those 2 models. I started off creating models for all 3 of them (user, comment, joke) and using Active Record on all of them which had relationships through their hasmany relationships. &lt;br&gt;
&lt;strong&gt;&lt;em&gt;joke.rb&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Joke &amp;lt; ActiveRecord::Base
   has_many :comments,
   has_many :users, through: :comments
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;comment.rb&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Comment &amp;lt; ActiveRecord::Base
   belongs_to :joke 
   belongs_to :user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;user.rb&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;has_many :comments 
has_many :jokes, through: :comments
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that I decided to create seeds for each model to show some data in the seeds.rb file. I decided to implement faker into the model to make some random information to use. &lt;br&gt;
&lt;strong&gt;&lt;em&gt;seeds.rb&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;require 'faker' 
I18n.reload! 
#reset seeds file 
User.destroy_all
Comment.destroy_all
Joke.destroy_all 

#create 20 random usernames
20.times do 
   User.create(username: Faker::Name.name, password: 'password')
end

#create 80 random comments
80.times do 
   Comment.create( 
      comment: Faker::Lorem.paragraph(sentence_count: 3)
      rating: Faker::Number.between(from: 0, to: 5),
      joke_id: Faker::Number.between(from: 0, to: 108)

#99 lines of dad jokes 🥴
(insert 99 lines of dad jokes here)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that I had to create migrations for each model that I created in the terminal so that I could create tables for each model.&lt;br&gt;
&lt;code&gt;$bundle exec rake db:migrate db:seed&lt;/code&gt;&lt;br&gt;
After that I noticed application controller had sinatra base inherited into it so I inherited that into my jokes controller where I had all of my crud operations.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;We struggled a lot on the react portion of the project where we had to create Comment.js, ErrorPage.js, JokesList.js, JokesForm.js, Login.js, NavBar.js, Search.js, SingleJoke.js all having their own functions inside of the code to essentially be exported into App.js and having App.js exported into index.js. We start by rendering the  Jokes onto JokesList which allows us to render the database of jokes onto the main page. We also have buttons implemented that allows us delete the jokes from the page and if you click on a joke, you can edit the joke.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const editJoke = (id, newJoke) =&amp;gt; { 
   fetch(`${API}/jokes/${id}`, { 
      method: "PATCH",
      headers: { 
         "Content-Type": "application/json",
      }, 
      body: JSON.stringify({
         joke: newJoke
      }),
   })
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Delete the joke.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleTrash = (someName) =&amp;gt; {
   fetch(`${API}/jokes/${someName.id}`, {
      method: "DELETE"
   }) 
   const newJoke = jokes.filter 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Import &amp; Export</title>
      <dc:creator>John Josef</dc:creator>
      <pubDate>Sat, 10 Dec 2022 00:19:12 +0000</pubDate>
      <link>https://dev.to/yukinoyamiko/import-export-3ce3</link>
      <guid>https://dev.to/yukinoyamiko/import-export-3ce3</guid>
      <description>&lt;p&gt;React has a feature where you code different modules(js files) to run different features/functions. Starting off with App.js being exported into index.js, and having other modules imported into App.js such as perhaps a moduleContainer.js or navBar.js. Naturally when you're exporting JSX functions, you'd want to place anything that you need for the overall global scope somewhere such as in App.js, which allows you to pass down props called in the global scope.&lt;/p&gt;

&lt;p&gt;The reason for coding in this style are various things such as:&lt;br&gt;
&lt;strong&gt;Strict variable scoping&lt;/strong&gt;. You wouldn't have to worry about mixing up codes or similar variables since variables declared in modules are private, making them non-accessible from the global scope.&lt;br&gt;
&lt;strong&gt;Easier navigation&lt;/strong&gt;. Allows for code to be more readable for other developers rather than jumbling up all the different parts of the code into separate pieces. Also makes it easier to debug since you can tell where you should be adding a debugger to. Also helps produce clean code that can be reused and repurposed.&lt;br&gt;
&lt;strong&gt;Single-responsibility principle&lt;/strong&gt;. Each module being responsible for running specific parts of the code &lt;br&gt;
i.e. &lt;br&gt;
App.js, RenderContainer.js, RenderCard.js, App.js, Search.js&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>react</category>
      <category>javascript</category>
      <category>jsx</category>
    </item>
    <item>
      <title>Keys to the object</title>
      <dc:creator>John Josef</dc:creator>
      <pubDate>Wed, 02 Nov 2022 06:54:17 +0000</pubDate>
      <link>https://dev.to/yukinoyamiko/keys-to-the-object-4n0f</link>
      <guid>https://dev.to/yukinoyamiko/keys-to-the-object-4n0f</guid>
      <description>&lt;p&gt;&lt;strong&gt;Object&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = {key: value};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Object nested inside of an object&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = {
key : value;
key2 : {
innerKey : innerValue;
    },
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Objects in javascript work just like arrays except you can easily access the values inside of an object by calling on the keys. They can also have nested arrays or nested objects inside of them. An example of things that could be an object are as such :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const charEquip = {
   hat: "Hero's helmet",
   top: "Hero's Plate Armor",
   bottoms: "Hero's Plate Legs",
   shoes: "Hero's cleaves", 
   gloves: "Hero's gloves",
   weapon: {
      primary: "Holy sword", 
      secondary: "Holy shield",
   },
};  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Based on the comparison above, there may be a moment where you may want to know what the top-level keys are in an object. If you come across this situation, you can use &lt;strong&gt;Object.keys()&lt;/strong&gt; to find out what the top level keys are :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Object.keys(charEquip);
//=&amp;gt; ["hat", "top", "bottoms", "shoes", "gloves", "weapon"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By passing the value of the object into object keys, we can ask Javascript to let us know the top-level keys. &lt;/p&gt;

&lt;p&gt;To access the inner keys nested inside of an object, you'd have to call on the innerKey as well as the outerKey.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;charEquip.weapon.secondary;
//=&amp;gt; "Holy shield"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;charEquip[weapon][primary];
//=&amp;gt; "Holy sword"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compared to arrays where you can call the values inside of an array by using square brackets to call on which part of the array you want to access, object values are called by using square bracket notation or dot notation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dot Notation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;charEquip.gloves; 
//=&amp;gt; "Hero's gloves"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Bracket Notation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;charEquip[top];
//=&amp;gt; "Hero's plate armor"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In some situations, you may need to use bracket notation to call on the value of an object as such :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const rickRolled = {
"Never": "never",
"gonna": "gonna", 
"give": "let",
"you": "you",
"up": "down",
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example if you were to try to use dot notation to try to access the value of "let", it would give you a syntax error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rickRolled."give";
// ERROR: Uncaught SyntaxError: Unexpected string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So in this case you would have to use bracket notation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rickRolled["give"];
//=&amp;gt; "let"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When assigning object keys you must also make sure the keys are specific, otherwise the processor will just log the last value that was logged to the specific key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const juicy = {
fruit: apple,
fruit: cantaloupe,
fruit: dragonfruit,
}

juicy;
//=&amp;gt; {fruit: dragonfruit}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Burnout and Learning</title>
      <dc:creator>John Josef</dc:creator>
      <pubDate>Tue, 25 Oct 2022 06:23:44 +0000</pubDate>
      <link>https://dev.to/yukinoyamiko/10242022-3mi5</link>
      <guid>https://dev.to/yukinoyamiko/10242022-3mi5</guid>
      <description>&lt;p&gt;Been out of it for the weekend since I knew I failed the code challenge. I kept writing a bunch of code and deleting it until eventually I deleted a ton right at the end of time. I didn't notice it. When I retake it, I'll write notes in my index.js about what I need to do next time. Today we decided that for our code together that we're going to make a code that grabs different types of quotes depending on which button you press and to make sure that it's compatible with phone screens as well.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Intro to C++ into Javascript</title>
      <dc:creator>John Josef</dc:creator>
      <pubDate>Wed, 19 Oct 2022 02:27:34 +0000</pubDate>
      <link>https://dev.to/yukinoyamiko/10182022-533a</link>
      <guid>https://dev.to/yukinoyamiko/10182022-533a</guid>
      <description>&lt;p&gt;I've learned C++ before and it's very useful to note that in comparison, if you provide more than one argument in console.log, then it automatically prints out the arguments with a space in between rather than having to place multiple arguments and having to string a space in between each argument(It may have changed since I took it in 2014). It was very different going from having to #include the dev tools I was planning to use or having to type out the using namespace std; into int main ();. Using console.log, returning, or even just calling what I want returned rather than having to write cout &amp;gt;&amp;gt; " "; is also a lot better looking in my opinion. I found it interesting to see that Mozilla Firefox was one of the first browsers that had DevTools.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>First blog post</title>
      <dc:creator>John Josef</dc:creator>
      <pubDate>Mon, 17 Oct 2022 03:33:04 +0000</pubDate>
      <link>https://dev.to/yukinoyamiko/first-blog-post-13oh</link>
      <guid>https://dev.to/yukinoyamiko/first-blog-post-13oh</guid>
      <description>&lt;p&gt;Starting off with learning javascript for the past week and everything has been very stressful yet interesting. I have a lot to learn still and I'm hoping things become easier as I progress. I've always wanted to be a coder but wasn't a fan of the US School system and decided to work while I decided with what I want to do but as I went through jobs and progressed I started realizing how expendable I am in a physical job setting and decided I wanted to continue my education and start my journey into finally learning how to code. So far I've been learning javascript, HTML, css, how the DOM works, and all things included. We've had to do a month worth of prep work before then and that was very stressful and I'm glad that we're starting live lessons because I feel like I'm learning a lot more compared to during the prep work phase, but it definitely helped. I've learned somethings for example to use textContent rather than innerHTML for situations that involve making the user input information since people can possibly hack that information. I'm currently learning functions and scopes and am very confused but hopefully I'll learn a lot more.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
