<?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 Theresa Garcia on Medium]]></title>
        <description><![CDATA[Stories by Theresa Garcia on Medium]]></description>
        <link>https://medium.com/@thetheresagarcia?source=rss-9d0c2a268bdc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*EpTeR6jYNYwLlky2pFbW6g.jpeg</url>
            <title>Stories by Theresa Garcia on Medium</title>
            <link>https://medium.com/@thetheresagarcia?source=rss-9d0c2a268bdc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:53:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thetheresagarcia/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[Breaking down a WebVR CodeAlong: Part 1]]></title>
            <link>https://medium.com/@thetheresagarcia/breaking-down-a-webvr-codealong-part-1-22976d9585a2?source=rss-9d0c2a268bdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/22976d9585a2</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[ar]]></category>
            <category><![CDATA[a-frame]]></category>
            <category><![CDATA[vr]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[Theresa Garcia]]></dc:creator>
            <pubDate>Thu, 26 Mar 2020 01:32:42 GMT</pubDate>
            <atom:updated>2020-03-26T01:32:42.360Z</atom:updated>
            <content:encoded><![CDATA[<p>In my attempt to learn more about the world of AR and VR, I recently stumbled upon an amazing article by Pryash Thapa on Viget called Creating Your First WebVR App using React and A-Frame. Wanting to have a more thorough understanding of how this computer-generated world of Virtual and Augmented Reality works, I decided to follow his instructions step-by-step and wanted to share a few things that I learned along the way.</p><p>To start, what I greatly appreciated about this article was that the complete initial setup was provided. In trying to code along with a multitude of other AR and VR ‘code-along’ articles, I often found that key elements in the initial environment setup were often omitted leaving me a bit clueless as to how to get past the first step. This tutorial, on the other hand, was extremely well explained and helped me get up and running in a few lines of code by providing the github repo and explaining exactly what would be installed. In writing this blogpost, my goal is to share my learnings as I attempted to code along.</p><p>So after cloning the repo, I began reading about the two frameworks this app would be utilizing: A-Frame and React. A-Frame is an open-source web framework for building virtual realities in HTML, and React is a library for building user interfaces. The purpose of using React is its ability to attach ‘state’ to the objects being created.</p><p>What is state though? In React, ‘state’ refers to the parts of an object within an application that can change. My novice understanding is that maintaining changes in state can be quite difficult and React provides a way for us to more easily manage all of the objects states that we’ll be changing in our virtual reality.</p><p>Running yarn start, I fired up the development server and was able to see the full scene that we’d be creating for a little inspiration and then deleted everything within our Scene element to start from scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*igGh2W5reu18fcso3RmQZQ.png" /></figure><p>But what is Scene? Scene is an A-Frame component that equates to the root of our project. It IS our project. All entities are contained within scene so therefore scene inherits all of the entities properties that are located within.</p><p>But then what is an entity? You know what, enough with the questions, let’s build this and figure it out as we code-along…</p><p>Establishing our Environment</p><p>First things first, we need some kind of environment for our world to come alive in. Since we are just beginning, we are going to use one that has already been created for us by <a href="https://github.com/feiss/aframe-environment-component">aframe-environment</a>. We now only need to import it into our app/initialize.js file and attach it to this beautiful virtual environment to our scene inside main.js.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*QVow1-fLairU8KMkDuPfjQ.png" /></figure><p>So far, we’ve imported our scene from a 3rd party, aka A-Frame Environment, and attached that environment to our scene as a ‘prop’, or property.</p><p>With our scene set up, we’ll now be building upon it using Entities. Entities can be thought of like holding blocks. By themselves they do nothing but when we attach components to them they come alive!</p><p>So the first Entity that we will add to our scene is a cursor. This is what will allow us to interact with the environment using our cursor. In addition, we will wrap our cursor entity in a camera entity so that we can actually see what part of the scene our cursor is leading us to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*3fEhK0Ko2Cv5pn1Mceo7UQ.png" /></figure><p>I want to point out here that each of these tasks perfectly outlines the architecture that A-Frame utilizes, which is an Entity-Component System (ECS). This means that within any project scene that you have created (in this case, that would be our ‘Starry Night’ scene that we imported from our 3rd party A-Frame environment), every single solitary object that you want to put inside of that scene environment, will have to be wrapped in its own entity. So our individual cursor object needed to be wrapped in an entity. The camera entity also had to be wrapped in its own entity. Within each entity, we can add components that can change the behavior or functionality of an object. It is through the entities that we add and the components that we assign to those entities that bring our scene to life.</p><p>In Part 2, we will continue to further break down additional elements of the A-Frame library and add a geometric entity inside of our scene!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22976d9585a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Farmboy, FETCH me that pitcher… and turn it into json data]]></title>
            <link>https://medium.com/@thetheresagarcia/farmboy-fetch-me-that-pitcher-and-turn-it-into-json-data-751ec9649858?source=rss-9d0c2a268bdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/751ec9649858</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[fetch-api]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Theresa Garcia]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 02:55:00 GMT</pubDate>
            <atom:updated>2020-03-02T02:55:00.901Z</atom:updated>
            <content:encoded><![CDATA[<p>In much the same way that Wesley fetches pitchers for Buttercup in The Princess Bride, Javascript has a Fetch API that fetches resources for us (such as a file-path to a collection of Buttercup’s water pitchers), and allows us to turn the data located within the file-path into a format that is easy to read, load and manipulate, i.e. JSON (JavaScript Object Notation) data.</p><p>For the purposes of this post, we’re going to illustrate the basics of a how Fetch works, using GET and POST. We’ll begin with writing our own Fetch function. Let’s assume we have a url that is storing data about some of Buttercup’s water pitchers. We’ll set that url equal to a constant for easy access to it when we use the fetch function.</p><pre>const pitchers_url = &quot;http://localhost:3000/api/v1/pitchers&quot;</pre><p>Next we are going to use the Fetch API to grab that url:</p><pre>fetch(pitchers_url)</pre><p>Since the only parameter passed through is the URL, this is a GET request. Again, similar to how Wesley <strong>promises</strong> to come back to Buttercup before getting captured from the Dread Pirate Roberts, Javascript likes to make promises too. The Fetch API always returns a <strong>promise. </strong>As a beginning programmer, my understanding is that this promise means that our url object will eventually ‘do something’…we just need to tell it what to do.</p><p>So at this point, we have several methods that we can use depending on what we want to do with the data. Below are just a few examples:</p><ul><li>json() — Resolves the promise with a <a href="https://attacomsian.com/blog/what-is-json#json-objects">JSON object</a></li><li>text() — Resolves the promise with plain text</li><li>blob() — Resolves the promise with a Blob object (i.e. immutable, raw data)</li></ul><p>For the purposes of this example, we want to turn this water pitcher data into JSON. The reason being is that it’s a light-weight format which allows us to store and transport data across servers quickly, efficiently, and in an easy-to-read format.</p><p>So to turn our object into json and resolve our initial Fetch promise, we use the then() function, where we will pass in the response we received and call the .json() method on it which will parse through the data and turn it into json. The then() function also returns a promise so we have begun what is called ‘promise-chaining’ in javascript.</p><pre>fetch(pitchers_url).then(resp=&gt;resp.json())</pre><p>To quickly recap, what we’ve done up to now is GET our water pitcher data and turn it into JSON. We can now send that data to another another function to, e.g., sort our water pitchers.</p><pre>fetch(pitchers_url).then(resp=&gt;resp.json()).then(sortPitchers)</pre><p>The above can also be written like this to make our code easier to follow:</p><pre>fetch(pitchers_url)<br>.then(resp=&gt;resp.json())<br>.then(sortPitchers)</pre><p>At this point though, all we’ve done is GET our data and sort it. But what if Wesley returned and brought a new water pitcher back for Buttercup that we wanted to add to our database. In this case, we’d make a POST request within the Fetch API.</p><p>The POST fetch request will differ from the GET fetch request in that we will now be passing in two parameters to our Fetch API, our pitchers_url and an additional object with our new pitcher in it.</p><pre>let new_pitcher = {<br>  style: &#39;clay water pitcher&#39;,<br>  origin: &#39;Stolen from Dread Pirate Roberts&#39;<br>};</pre><pre>fetch(pitchers_url, {<br>    method: &#39;POST&#39;,<br>    headers: {<br>    &#39;Content-Type&#39;: &#39;application/json;charset=utf-8&#39;<br>    },<br>    body: JSON.stringify(new_pitcher)<br>})</pre><p>(Note: The stringify() method takes a Javascript object or value and converts it into JSON.)</p><p>In the above snippet, we’re grabbing our url with the data that we want to add to and using the POST method to save our new pitcher to our data.</p><p>To conclude, the Fetch API proves to be a very useful way to ‘fetch’ network resources. It’s promise based and depending on the number of arguments and methods passed into it, we can add to, edit, and even delete our data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=751ec9649858" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding Bedtime Stories: ft. The Spaceship Operator]]></title>
            <link>https://medium.com/@thetheresagarcia/coding-bedtime-stories-ft-the-spaceship-operator-ac8c9d595092?source=rss-9d0c2a268bdc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac8c9d595092</guid>
            <category><![CDATA[the-spaceship-operator]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Theresa Garcia]]></dc:creator>
            <pubDate>Mon, 10 Feb 2020 04:00:59 GMT</pubDate>
            <atom:updated>2020-02-10T04:00:59.723Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Ql1TifJqfnoHzHCaWPcKA.jpeg" /></figure><p>Having recently begun my journey into the world of code, I’ve found myself frequently being introduced to the most nonsensical looking symbols and patterns. Thus far, my favorite is one that has been affectionately named ‘The Spaceship Operator’ by veterans in the industry.</p><p>I have the Ruby .sort method to thank for this interplanetary introduction to the spaceship. Being a complete newb, it’s becoming a very common theme for me to get sucked into 5 different black holes to fully understand the initial topic in question (i.e. the .sort method in this case). But my spirals down the various black holes, and occasional wormhole, have led me to the spaceship, and for that I am forever grateful, because that is where our intergalactic story begins…</p><p>There once were three operators; the I am greater than thou, I am less than thou, and I am equal to thee operator. These operators used to live lightyears away, separated by millennia of intergalactic dust. One day, a great council was held that brought the three of them together. It was during this pivotal council meeting that these operators decided to unite their operatic forces and become an even more powerful operator, The Spaceship Operator.</p><p>In uniting their forces they gained a special skill, one that would allow them compare strings, and even integers, and return them back to whomever called upon them in a sorted array, from lowest to highest (i.e. A to Z, 1 to 3). Part of the deal in combining their forces was that each individual comparison operator would now return a single value if their operation returned true, and that value would result in a power move of <em>Stay</em> or <em>Swap</em>. They also formed an intergalactic partnership with the .sort method. It was agreed that when this method was called upon, The Spaceship Operator would appear and use its powers to assist in sorting.</p><p>The ‘I am less than thou’ operator, &lt;, would return -1 if true. Power Move = Stay.</p><p>The ‘I am equal to thee’ operator, =, would return 0 if true. Power Move = Stay.</p><p>The ‘I am greater than thou’ operator ,&gt;, would return +1 if true. Power Move = SWAP.</p><p>To test the combined powers of The Spaceship Operator, an array belonging to the Milky Way Galaxy appeared to them and asked that its planets, and hypothetical planets, be sorted. This array’s name was TSS, short for The Solar System.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0xE3yyasfzQFVdxk3f0_QQ.png" /></figure><p>Upon being called, The Spaceship Operators asked TSS if it wanted to be sorted alphabetically from A to Z or from Z to A.</p><p>“If we sort you from A to Z, we will perform this operation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*rZIvxl5g37ibt-rDpfYfLQ.png" /></figure><p>If we sort you from Z to A, we will perform this operation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*YsUjK3ubxztC-E5UJWGVkA.png" /></figure><p>.”</p><p>(*Note to reader — Many say the spaceship sorts, but actually, when you enter the spaceship and look at what is going on within its premises, it is actually comparing and swapping out elements, two at a time. It swaps.)</p><p>TSS replied that it wanted a proper swap and sort, A to Z style, and a proper explanation so that it could be certain it’s planets would remain safe during the swapping. The Spaceship Operator agreed and the swapping and sorting of TSS began.</p><p>The Spaceship Operator explained the following to TSS as it began its operations:</p><ol><li>We are going to simplify this and compare ONLY TWO ELEMENTS at a time, starting from the left and moving to the right.</li><li>The first element in the array, Mercury, will now be assigned to A, the second element, Venus, will be B.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*gsUZiBJRrAZtLvuPgK_Ycg.png" /></figure><p>3. These two elements will enter our spaceship and the duel-styled swap-off will begin with our comparison operators. We will always start with the ‘&lt;’ operator. We will continue from left to right with our spaceship operators until one of us returns a true value with our comparison.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eZ24lYRoymSGSpVnxGn_Cg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*04gZ5GS9mXw7pkp6WniMMA.png" /></figure><p>So, is A &lt; B ??? Is the first letter in A, which is now Mercury, less than B, which is now Venus (i.e. is it earlier in the alphabet since we are comparing strings in this case)? Yes, it’s true! M comes before V in the alphabet so we get a -1. Power move for both operators is a <strong>Stay</strong>.</p><p>4. Onto the next! So now, Venus will be assigned to the variable A and Earth will be assigned to the variable B since Earth is the next element in the array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*62R1e3cOW9dFsoMvxYmvCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*S7GTlj14svcsUV9BcOFOpw.png" /></figure><p>Is A &lt; B? (i.e. Is Venus &lt; Earth?) No, because V comes after E in the alphabet. So we move on to the next spaceship operator symbol which is the ‘=’ sign, but we know that these two letters aren’t the same so we finish up with the ‘&gt;’ sign. V &gt; E so we end up with a +1 and this is where the magic happens. Whenever we end up with a +1, we <strong>SWAP</strong> the two elements. So now, Earth is going to be swapped into Venus’s position.</p><p>So we have the following now…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_jL6zvBYyp7azMwXlvN1gw.png" /></figure><p>5. We keep track of everything and know that we haven’t compared Earth to the elements before it, so now we shall compare Mercury and Earth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*udWoQDEEUpfYqVoBxjPOng.png" /></figure><p>Is A (i.e. Mercury) &lt; B (i.e. Earth)? No! Damn straight it isn’t. The only operator that rings true is A &gt; B in this case. This results in a +1 which means it’s time to do the wop and<strong> SWAP! </strong>So now we have…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Y6y4RGEwP1wb5Z-5_uwBw.png" /></figure><p>6. Now we do the same to Mercury and Venus. M &lt; V is true. This means we have a -1 so we STAY.</p><p>7. Now we compare Venus to Mars…</p><p>As you can see, we continue using our comparison operators to swap through all of the elements in your array until we emerge victorious with your perfectly sorted array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*rJpfeHnT9NWpDRZoupjKTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0alHF8c82GtX0fATEO6gw.png" /></figure><p>…It was at this point in the story that the array named TSS saw the immense and seemingly magical combined powers of the spaceship operator. While the TSS array ultimately decided to not change the order of its planets and hypothetical planets, it returned home spreading the good news and cheer of what the spaceship operator could do. The beings located within TSS have since called upon The Spaceship Operator too many times to count to assist with their sorting and swapping needs. Because of The Spaceship Operator, and a few other things, all has remained well in TSS.</p><p>The end.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac8c9d595092" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>