<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Manuela Sanchez on Medium]]></title>
        <description><![CDATA[Stories by Manuela Sanchez on Medium]]></description>
        <link>https://medium.com/@m.sanchez947?source=rss-35394db5b13e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZCzKVNjnA58Lg7GUlcR02A.jpeg</url>
            <title>Stories by Manuela Sanchez on Medium</title>
            <link>https://medium.com/@m.sanchez947?source=rss-35394db5b13e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 16:15:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@m.sanchez947/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Human?]]></title>
            <link>https://medium.com/@m.sanchez947/human-6a891dde5dcb?source=rss-35394db5b13e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a891dde5dcb</guid>
            <category><![CDATA[self-awareness]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[self-love]]></category>
            <dc:creator><![CDATA[Manuela Sanchez]]></dc:creator>
            <pubDate>Wed, 24 Jul 2019 02:29:24 GMT</pubDate>
            <atom:updated>2019-07-24T02:29:24.611Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cV0_EOdR_wfs87PoPCNwfw.jpeg" /></figure><p>I have decided to write a non-technical blog post to remind myself and others I AM NOT A ROBOT.</p><p>My journey as a software engineer has had so many ups and downs and I forget the amount of progress I am making throughout my journey. I can make a website(might not be the best) from scratch and make it have functionality using a coding language I thought I wouldn’t ever be able to understand. We tend to forget where we started and where we are now.</p><p>Applying to so many job postings and getting rejected can have negative impact on how you view yourself and progress. It has taken a toll on me to a point where I begin to question if I am good enough to keep applying but there is a little voice in my head that reminds me I am the #%$@ best. I need to keep pushing forward because of what I believe and what I want to achieve. I go out and work out. I put myself in awkward conversations and say the wrong things. I live and learn. We are not perfect, we are not robots.</p><p>Talk to those around you. Remember the internet isn’t just to learn how to code. Read a self help book. Meditate. Remember where you were when you started and where you are now. The only way you fail is if you don’t put your self out there and keep making mistakes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a891dde5dcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Modal in Javascript]]></title>
            <link>https://medium.com/swlh/creating-a-modal-in-javascript-c7a4180b1143?source=rss-35394db5b13e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7a4180b1143</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[modalert]]></category>
            <category><![CDATA[modal]]></category>
            <dc:creator><![CDATA[Manuela Sanchez]]></dc:creator>
            <pubDate>Wed, 17 Jul 2019 01:42:45 GMT</pubDate>
            <atom:updated>2019-07-29T06:47:06.606Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oTrpwGmHZ0gc_DQj0NOuow.jpeg" /></figure><p>While creating my PetMe project I was looking for a way to easiest create a pop-up window which will allow users to know they entered an incorrect password or username. I was stuck. I tried to use an alert but I couldn’t find a way to customize it as I wanted to. I finally went to a Meet-up where an amazing hero came to the rescue. She introduced me to a Modal.</p><p>A modal is customizable to accomplish any of you pop-up needs on your app.It is a dialog/interactive box that sits on a current page. It is built with CSS, HTML, and Javascript. I will go step by step to show how I created a modal using all these tools including bootstrap(no shame in a little design help!). If you are more creative than me you can opt out of using bootstrap and I will make note of it below.</p><p>I will begin to explain the process of how I made my modal which is displayed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FXKQbatNaEAIrKpB7RCU2A.png" /></figure><p>I wanted a pop-up window to display getting an incorrect password. My first plan of attack, with the angel dropped from heaven, was to start with the CSS.</p><pre>.modal{<br>height: 317px;<br>width: 313px;<br>position: fixed;<br>left: 39%;<br>z-index: 200;<br>display: none;<br>justify-content: center;<br>align-items: center;<br>}</pre><p>The above code has a class name of modal that I can later use to show the modal where I want it to. The key for this css to show the modal is by the display. The display as you can see above is none but when a user enters an incorrect password it should then change to flex. I created a named function that I can later call in the event I would want the modal to show.</p><pre>const showModal = () =&gt; {<br>  document.getElementsByClassName(&quot;modal&quot;)[0].style.display = &quot;flex&quot;<br>}</pre><p>First you look at the document get the element by class name change the style display to flex. The event I want this to happen is only when a user has the incorrect password or username so I call it in my fetch call.</p><pre>export const gettingUser = (userInfo) =&gt; {<br>  return (dispatch) =&gt; {<br>    fetch(&quot;<a href="http://localhost:3000/api/v1/login">http://localhost:3000/api/v1/login</a>&quot;, {<br>      method: &quot;POST&quot;,<br>      headers: {<br>        &quot;content-type&quot;: &quot;application/json&quot;,<br>        Accepts: &quot;application/json&quot;<br>      },<br>      body: JSON.stringify({ user: userInfo })<br>    })<br>      .then(resp =&gt; (resp.ok ?<br>        resp.json().then(userData =&gt; {dispatch(loginUser(userData),<br>          localStorage.setItem(&quot;token&quot;, userData.jwt))})<br>          :<br>          resp.json().then(userData =&gt; showModal())<br>        ))<br>    }<br>}</pre><p>Now I forgot to mention a key function of the modal. It should be a child of the highest point of your app or the highest point of where you want this modal to appear. Since my login page is one of the first pages I want a user to see it has to be a child of where the highest point of my app is that is my index.</p><pre>ReactDOM.render(&lt;Provider store={store}&gt; &lt;BrowserRouter&gt; &lt;Modal /&gt;&lt;App /&gt; &lt;/BrowserRouter&gt;&lt;/Provider&gt;</pre><p>This block of code is in my Index.js file where all the magic happens. Before this I also created a Modal class.</p><pre>import React from &#39;react&#39;;</pre><pre>class Modal extends React.Component {</pre><pre>render(){<br>    return(</pre><pre>&lt;div class=&quot;modal&quot; tabindex=&quot;-1&quot; role=&quot;dialog&quot;&gt;<br>        &lt;div class=&quot;modal-dialog&quot; role=&quot;document&quot;&gt;<br>          &lt;div class=&quot;modal-content&quot;&gt;<br>            &lt;div class=&quot;modal-header&quot;&gt;<br>              &lt;h2 class=&quot;modal-title&quot;&gt;Sorry Try Again!&lt;span  role=&quot;img&quot; aria-label=&quot;emoji&quot;&gt;❤️&lt;/span&gt;&lt;/h2&gt;<br>            &lt;/div&gt;<br>            &lt;div class=&quot;modal-body&quot;&gt;<br>              &lt;p&gt;Your username or password is incorrect.&lt;/p&gt;<br>            &lt;/div&gt;<br>            &lt;div class=&quot;modal-footer&quot;&gt;<br>              &lt;button type=&quot;button&quot; onClick={this.modalOff} class=&quot;btn btn-secondary&quot; data-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    )<br>  }<br>}</pre><pre>export default Modal</pre><p>The body of this modal is where I added the bootstrap code and what you can adjust to what you would like. As you can see my modal is similar to the one at the top of this page because of this block of code.</p><p>The last step to this master plan was to add functionality to my modal to make sure a user can take the modal off the page if they click on the close button. to do that I had to go back again and create a named function where I can change the display back to none.</p><pre>modalOff = () =&gt; {<br>    document.getElementsByClassName(&quot;modal&quot;)[0].style.display = &quot;none&quot;<br>  }</pre><p>This function above is again added to the event where I want the user to be able to close it which is in the button.</p><pre>&lt;button type=&quot;button&quot; onClick={this.modalOff} class=&quot;btn btn-secondary&quot; data-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;</pre><p>This is all happening inside of the modal class and the ending product of the code is this.</p><pre>import React from &#39;react&#39;;</pre><pre>class Modal extends React.Component {</pre><pre>modalOff = () =&gt; {<br>    document.getElementsByClassName(&quot;modal&quot;)[0].style.display = &quot;none&quot;<br>  }</pre><pre>render(){<br>    return(</pre><pre>&lt;div class=&quot;modal&quot; tabindex=&quot;-1&quot; role=&quot;dialog&quot;&gt;<br>        &lt;div class=&quot;modal-dialog&quot; role=&quot;document&quot;&gt;<br>          &lt;div class=&quot;modal-content&quot;&gt;<br>            &lt;div class=&quot;modal-header&quot;&gt;<br>              &lt;h2 class=&quot;modal-title&quot;&gt;Sorry Try Again!&lt;span role=&quot;img&quot; aria-label=&quot;emoji&quot;&gt;❤️&lt;/span&gt;&lt;/h2&gt;<br>            &lt;/div&gt;<br>            &lt;div class=&quot;modal-body&quot;&gt;<br>              &lt;p&gt;Your username or password is incorrect.&lt;/p&gt;<br>            &lt;/div&gt;<br>            &lt;div class=&quot;modal-footer&quot;&gt;<br>              &lt;button type=&quot;button&quot; onClick={this.modalOff} class=&quot;btn btn-secondary&quot; data-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    )<br>  }<br>}</pre><pre>export default Modal</pre><p>The modal will always be on the page until there is an event that triggers it. I am pretty sure there are plenty of other ways you can go about creating a modal but this is mine. I hope you I explained how to create a modal and you can create yours too!</p><p><a href="https://www.w3schools.com/howto/howto_css_modals.asp">How To Make a Modal Box With CSS and JavaScript</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7a4180b1143" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/creating-a-modal-in-javascript-c7a4180b1143">Creating a Modal in Javascript</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Promise.all() in React]]></title>
            <link>https://medium.com/@m.sanchez947/promise-all-in-react-65d9ceb917db?source=rss-35394db5b13e------2</link>
            <guid isPermaLink="false">https://medium.com/p/65d9ceb917db</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Manuela Sanchez]]></dc:creator>
            <pubDate>Thu, 18 Apr 2019 16:10:48 GMT</pubDate>
            <atom:updated>2019-04-18T16:10:48.902Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*gwiSmzw0g33GfNqB12iy8g.jpeg" /></figure><p>I am all about how can I make my life easier. Promise.all() can definitely accomplish that when using React. React is a great framework to make life easier but you get introduced to knew things that make a bit confusing.</p><p>The best way I learn is with first introducing an example with the implemented method and explaining the steps along the way.</p><p>In react, states allow us to get data, manipulate our data and so fourth. In order for us to get this data from where ever we are looking for it, we first have to set our state to an empty array then change our state. For this example we have to sets of data that we want to manipulate so lets name them and make our states.</p><pre>state = {<br>    stickers: [],<br>    pages: []<br>  }</pre><p>These states are currently empty and we want to change them by fetching our data from two different places and we want to show the data as soon as the app runs using componentDidMount() and changing our state with this.setState.</p><p>My first instinct would be to have something that looks like this…</p><pre>componentDidMount(){<br> fetch(&#39;<a href="http://localhost:3000/stickers&#39;">http://localhost:3000/stickers&#39;</a>,&#39;<a href="http://localhost:3000/pages&#39;">http://localhost:3000/pages</a>     ).then(res =&gt; res.json())<br>.then(dataJSON =&gt; {<br>   this.setState({<br>      stickers: dataJSON,<br>      pages: dataJSON</pre><pre>    })<br>  })</pre><pre>}</pre><p>But this will obviously wont work. If you don’t believe me then try it out and see what crazy error you get. So now……What the **&amp;*&amp;# do we do. We use promise.all()!!!!</p><p>Promise.all() will allow us to use componentDidMount() to give us a resolved response for everything that was passed through it.</p><pre>componentDidMount(){<br>    Promise.all([fetch(&#39;http://localhost:3000/stickers&#39;),                                  fetch(&#39;http://localhost:3000/pages&#39;)])</pre><p>The code above is basically saying make a fetch to both of these and in return give me a resolved response.</p><pre>.then(res =&gt; console.log(res))</pre><p>At this point I always console log that response to see if I am getting the resolved response or not. It will usually look something like what is below.</p><ol><li><em>(2) [Response, Response]</em></li><li>0: Response {type: “cors”, url: “http://localhost:3000/stickers&quot;, redirected: false, status: 200, ok: true, …}</li><li>1: Response {type: “cors”, url: “http://localhost:3000/pages&quot;, redirected: false, status: 200, ok: true, …}</li><li>length: 2</li></ol><p>You will notice you have two responses now. what do you do now?Promise.all() to the rescue again!!!!</p><pre>.then(res =&gt; Promise.all(res.map(r =&gt; r.json())))</pre><p>This time we want to map through both of our promises. Since it is an array of two responses we want to make sure each of them get turned into json. To use them later on. Promise.all makes sure we get both of these responses resolved before moving ahead. Once that is done we can continue with our fetches and use another .then.</p><pre>.then(dataJSON =&gt; this.setState({<br>        stickers: dataJSON[0],<br>        pages: dataJSON[1]<br>      }))<br>}</pre><p>This is the end of our componentDidMount method. The last .then holds our data as a nested array within an array. That then allows us to change our state to those two different arrays. When you console.log(dataJSON) you see</p><ol><li><em>(2) [Array(16), Array(4)]</em></li><li>0: (16) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]</li><li>1: (4) [{…}, {…}, {…}, {…}]</li><li>length: 2</li></ol><p>This is why is it vital to always check what you are getting back because the only way I set the JSON data to the right state is by looking at my arrays and seeing which ones are my arrays of stickers and which one was the array of pages.</p><p>Now we can both get our data and see our data when the application runs!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*VV7eIHnhaXRIsaGEVOdsyQ.png" /></figure><p>Here is another example where Promise.all() came in handy</p><pre>state = {<br>      pets: [],<br>      filters: {<br>        type: &#39;all&#39;<br>      }<br>    }</pre><pre><br>handleClick = () =&gt; {</pre><pre>    Promise.all([fetch(&#39;/api/pets&#39;), fetch(&#39;/api/pets?type=cat&#39;), fetch(&#39;/api/pets?type=dog&#39;), fetch(&#39;/api/pets?type=micropig&#39;)])</pre><pre>    .then( ([res1, res2, res3, res4]) =&gt; {<br>      return Promise.all([res1.json(), res2.json(), res3.json(),  res4.json()])<br>    })</pre><pre>    .then( ([allJSON, catJSON, dogJSON, micropigJSON]) =&gt; {<br>        if (this.state.filters.type === &quot;all&quot;) {<br>          return this.setState({<br>            pets: allJSON<br>          })<br>           }</pre><pre>        else if (this.state.filters.type === &quot;cat&quot;){<br>          return this.setState({<br>            pets: catJSON<br>          })<br>        }</pre><pre>        else if (this.state.filters.type === &quot;dog&quot;){<br>          return this.setState({<br>            pets: dogJSON<br>          })<br>        }</pre><pre>       else if (this.state.filters.type === &quot;micropig&quot;){<br>          return this.setState({<br>            pets: micropigJSON<br>          })<br>        }</pre><pre>       })<br>    }</pre><p>In this example I changed the State of pets based on a handleClick method and if the filtered state equaled to the right animal. Promise.all() allowed me to fetch from multiple places and set the responses to the right animal.</p><p>To sum Promise.all() it returns a single promise that resolves when all of the promises passed through and have resolved or when the item contains no promises anymore. It is amazing!!!!! Below are links that can better explain how powerful Promise.all is and the many ways you can use it.</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all">Promise.all() - JavaScript | MDN</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65d9ceb917db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getter and Setter Methods in JavaScript]]></title>
            <link>https://medium.com/@m.sanchez947/getter-and-setter-methods-in-javascript-1fcda13a2344?source=rss-35394db5b13e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fcda13a2344</guid>
            <category><![CDATA[methods]]></category>
            <category><![CDATA[getter]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Manuela Sanchez]]></dc:creator>
            <pubDate>Mon, 25 Mar 2019 16:05:34 GMT</pubDate>
            <atom:updated>2019-03-25T16:05:34.750Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O98wm0JB_Z2DxhENYZrBUw.jpeg" /></figure><p>Learning new concepts can make your head spin. Getter and Setter methods in JavaScript made my head spin. I personally did not understand how and when to use these methods and even if I needed them. Once I understood this concept I saw the use in these method and hopefully you all will too after reading this blog.</p><p>Getter and Setter methods allow you to access and change information within an object. Let’s create an object to put them in practice.</p><pre> let person = {<br>     first_name: &quot;Manuela&quot;, <br>     last_name: &quot;Sanchez&quot;<br>}</pre><p>Here we created an Object of a person and we want to begin to add functionality to it where we can call this object and get the person’s full name. We will use the Getter method to do this</p><pre>let person = {<br>     first_name: &quot;Manuela&quot;, <br>     last_name: &quot;Sanchez&quot;, <br> <br>get fullName() {<br>    return `${this.first_name} ${this.last_name}`;<br>  }<br>};</pre><p>When using the getter method you call it by using the syntax get followed by a method name fullName() and the condition {return`${this.first_name} ${this.last_name}}`. Now try to console.log(person.fullName) and watch it spit out the full name “Manuela Sanchez” as a string. Cool right! But let’s say we want your name is not Manuela Sanchez and you want to change it to yours. Getter Methods allow you to read data but not change it. Right now if you try to set fullName to a variable you will get an error and this is when the Setter method comes into play.</p><pre>let person = {<br>     first_name: &quot;Manuela&quot;, <br>     last_name: &quot;Sanchez&quot;, <br> <br>get fullName() {<br>    return `${this.first_name} ${this.last_name}`;<br>  }<br><br>set fullName(value) {<br>    [this.first_name, this.last_name] = value.split(&quot; &quot;);<br>  }<br>};</pre><p>When calling the Setter method it is as easy as saying set followed by the function fullName(value)and the condition [this.fist_name, this.last_name] = value.split(&quot; &quot;). Make sure to pass in an argument in your function to represent the change. Since fullName() gives us the string of the person’s full name we will use (value) to represent the new string. Now let’s try to change our data person.fullName = &quot;John Smith&quot; . If you did this in your console you will notice you did not get any errors!</p><p>Let see what happens if we call console.log(person.first_name) and console.log(person.last_name). We will get the value of both “John” and “Smith”. Great! We changed the our data. Both of these methods work together to make magic happen. We are able to get a string of a full name and change the full name.</p><p>Getter and Setter methods go more in depth than this blog. With this tool we are also able to create hidden functions for your users not to have access to. They create security and value to an object. I wont go into more detail about this but this is a good article to read all about how that works.</p><p><a href="https://johnresig.com/blog/javascript-getters-and-setters/">John Resig - JavaScript Getters and Setters</a></p><p>There are also different ways you can call getter and setter methods and these two articles are great for that. Hopefully I gave you all the insight of the basic functionality of getter and setter methods in JavaScript to stop your head from Spinning and give you a better since of direction.</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects">Working with objects - JavaScript | MDN</a></li><li><a href="https://javascript.info/property-accessors">Property getters and setters</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fcda13a2344" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[So dirty!]]></title>
            <link>https://medium.com/@m.sanchez947/so-dirty-b894d9b0775b?source=rss-35394db5b13e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b894d9b0775b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[code-newbie]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Manuela Sanchez]]></dc:creator>
            <pubDate>Tue, 12 Mar 2019 17:34:49 GMT</pubDate>
            <atom:updated>2019-03-12T17:34:49.298Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FWxzhpsnJMV4q6yGvGf%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FWxzhpsnJMV4q6yGvGf%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FWxzhpsnJMV4q6yGvGf%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="569" frameborder="0" scrolling="no"><a href="https://medium.com/media/38afbe9fa2160bf447fa0fd553ceaaa6/href">https://medium.com/media/38afbe9fa2160bf447fa0fd553ceaaa6/href</a></iframe><h3>So dirty!</h3><p>Throughout my six week coding journey I have struggled with caring about why <strong>I </strong>should care about how my code looks. I started to do research and found out that this is a key skill that can help future me and many others who look at my code after me. Sometimes we get caught up in the present that we forget to prepare for the future.</p><p>There are many components that can make a code “<em>dirty”</em>,<em> </em>but I will only speak on three that can help you begin your journey of why it is important to clean up your code.</p><h4>Position your code right</h4><p>This is a topic that I have struggled since the day I started to look at code. Why should I position my code write if I get the same outcome and my code does not break. Well this is why…</p><pre>def find_tickets_that_match_user(current_user)<br>current_user.tickets.each do |ticket|<br>puts ticket.flight.destination.country_name<br>puts ticket.flight.airline.airline_name<br>if ticket.business_class == false<br>puts &quot;Business Class: No&quot;<br>elsif ticket.business_class == true<br>puts &quot;Business Class: Yes&quot;<br>end<br>end<br>end<br>def upgrade_ticket(upgrade, current_user)<br>if upgrade == &quot;yes&quot;<br>list = list_of_flight_numbers(current_user)<br>upgrade_individual_ticket(list, current_user)<br>print_out_new_ticket_info(current_user)<br># business_class_canceled(current_user)<br>else<br>&quot;No Worries, maybe next time.&quot;<br>end<br>end</pre><p>Can you guys understand what is ending where and what is going on where?? Because I can’t. The above code is known as in the coding world as a code that does not smelling right. When a code does not look normal to you there is something you need to fix and should raise a red flag immediately. Always ask yourself “How does my code smell?”</p><pre>def find_tickets_that_match_user(current_user)<br>  current_user.tickets.each do |ticket|<br>    puts ticket.flight.destination.country_name<br>    puts ticket.flight.airline.airline_name<br>    <br>    if ticket.business_class == false<br>      puts &quot;Business Class: No&quot;<br>    elsif ticket.business_class == true<br>      puts &quot;Business Class: Yes&quot;<br>    end<br>  end<br>end</pre><pre>def upgrade_ticket(upgrade, current_user)<br>  if upgrade == &quot;yes&quot;<br>    list = list_of_flight_numbers(current_user)<br>    upgrade_individual_ticket(list, current_user)<br>    print_out_new_ticket_info(current_user)<br>           #business_class_canceled(current_user)<br>  else<br>    &quot;No Worries, maybe next time.&quot;<br>  end<br>end</pre><p>Ahhhhh, much better. We can now tell just by a glance, there are two separate methods. We can also see what these two methods are doing inside of each. I personally just like to give a space between a start of an iteration or if statement just because I can read it better when there are multiple functions in that method. This code still does not smell <strong>quite </strong>right yet which brings me to my next topic.</p><h4>Comment only what you need to comment</h4><pre>def upgrade_ticket(upgrade, current_user)<br>  if upgrade == &quot;yes&quot;<br>    list = list_of_flight_numbers(current_user)<br>    upgrade_individual_ticket(list, current_user)<br>    print_out_new_ticket_info(current_user)<br>           #business_class_canceled(current_user)<br>  else<br>    &quot;No Worries, maybe next time.&quot;<br>  end<br>end</pre><p>Did any of you catch this comment…</p><pre>#business_class_canceled(current_user)</pre><p>My method is upgrading a current users ticket to business class not canceling the flight. Why in the world would I put this comment there. Well… I did this when I was planning out my project. After this method I was planning on writing another method to cancel flight at one point but did not know where to put it so I made a mental note. Did you guys figure this out with just reading my code? I bet not. Going back and deleting unnecessary comments like these will help whomever reads your code and understand what is really going on. People don’t really need to know what your thinking process was.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FkS9CFQodRdiRWETkln%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FkS9CFQodRdiRWETkln%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FkS9CFQodRdiRWETkln%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/c92992ee128145a1cda13eeb67f6b09c/href">https://medium.com/media/c92992ee128145a1cda13eeb67f6b09c/href</a></iframe><pre>def upgrade_ticket(upgrade, current_user)<br>  if upgrade == &quot;yes&quot;<br>    list = list_of_flight_numbers(current_user)<br>    upgrade_individual_ticket(list, current_user)<br>    print_out_new_ticket_info(current_user)<br>  else<br>    &quot;No Worries, maybe next time.&quot;<br>  end<br>end</pre><p>Now this smells good.</p><h4>Choose the right naming convention</h4><p>The way you name your classes, variables, methods can make a <strong>HUGE</strong> impact on what future you understands what your code is doing and other people who look at your code.</p><pre>def upgrade_ticket(upgrade, current_user)<br>  if upgrade == &quot;yes&quot;<br>    list = list_of_flight_numbers(current_user)<br>    upgrade_individual_ticket(list, current_user)<br>    print_out_new_ticket_info(current_user)<br>  else<br>    &quot;No Worries, maybe next time.&quot;<br>  end<br>end</pre><p>For the code above you can read my method and have an idea of what my method will do. I tried to think of it in a way where I asked myself “What action will my method be doing.” I am upgrading a ticket based on what upgrade is. I named the variable upgrade because if I chose to upgrade(“yes”) I will begin to call other certain actions. What if I named it grapes.</p><pre>def upgrade_ticket(grapes, current_user)<br>  if grapes== &quot;yes&quot;<br>    list = list_of_flight_numbers(current_user)<br>    upgrade_individual_ticket(list, current_user)<br>    print_out_new_ticket_info(current_user)<br>  else<br>    &quot;No Worries, maybe next time.&quot;<br>  end<br>end</pre><p>Do you understand what my method does now? Probably not. Make sure to not just create random names, make sure they make sense. Also, be consistent, if you name all of your functions camelCase.. do it for all. I chose to do underscores and did it consistently throughout my app as you can see above. When naming classes AndYouNameAClassLikeThis, do it for all. They key here is to be consistent and clear.</p><h4>Conclusion</h4><p>Cleaning your code is a great skill to learn to and practice to make your life easier and others. I am now realizing how the little things can make a huge impact. There are many other ways to clean your code that I did not state here and are super important! With that being said check out the links below to keep your code smelling good!!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxUySTU0jgZaZ4jjCRW%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxUySTU0jgZaZ4jjCRW%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FxUySTU0jgZaZ4jjCRW%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="184" frameborder="0" scrolling="no"><a href="https://medium.com/media/865435537cb97a1c51ff7c6b51c18754/href">https://medium.com/media/865435537cb97a1c51ff7c6b51c18754/href</a></iframe><p><a href="http://www.geekyboy.com/archives/494">Clean Development Series: Part 3, Dirty Code (how to spot/smell it)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b894d9b0775b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Changing The Game]]></title>
            <link>https://medium.com/@m.sanchez947/changing-the-game-75b8c58affbf?source=rss-35394db5b13e------2</link>
            <guid isPermaLink="false">https://medium.com/p/75b8c58affbf</guid>
            <category><![CDATA[women-in-tech]]></category>
            <dc:creator><![CDATA[Manuela Sanchez]]></dc:creator>
            <pubDate>Tue, 26 Feb 2019 15:55:44 GMT</pubDate>
            <atom:updated>2019-02-26T15:55:44.230Z</atom:updated>
            <content:encoded><![CDATA[<p>Women in the tech industry are breaking standard boundaries everyday. There is a huge gender gap in the technical world and most of it is due to the non-exposure at an early age. An issue that needs to be resolved ASAP!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FfwWtablCZSMzcP5nVn%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FfwWtablCZSMzcP5nVn%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FfwWtablCZSMzcP5nVn%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="242" frameborder="0" scrolling="no"><a href="https://medium.com/media/651da93c598197f3a3fff9dc5942000d/href">https://medium.com/media/651da93c598197f3a3fff9dc5942000d/href</a></iframe><p>From personal experience as a hispanic women, I was exposed to the tech industry only until my early 20s. Growing up I was never taught about women whom have impacted the world using technological advances or where big co-founders of tech companies. I want to help change that and expose women who are bosses in the tech world.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxUA7bcakJDLql2cdMc%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxUA7bcakJDLql2cdMc%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FxUA7bcakJDLql2cdMc%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb90583c72e6a826245ee08e8ac3e47b/href">https://medium.com/media/bb90583c72e6a826245ee08e8ac3e47b/href</a></iframe><p>In this blog I will introduce Reshma Saujani. Who has made an impact in the tech industry and is spreading exposure to young women across the world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A04MpM1x5h0bRrFQ6lW7Rg.jpeg" /></figure><p>Reshama Saujani is the founder and CEO of Girls Who Code. Girls Who Code is a nonprofit organization that offers coding programs for girls between third grade and Twelfth grade across all 50 states. This program has already reached 90,000 girls to date! 88 percent of these girls go on to pursue a computer science degree all because of their exposure to this new industry through this program.</p><p>Reshama Saujani journey was a rocky one to start with. Before pursuing her programming career she was rejected from Yale Law school three times and lost an election to becoming a congress women(twice). Reshama was always striving for that perfect resume (as she quotes) and never put her focus on changing the world until she noticed the ratio of male to female in computer science classes. That sparked her interest in teaching more girls to code. She noticed how to address the issue of exposing girls to tech with sparking interest at an early age. Which is a boss idea to think of. BUT again she was brought down. Take a look at the link below.</p><p><a href="https://gma.abc/2U8fnaG">Girls Who Code founder Reshma Saujani on the worst advice she never took</a></p><p>After being rejected once more she was brave enough to start this organization. Six years later she become a huge influencer in the tech industry. Making an impact everyday by simply never giving up.</p><p>In one of her interviews she speaks on how girls are being raised to be perfect and boys are raised to be brave. Coding is the key to break this pattern. Programming is all about not being afraid to break things and fix them all up again. Making decisions that most wont agree on to break new boundaries and create history. The tech industry is boundless and with the more exposure we bring our young girls the faster this chart below will change to say <strong>The Tech is Now a Woman’s World.</strong></p><p>In this blog I will introduce Reshma Saujani. Who has made an impact in the tech industry and is spreading exposure to young women across the world.</p><p>Learn more about Reshama Saujani</p><ul><li><a href="https://qz.com/work/1176066/girls-who-code-founder-reshma-saujani-values-bravery-over-perfection/">The founder of Girls Who Code: &quot;When you get a taste for being brave, it&#39;s hard to stop&quot;</a></li><li><a href="https://www.goodmorningamerica.com/living/story/girls-code-founder-reshma-saujani-worst-advice-61202158">Girls Who Code founder on the worst advice she never took</a></li><li><a href="https://girlswhocode.com/our-team/">Our Team - Girls Who Code</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75b8c58affbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>