<?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 Edgar Ong on Medium]]></title>
        <description><![CDATA[Stories by Edgar Ong on Medium]]></description>
        <link>https://medium.com/@eddgr?source=rss-b9c4c1bbfc6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*mCPJju_kusGAUnJb_cVYNg.jpeg</url>
            <title>Stories by Edgar Ong on Medium</title>
            <link>https://medium.com/@eddgr?source=rss-b9c4c1bbfc6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 10:59:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eddgr/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[Contributing to my first open source project: GatsbyNYC]]></title>
            <link>https://medium.com/@eddgr/contributing-to-my-first-open-source-project-gatsbynyc-18521c284297?source=rss-b9c4c1bbfc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/18521c284297</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[gatsbyjs]]></category>
            <category><![CDATA[styled-components]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[slack]]></category>
            <dc:creator><![CDATA[Edgar Ong]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 17:18:55 GMT</pubDate>
            <atom:updated>2019-08-14T17:18:55.688Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wtZZPxgNP-H8rtMmk8pQzw.png" /></figure><h3>Start small</h3><p>It started with Slack.</p><p>People couldn’t join the GatsbyNYC Slack channel without an invitation.</p><p>I wanted to help and found a good solution to automatically invite people to the channel when they submit their emails to a Google Form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*AAqw_Uh9Xmgl_BhVDBA8jg.png" /><figcaption>GatsbyNYC Invite Form (MVP)</figcaption></figure><p>That was easy to do and you can <a href="https://intoli.com/blog/make-a-public-slack-community/">check out the instructions here.</a></p><h3>The first step</h3><p>With the encouragement of Oleg, one of the coordinators for GatsbyNYC, the next step was to add the Slack invitation form to the GatsbyNYC website.</p><p>By creating a new page in a Gatsby project’s pages folder, it will automatically be routed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*Z8XUL0-yxh30VAwtir2pgg.png" /><figcaption>Pages can even be a Markdown file!</figcaption></figure><p>So, I create a new page and CSS file for the form.</p><p>I used React Hook’s useState to convert the form to a controlled one.</p><p>I also added a little toast to show the user they submitted their email and an invite was sent to them.</p><p>Then I added a hard coded link from the index page to the new Slack page.</p><p>I kept it simple.</p><p>My initial pull request was approved but was taught to rebase my future commits. I’ll go over rebasing in another post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*f08E9hMUSVq_Dol9IYzFVw.png" /><figcaption>Deployed to production!</figcaption></figure><h3>The second step</h3><p>After my first pull request, I wanted to work on the next thing.</p><p>There’s an entire list of things available to work on from the official repo: <a href="https://github.com/markbello/gatsbyjs-nyc/issues">https://github.com/markbello/gatsbyjs-nyc/issues</a></p><p>I wanted to help with the navigation bar. Here’s a preview of what I built:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*u-IyppizISKIgrK0sPXXlA.png" /><figcaption>I wanted to highlight the Slack page so people can join the GatsbyNYC channel.</figcaption></figure><p>While working on that, I implemented GraphQL for the navigation items since Gatsby comes with it built in.</p><p>This meant I had to add all the current pages to the config file:</p><pre>// gatsby-config.js</pre><pre>module.exports = {<br>  siteMetadata: {<br>    title: `Gatsby NYC Meetup`,<br>    <br>    ...<br>    <br>    navbarLinks: [<br>      {<br>        id: 1,<br>        name: `Gatsby NYC`,<br>        link: `/`<br>      },<br>      {<br>        id: 2,<br>        name: `Feature Requests`,<br>        link: `/feature-requests`<br>      },<br>      {<br>        id: 3,<br>        name: `Join Our Slack`,<br>        link: `/slack`<br>      }<br>    ]<br>  },</pre><pre>  ...<br>}</pre><p>This should look familiar and is comparable to creating state in a component or default state in a reducer for Redux.</p><p>Again, since Gatsby has GraphQL built in, I didn’t need to import the traditional components to render GraphQL in React. So I didn’t need to:</p><pre>import { Query } from &quot;react-apollo&quot;<br>import gql from &quot;graphql-tag&quot;</pre><p>Instead, I used Gatsby’s syntax and components for GraphQL:</p><pre>import { StaticQuery, graphql } from &quot;gatsby&quot;</pre><p>It behaves just like the Query and gql combination. This is how I query the navbarLinks:</p><pre>// components/layout/Header/index.jsx</pre><pre>&lt;StaticQuery<br>  query={graphql`<br>    query SiteTitleQuery {<br>      site {<br>        siteMetadata {<br>          navbarLinks {<br>            id<br>            name<br>            link<br>          }<br>        }<br>      }<br>    }<br>  `}<br>  render={</pre><pre>  ...</pre><pre>  }<br>/&gt;</pre><p>I also decided to refactor my previous styling by using styled components.</p><p>This allowed me to get rid of my previous CSS files and remove all inline styling.</p><pre>// components/layout/Header/index.jsx</pre><pre>import styled from &quot;styled-components&quot;</pre><pre>const NavContainer = styled.div`<br>  display: flex;<br>  align-items: center;<br>  justify-content: space-between;<br>`</pre><pre>const Header = () =&gt; (</pre><pre>  ...</pre><pre>    &lt;NavContainer&gt;</pre><pre>      ...</pre><pre>    &lt;/NavContainer&gt;</pre><pre>  ...</pre><pre>)</pre><pre>export default Header</pre><p>After that was done, I submitted my pull request!</p><h3>The next step</h3><p>I was very lucky to be able to a part of a new project.</p><p>From just these two pull requests, I learned how to: git rebase, implement GraphQL, and use styled components!</p><p>I’m looking forward to the next pull request! In the meantime, you can see my contribution here: <a href="https://www.gatsbyjs.nyc/slack">https://www.gatsbyjs.nyc/slack</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18521c284297" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practicing recursion in JavaScript by returning the Fibonacci Sequence]]></title>
            <link>https://medium.com/@eddgr/practicing-recursion-in-javascript-by-returning-the-fibonacci-sequence-195b41614060?source=rss-b9c4c1bbfc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/195b41614060</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[recursion]]></category>
            <category><![CDATA[fibonacci-sequence]]></category>
            <category><![CDATA[math]]></category>
            <dc:creator><![CDATA[Edgar Ong]]></dc:creator>
            <pubDate>Thu, 18 Jul 2019 14:10:49 GMT</pubDate>
            <atom:updated>2019-07-18T14:21:32.866Z</atom:updated>
            <content:encoded><![CDATA[<p>I was interested in the Fibonacci Sequence because I kept hearing that it’s something I should know. So I looked up the definition:</p><p>From <a href="https://www.mathsisfun.com/numbers/fibonacci-sequence.html">Math is Fun</a>:</p><blockquote>The Fibonacci Sequence is the series of numbers:</blockquote><blockquote>0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …</blockquote><blockquote>The next number is found by adding up the two numbers before it.</blockquote><p>Sounds fun, thanks Math is Fun!</p><p>This was a perfect opportunity to practice recursion with JavaScript! So I created a function that would return the sequence based on any number I input as an argument in my function. Here’s how I did it!</p><p>Before moving on, I want to quickly add my definition of recursion:</p><ul><li>Recursion is a function that calls itself until a base case is met.</li><li>A base case is solving a problem in its simplest form.</li></ul><h3><strong>Deliverables</strong></h3><p>The function should work as follows:</p><p>The function fib will accept an argument of length and when it is invoked, it will return the length of the Fibonacci Sequence based on the length. For example, if I call fib(5), I want to return the first 5 numbers in the Fibonacci Sequence: [0, 1, 1, 2, 3]</p><h3><strong>Setup</strong></h3><p>I started by creating a variable to store the base Fibonacci Sequence. It will be an array of [0, 1] because the Fibonacci Sequence always begin with 0 and 1.</p><pre>const sequence = [0, 1]</pre><pre>const fib = length =&gt; {</pre><pre>}</pre><h3><strong>Base Case</strong></h3><p>Then, I created a base case to return the sequence if true.</p><pre>const sequence = [0, 1]</pre><pre>const fib = length =&gt; {</pre><pre>  if (sequence.length === length) {<br>    return sequence<br>  }</pre><pre>}</pre><h3><strong>Logic</strong></h3><p>From there, I want to retrieve the last two numbers in the array to be used to progress to the next number.</p><p>I used the slice method and assigned it to a new variable.</p><pre>const fib = length =&gt; {</pre><pre>  if (sequence.length === length) {<br>    return sequence<br>  } else {<br>    const lastTwo = sequence.slice(-2)</pre><pre>    ...<br>  }</pre><pre>}</pre><p>Next, I sum the slices and push it into the sequence array.</p><pre>const fib = length =&gt; {</pre><pre>  if (sequence.length === length) {<br>    return sequence<br>  } else {<br>    const lastTwo = sequence.slice(-2)</pre><pre>    sequence.push(lastTwo[0] + lastTwo[1])</pre><pre>    ...<br>  }</pre><pre>}</pre><p>Finally, I call the function again to see if it hits the base case.</p><pre>const fib = length =&gt; {</pre><pre>  if (sequence.length === length) {<br>    return sequence<br>  } else {<br>    const lastTwo = sequence.slice(-2)</pre><pre>    sequence.push(lastTwo[0] + lastTwo[1])</pre><pre>    fib(length)<br>  }</pre><pre>}</pre><h3><strong>Additional Logic</strong></h3><p>We forgot about some edge cases. What if the function is called and the argument is less than 2? It would cause an infinite loop so we need to add checks.</p><p>We want the argument length to be greater than 2:</p><pre>const fib = length =&gt; {</pre><pre>  if (length &lt; 2) {<br>    return &quot;You won&#39;t get a Fibonacci sequence with this!&quot;<br>  }</pre><pre>  if (sequence.length === length) {<br>    return sequence<br>  } else {<br>    const lastTwo = sequence.slice(-2)</pre><pre>    sequence.push(lastTwo[0] + lastTwo[1])</pre><pre>    fib(length)<br>  }</pre><pre>}</pre><h3><strong>Final Code</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qVL71sP1kJIEYA6OEO2HOA.png" /><figcaption><em>My function on CodePen</em></figcaption></figure><p>Test it out on <a href="http://codepen.io/">CodePen</a> or <a href="http://jsfiddle.net/">JSFiddle</a> to see it in action, I also added a few logs so you can see the results:</p><pre>const sequence = [0, 1]</pre><pre>const fib = length =&gt; {</pre><pre>if (length &lt; 2) {<br>    console.log(&quot;You won&#39;t get a Fibonacci sequence with this!&quot;)</pre><pre>    return &quot;You won&#39;t get a Fibonacci sequence with this!&quot;<br>  }</pre><pre>  if (sequence.length === length) {<br>    console.log(&quot;Same length, here&#39;s your sequence:&quot;, sequence)</pre><pre>    return sequence<br>  } else {<br>    console.log(&quot;Not the same length, current sequence:&quot;, sequence)</pre><pre>    const lastTwo = sequence.slice(-2)</pre><pre>    sequence.push(lastTwo[0] + lastTwo[1])</pre><pre>    fib(length)<br>  }</pre><pre>}</pre><p>Is there a better way to do this? Probably! So I’m going to keep practicing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=195b41614060" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy Create-React-App as a production build on Heroku]]></title>
            <link>https://medium.com/@eddgr/deploy-create-react-app-as-a-production-build-on-heroku-3a4965843929?source=rss-b9c4c1bbfc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a4965843929</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[heroku]]></category>
            <dc:creator><![CDATA[Edgar Ong]]></dc:creator>
            <pubDate>Tue, 09 Jul 2019 14:02:59 GMT</pubDate>
            <atom:updated>2019-07-09T14:02:59.942Z</atom:updated>
            <content:encoded><![CDATA[<p>Go from development to production with this one trick!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_p8qDvCq5kK-cKOy" /><figcaption>Photo by <a href="https://unsplash.com/@sapegin?utm_source=medium&amp;utm_medium=referral">Artem Sapegin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Clickbait title aside, it is that easy!</p><p>After deploying my React project on Heroku, I wanted a way to quickly switch between my local development environment and the production environment.</p><p>I was switching between my local backend endpoints and the production one by commenting them in and out of my code. Very tedious and probably not the best way to do it, haha.</p><h3>React Configuration</h3><p>I discovered that React comes with a built in process.env.NODE_ENV and can be used to switch between development and production. This means:</p><pre>if (process.env.NODE_ENV === &#39;production&#39;) {</pre><pre>  Run production code here</pre><pre>} else {</pre><pre>  Run development code here</pre><pre>}</pre><p>My immediate use case was to set variables to my API endpoints for production and development. It looks something like this:</p><pre>let API_ENDPOINT </pre><pre>if (process.env.NODE_ENV === &#39;production&#39;) {</pre><pre>  API_ENDPOINT = https://production.live/api</pre><pre>} else {</pre><pre>  API_ENDPOINT = http://localhost:8000/api</pre><pre>}</pre><pre>fetch(API_ENDPOINT)<br>  .then(response =&gt; response.json())<br>  .then(data =&gt; { Do something with the data })</pre><p>That’s all we need on the coding side!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*2reLyseGCs_C-X73K7zuBg.png" /><figcaption>Development build shown by React Developer Tools</figcaption></figure><p>Since React defaults process.env.NODE_ENV to development, we need a way to change it to production on the production side.</p><p>Before we move forward, you should be familiar with deploying to Heroku.</p><p>If not, learn how here: <a href="https://dev.to/smithmanny/deploy-your-react-app-to-heroku-2b6f">https://dev.to/smithmanny/deploy-your-react-app-to-heroku-2b6f</a></p><h3>Heroku Configuration</h3><p>The first thing we need to do to get started with Heroku is to change the Buildpack.</p><p>Log in to your Heroku dashboard and navigate to your project’s Settings.</p><p>We need to remove the default buildpack and replace it with this one: <a href="https://github.com/mars/create-react-app-buildpack.git">https://github.com/mars/create-react-app-buildpack.git</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*g_fTswWVutK63sdDaJx6eA.png" /><figcaption>Update Heroku Buildpack</figcaption></figure><p>Additionally, since you’re in your project’s Settings, go up to your Config Vars section. Click Reveal Config Vars and add NODE_ENV and production as the key and value pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*AkwSMgJzCGCVy0iD6IH8oA.png" /><figcaption>Add production variables `NODE_ENV` and set it to `production`</figcaption></figure><h3>Deploy!</h3><p>On your next deploy, your React project will be deployed with a production build!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*Fd0pVhyYaHhGZ9Tk41Ya9w.png" /><figcaption>Production build shown by React Developer Tools</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FvvbGMpbhZMcHSsD50w%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FvvbGMpbhZMcHSsD50w%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExOHFsdXJqaXdmaDZ4eDV6dDlmOXo0c2I0dm1xYmw3MDczcWQ2a3dqYyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FvvbGMpbhZMcHSsD50w%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/818bd659e03d0e44aeea9a852090169a/href">https://medium.com/media/818bd659e03d0e44aeea9a852090169a/href</a></iframe><p><strong>Sources</strong></p><p><a href="https://blog.heroku.com/deploying-react-with-zero-configuration">Deploying React with Zero Configuration</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a4965843929" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MealPal and the future of the food industry]]></title>
            <link>https://medium.com/@eddgr/mealpal-and-the-future-of-the-food-industry-6f602f9fa429?source=rss-b9c4c1bbfc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f602f9fa429</guid>
            <category><![CDATA[lunch]]></category>
            <category><![CDATA[food-delivery]]></category>
            <category><![CDATA[food]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[mealpal]]></category>
            <dc:creator><![CDATA[Edgar Ong]]></dc:creator>
            <pubDate>Thu, 20 Jun 2019 01:34:15 GMT</pubDate>
            <atom:updated>2019-06-20T01:34:15.903Z</atom:updated>
            <content:encoded><![CDATA[<p>Delivery start ups have exploded.</p><p>Let’s look at some of these valuations:</p><ul><li><strong>Uber Eats</strong> — $20 billion</li><li><strong>Instacart</strong> — $7.6 billion</li><li><strong>DoorDash</strong> — $4 billion</li><li><strong>Postmates</strong> — $1.2 billion</li></ul><p>This is great for the start up but not so great for the customers because delivery is more expensive than ordering in person.</p><p>Luckily, there are services that cater to picking up or ordering food in person.</p><h3>Enter MealPal</h3><p>As a MealPal subscriber, I pay about $6 per meal for lunch. Being based in New York, that’s a steal!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WHZ8xibq2gUtMhckCEq24Q.jpeg" /></figure><p><strong>How does it work?</strong></p><ul><li>Sign up and pay for a MealPal plan. It is subscription based and each plan requires paying for each month up front.</li><li>Download their app to browse and select the meal wanted for the next day. The meal for each restaurant is the same for every user.</li><li>When it’s lunchtime, go to the restaurant, skip the line and scan the MealPal QR code, then pick up the lunch.</li></ul><p>MealPal has saved me both time and money.</p><p>I’ve been using MealPal for months and have always been curious about their business model.</p><h3><strong>Why restaurants work with MealPal</strong></h3><h4><strong>Catering vs Individual Orders</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*psTSbAv3T_SABrDG" /><figcaption>Photo by <a href="https://unsplash.com/@dylan_nolte?utm_source=medium&amp;utm_medium=referral">dylan nolte</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>MealPal is able to offer lower prices because it gives restaurants large orders for individual dishes in advance. It’s similar to a catering model, which [MealPal co-founder Mary] Biggins said is typically the most profitable order for restaurants.</blockquote><blockquote><a href="https://vimeo.com/219780618">MealPal tested this theory with Freshii</a>, a fast casual salad chain. They had 22 friends stand in line, order off the menu, and wait for the meals to be prepared. It took the restaurant 28 minutes in total.</blockquote><blockquote>It then asked Freshii to make 100 orders of the same meal.</blockquote><blockquote>“They were able to complete this order in 29 minutes — almost the exact same amount of time, but, for a fraction of the labor cost per meal,” noted Biggins[.]</blockquote><p>It turns out that making a bulk order of one meal is more cost effective than making a bulk order of different meals.</p><p>With only one meal to focus on, it makes it easier for restaurants to forecast inventory and manage a daily meal calendar.</p><h4><strong>Data Driven</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OssOfscq6eos2cy9" /><figcaption>Photo by <a href="https://unsplash.com/@srd844?utm_source=medium&amp;utm_medium=referral">Stephen Dawson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>“We collect data from consumers to decide what they like and don’t like. We are able to tell what’s most likely to be ordered in certain markets and on certain days,” [Mary Biggins] said.</blockquote><blockquote>They also monitor customer ratings and feedback to restaurants what they might need to change in a serving. “We use that to help restaurants figure out how to put together their meals.”</blockquote><p>Extra insight is provided for restaurants to help them focus on building a better, more profitable menu.</p><h4>Exposure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-XVfE6-79wfurHj_" /><figcaption>Photo by <a href="https://unsplash.com/@danielcgold?utm_source=medium&amp;utm_medium=referral">Dan Gold</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>MealPal provides customers new restaurants to explore that may have otherwise overlooked.</p><p>In addition, restaurants are guaranteed a set of amount of meals that will be sold per day, which helps to forecast the business’ revenue.</p><h3>Not always a MealPal</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jtT8ZfSjjDR4Bfw7" /><figcaption>Photo by <a href="https://unsplash.com/@miteneva?utm_source=medium&amp;utm_medium=referral">Maria Teneva</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It’s not all rainbow and sunshine for MealPal.</p><p>The company entice restaurants to join their network by providing restaurants a profitable price for each meal ordered while still making a profit for themselves.</p><p>However, after this grace period is over, it becomes less profitable for restaurants.</p><p>Additionally, MealPal has the power to limit the amount of meals a restaurant can provide so they do not have to overspend on a restaurant if it’s not profitable for the company.</p><p>Lastly, from time to time, menu items for restaurants shown in MealPal may not be available and the time frame to correct the error results in negative customer reviews and experiences.</p><h3><strong>Food for thought</strong></h3><p>The food industry will continue to change.</p><p>As long as they are able to adapt to their customers needs and willing to try out new ways to connect their food with their customers, they’ll be ahead.</p><p>As for MealPal, they’re a company that adds value to both customers and businesses, while remaining profitable. Amazing.</p><p><strong>Sources</strong></p><ul><li><a href="https://www.geekwire.com/2018/mealpal-takes-uber-amazon-peach-new-6-lunch-delivery-service-seattle/">MealPal takes on Uber, Amazon, Peach with new $6 lunch pickup service in Seattle</a></li><li><a href="https://techcrunch.com/2017/09/19/mealpal-gobbles-20m-for-its-restaurant-meal-subscription-service/">MealPal gobbles $20M for its restaurant meal subscription service</a></li><li><a href="https://ny.eater.com/2016/7/14/12176954/mealpass-restaurant-payment-reaction">La Pecora Bianca Leaves Lunch Start-Up MealPass After &#39;Bait and Switch&#39; On Pricing, Owner Says</a></li><li><a href="https://www.crunchbase.com/organization/mealpal">MealPal | Crunchbase</a></li><li><a href="https://thespoon.tech/3-5-billion-invested-in-food-delivery-startups-this-year/">$3.5 Billion Invested in Food Delivery Startups This Year</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f602f9fa429" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy your first Rails project on Heroku in less than 5 minutes]]></title>
            <link>https://medium.com/@eddgr/deploy-your-first-rails-project-on-heroku-in-less-than-5-minutes-72a1952c90ff?source=rss-b9c4c1bbfc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/72a1952c90ff</guid>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[deployment]]></category>
            <dc:creator><![CDATA[Edgar Ong]]></dc:creator>
            <pubDate>Sun, 26 May 2019 19:01:08 GMT</pubDate>
            <atom:updated>2019-06-07T12:06:13.155Z</atom:updated>
            <content:encoded><![CDATA[<p>You built your first project and now you want to show it your friends and family.</p><p>You can bring your computer over and have everyone gather around.</p><p>What if the people we want to show it to are not nearby?</p><p>One solution is to put it on the internet so they can access it on their own time and on their own computer!</p><p>Enter Heroku.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IdXgBSagHPsp_3E8JwMT4Q.png" /></figure><h3>What is Heroku?</h3><p>Heroku is an application hosting service provider that handles all the infrastructure, which include but not limited to:</p><ul><li>Providing a server for http requests and database calls</li><li>Setting up application environment for deploying code</li><li>Logging and monitoring the server to automatically scale up or down to handle traffic to the application</li></ul><p>Since Heroku deals with all that, all we need to do is push our code to their server and our app will be live.</p><p>Heroku is also amazing for beginner developers because it provides a free tier of their service to test our projects in a live environment.</p><h3>Sign up for Heroku and install the Heroku CLI</h3><p>To get started, sign up for an account: <a href="https://signup.heroku.com/">https://signup.heroku.com/</a></p><p>Afterwards, install the Heroku CLI: <a href="https://devcenter.heroku.com/articles/heroku-cli#download-and-install">https://devcenter.heroku.com/articles/heroku-cli#download-and-install</a></p><p>The Heroku CLI will save us time when pushing our project to Heroku.</p><h3>Update your project files and push to Heroku</h3><p>We’re only a few steps away from deploying our project!</p><p>Before we do anything, we have to update our Gemfile.</p><p>We only need to make two changes:</p><ol><li>Move gem &#39;sqlite3&#39; in to the :development group.</li><li>Create a new :production group and include gem &#39;pg&#39; (Postgres).</li></ol><p>It should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*72AYkLpXmg3RI--KifTHpw.png" /><figcaption><em>Move ‘sqlite3’ to :development and create :production with ‘pg’.</em></figcaption></figure><p>After you update your Gemfile, open up your Terminal.</p><p>In your Terminal:</p><ul><li>cd in to your project folder</li><li>bundle --without production will update the bundle with the changes we made in the Gemfile.</li><li>git push to master</li><li>heroku login will authenticate your account</li><li>heroku create will create a remote to your Heroku server to deploy to. You can customize the name of your project by adding a project-name.</li><li>git push heroku master will push to your Heroku remote</li><li>heroku run rails db:migrate will create the first database migration on your brand new project</li></ul><h3>You’re live!</h3><p>Your project is now live on the internet!</p><p>You can check your app url by typing in heroku domains in your project folder in Terminal. <em>Example url: </em><a href="https://not-instagram-app.herokuapp.com/"><em>https://not-instagram-app.herokuapp.com</em></a></p><p>That’s it!</p><p>Now go share your project with your friends and family!</p><h3>Limitations</h3><p>On the free tier of Heroku, if our project is inactive for 30 minutes, the server will go to sleep. This means it may take longer than usual for our project to reload.</p><p>Additionally, the free tier provides only 1000 hours of server time per month. Once we use all the hours, our app will stop working.</p><p><strong>Sources</strong></p><ul><li><a href="https://www.youtube.com/watch?v=5kVtmnZNC8w"><em>https://www.youtube.com/watch?v=5kVtmnZNC8w</em></a></li><li><a href="https://www.reddit.com/r/explainlikeimfive/comments/1a9vwr/eli5_heroku/"><em>https://www.reddit.com/r/explainlikeimfive/comments/1a9vwr/eli5_heroku/</em></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72a1952c90ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything on the internet is made of Forms]]></title>
            <link>https://medium.com/@eddgr/everything-on-the-internet-is-made-of-forms-edf6a37df359?source=rss-b9c4c1bbfc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/edf6a37df359</guid>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Edgar Ong]]></dc:creator>
            <pubDate>Sun, 05 May 2019 14:11:57 GMT</pubDate>
            <atom:updated>2019-05-05T14:19:51.370Z</atom:updated>
            <content:encoded><![CDATA[<h4>Once you see it, you won’t be able to unsee it!</h4><h4>What are Forms?</h4><p>Forms are used by apps to accept input from users to interact with the app. Think sign up form, log in form, search form, and so on.</p><h4>Why are Forms important?</h4><p>Forms are for users to interact with the entire app. From the model, view, controller, and everything under the hood of our app, forms are the first steps to that.</p><p>As a person learning Ruby on Rails, one of the first things I learned to build were forms. I built a lot of them.</p><p>Then I started noticing something on all the websites I go to…forms are everywhere!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FCKrlUi30dn44w%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FCKrlUi30dn44w%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FCKrlUi30dn44w%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/5b953dfbbcdde2bfed6c460e7cba2a03/href">https://medium.com/media/5b953dfbbcdde2bfed6c460e7cba2a03/href</a></iframe><h4>Examples of Forms</h4><p>You’re probably interacting with forms everyday and not realize it!</p><p>Here’s an example of Facebook and when you want to share a post with your friends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*On51txufMhm64KsjDipgqA.png" /><figcaption><em>Facebook’s post form</em></figcaption></figure><p>How about Twitter? That’s a form for tweets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*C7aDaP5Vf3LOdBpylXoLBw.png" /><figcaption>Twitter’s tweet form</figcaption></figure><p>Let’s not forget about Medium, which is a giant form for writing an article in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A5J_mj_wffsxQ3nhaQ8mlQ.png" /><figcaption>Medium’s article post form</figcaption></figure><p>Some forms, like Spotify, accepts input from users with a search form to return a list of songs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*oBtAibS9Bff99IKfS49teA.gif" /><figcaption>Spotify’s search form</figcaption></figure><h4>How about YouTube though?</h4><p>Streaming websites like YouTube, Netflix, and Twitch are more viewer centric so we don’t normally interact with forms outside of sign up or search forms.</p><p>We generally see something like this on our YouTube page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*H49IyYWo-Lwj0ZBquHxNNg.png" /><figcaption>My YouTube subscriptions</figcaption></figure><p>However, think about where the content is coming from.</p><p>There is someone on the other side of the content, someone who’s interacting with a form for uploading content, creating a title and description, adding tags, then pressing a button to publish it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RD06165qei6Cjcoj3S896A.png" /><figcaption>YouTube’s upload form</figcaption></figure><h4>Mind-blown interlude</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FUm3ljJl8jrnHy%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FUm3ljJl8jrnHy%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FUm3ljJl8jrnHy%2F200.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="284" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9c207914b966dace7dbb09e171229e2/href">https://medium.com/media/d9c207914b966dace7dbb09e171229e2/href</a></iframe><h4>Forms are everywhere!</h4><p>Forms are styled so we don’t notice them right away but most apps and websites rely on our input as users to move things forward.</p><p>After noticing all these forms, I can’t unsee it anymore!</p><h4>What does this mean as a developer?</h4><p>Once you see this, it’s like seeing the Matrix. The fundamentals of user interaction begins with a form!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FrvsIuQkF1iL3G%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FrvsIuQkF1iL3G%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FrvsIuQkF1iL3G%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="182" frameborder="0" scrolling="no"><a href="https://medium.com/media/704ab547bb83d8df4883f80d3243249a/href">https://medium.com/media/704ab547bb83d8df4883f80d3243249a/href</a></iframe><p>As a student learning the skills to become a software engineer, it has opened my eyes to the possibilities of things I can build.</p><p>I can make anything and I can do it by starting with a form!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edf6a37df359" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Absolute Beginners Guide to Using Pry in Ruby]]></title>
            <link>https://medium.com/@eddgr/the-absolute-beginners-guide-to-using-pry-in-ruby-b08681558fa6?source=rss-b9c4c1bbfc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b08681558fa6</guid>
            <category><![CDATA[pry]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Edgar Ong]]></dc:creator>
            <pubDate>Thu, 18 Apr 2019 00:01:03 GMT</pubDate>
            <atom:updated>2019-04-18T00:01:03.927Z</atom:updated>
            <content:encoded><![CDATA[<p>I have learned more about Ruby from debugging my code with Pry than I did by just learning new Ruby methods!</p><p>We’re going to go over how Pry works and how we can use it to test our code.</p><h3>Why use Pry?</h3><ul><li>Validates our hypothesis by being able to test different methods from one place, saving us a lot of time.</li><li>No need to re-type our code every time we want to tweak or test our new code because Pry will have access to all classes, methods, variables, etc that are run before it.</li><li>Quickly determine if code is working based on the placement of Pry.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*_4YNVZ8jusKoGF9YLob6ig.png" /><figcaption>Pry will not run if it is placed after invalid code.</figcaption></figure><h3>Let’s use Pry together (step by step with example)</h3><p><em>For this demonstration, I am using a computer running MacOS.</em></p><p><em>Before we get started, download Pry by opening up your Terminal app and typing: </em><em>gem install pry</em></p><p><em>You can follow along by cloning the repo here: </em><a href="https://github.com/eddgr/practice-pry"><em>https://github.com/eddgr/practice-pry</em></a></p><h4>Step 1: Set up Pry</h4><ul><li>In the example, we want the return_the_tomato method to return &quot;tomato&quot; from the fruits array.</li><li>require &#39;pry&#39; at the top of the file you and then add binding.pry where you want to debug.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v9DV2oVzBJJAH1h1XVfCjg.png" /><figcaption><strong>require ‘pry’</strong></figcaption></figure><h4>Step 2: Run it!</h4><ul><li>After we run the file, ruby pry_array.rb, we arrive inside the Pry.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*rg0Liex-t3muLzs2_OGABA.png" /></figure><ul><li>To explain where we are in Pry, we need to look at the file we’re running. If we comment out return_the_tomato(fruits) and rerun the file, Pry doesn’t run. Why?</li><li>When using Pry, we need to ensure that we’re calling the method we’re trying to test or debug. In this case, since Pry is inside the return_the_tomato method, we need to run the method. So lets uncomment return_the_tomato(fruits).</li></ul><h4>Step 3: Test it!</h4><ul><li>Type array and see what it returns.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*QXlehEBvxsgC2vr1VzK_uQ.png" /><figcaption><strong>array</strong> returns our <strong>fruits</strong> array!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*uESpVb1FrORejh9mrvRTaw.jpeg" /></figure><ul><li>Why is it showing the fruits array? Since we’re inside the method after the method was called on the fruits array, we can now access it by typing array.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*PHiARdzTE1ePHnwYMVQIdA.jpeg" /></figure><ul><li>But why array?</li><li>That’s because in the method we defined, we pass the argument called array.</li><li>Now, let’s test some ways we can reach &quot;tomato&quot; in the array!</li></ul><h4>Step 4: ???</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*RyPlGzN9idhKtle16Zi7WA.png" /><figcaption>Return from <strong>array.last</strong></figcaption></figure><p>Let’s start by using array.last since &quot;tomato&quot; looks like it’s the last item in the array.</p><p>Okay, this is returning the last item which is another array. Okay, that makes sense since it’s a nested array.</p><p>We’re close! How can we reach the last item? We can use .last again, but let’s try a different method. Let’s call the index of [&quot;tomato&quot;].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*drzNb65OAiNSZuR-Uxnsig.png" /></figure><p>We’re going to call it by using array.last[2].</p><p>It returns the array we wanted. Now we’re really close!</p><p>To get to the string of &quot;tomato&quot;, we have to select the first item in this array. We’ll use array.last[2][0].</p><p>There we have it, we finally got our &quot;tomato&quot;!</p><p>There are many ways to solve this, see if you can find another solution!</p><h4>Step 5: Profit</h4><p>Once you come up with a solution, go back to your file and use the code you came up with in Pry!</p><h3>Pry tips to remember!</h3><ul><li>Press q to start typing if you’re in scroll mode:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*AKkNM78_X468Nzoh27q3AA.png" /><figcaption>Scroll mode in Pry</figcaption></figure><ul><li>You can run the loop variables if you’re in that Pry as well as outside variables, classes, or methods.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*BsJZIeu2oSGePmBfu_avSw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*VK441LQjxqgpvBRZJDh7lw.png" /><figcaption><strong>arr</strong> is a variable that can now be accessible because our Pry is in the loop.</figcaption></figure><ul><li>If you’re using Atom, when the shortcut to writing binding.pry is by typing pry then pressing tab or enter.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*0f1gLQMZHs_EG41aB9TJuQ.png" /><figcaption>Type <strong>pry</strong> then press <strong>tab</strong> or <strong>enter</strong></figcaption></figure><ul><li>You can create new variables.</li><li>Use _ to return last the line returned.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*R7btTHwSh9G22pl1_YE3Sg.png" /><figcaption>We created a new variable where <strong>new_array = _</strong></figcaption></figure><ul><li>Use exit! so you exit pry if you are using multiple Prys. If you just use exit, you’ll loop back in to the Pry.</li></ul><h3>Give Pry a Try!</h3><p>I have more practice examples here: <a href="https://github.com/eddgr/practice-pry">https://github.com/eddgr/practice-pry</a></p><p>There are additional questions and another set of examples for hashes.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3o6UBipuQxa6QwnvC8%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3o6UBipuQxa6QwnvC8%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3o6UBipuQxa6QwnvC8%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="498" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a372079f6ae361564657fbca64a472e/href">https://medium.com/media/2a372079f6ae361564657fbca64a472e/href</a></iframe><p>You can also find the official documentation for Pry here: <a href="https://pryrepl.org/">https://pryrepl.org/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b08681558fa6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>