<?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 Robert Cooper on Medium]]></title>
        <description><![CDATA[Stories by Robert Cooper on Medium]]></description>
        <link>https://medium.com/@robertcooper_rc?source=rss-3f6e1adb0f22------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SMK5A3YMiR73Ht1GkXfhgQ.jpeg</url>
            <title>Stories by Robert Cooper on Medium</title>
            <link>https://medium.com/@robertcooper_rc?source=rss-3f6e1adb0f22------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 23 May 2026 06:46:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@robertcooper_rc/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[No Longer Actively Publishing on Medium]]></title>
            <link>https://medium.com/@robertcooper_rc/no-longer-actively-publishing-on-medium-c0eb0bc4afe4?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0eb0bc4afe4</guid>
            <category><![CDATA[medium]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Tue, 19 Feb 2019 03:44:43 GMT</pubDate>
            <atom:updated>2019-02-19T03:57:51.078Z</atom:updated>
            <content:encoded><![CDATA[<p>At the beginning of this year, I added a blog to my <a href="https://www.robertcooper.me/">own personal website</a>. I’ve cross posted some of the articles I’ve added to my website on both Medium and the Dev Community. However, I’m going to stop using Medium as a publishing platform (except for exceptional cases).</p><h3>Why?</h3><h4>Manual Work</h4><p>It’s becoming more of a hassle to publish my content in multiple places on the internet, especially since the content isn’t easily exportable from my website into a format that works well with Medium. I often have to spend a lot of time properly formatting the blog posts that I’ve already written, so it makes for a decent amount of extra work.</p><h4>Low Engagement</h4><p>Compared to the Dev Community, the articles I post on Medium don’t get viewed all that much and people usually don’t post as many comments on Medium. I love engaging with an audience related to the content I write, and Medium hasn’t been all that fruitful in that regard.</p><p>I should remark that I have received a lot of views when I published my articles for large tech publications on Medium. However, the review process to get articles published can be long and laborious. I’d rather publish content on my own timeline.</p><h4>Syntax Highlighting</h4><p>This is a major grippe for me. Medium hasn’t implemented support for syntax highlighting of code blocks, even though there is a huge community of developers that use the platform. I know that this has been a very widely requested feature and it’s disappointing that they still haven’t implemented it within their platform.</p><p>Anyways, if you want to stay up-to-date regarding my latest dev articles, you can subscribe to the <a href="https://www.robertcooper.me/rss.xml">RSS feed for my website</a>, <a href="https://twitter.com/RobertCooper_RC">follow me on Twitter</a>, or <a href="https://dev.to/robertcoopercode">follow me at the Dev Community</a>.</p><p>✌🏻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0eb0bc4afe4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Refreshing My Personal Website]]></title>
            <link>https://medium.com/@robertcooper_rc/refreshing-my-personal-website-9d7efec2db64?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d7efec2db64</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[gatsbyjs]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[portfolio]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Tue, 01 Jan 2019 01:27:34 GMT</pubDate>
            <atom:updated>2019-01-01T01:33:55.567Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Des-lMmEmjwAaF79X6oRSg.png" /></figure><blockquote>Originally posted <a href="https://www.robertcooper.me/refreshing-my-personal-website">on my blog</a></blockquote><p>I’ve decided to redo my website, yet again. This is the 3rd or 4th iteration of my website.</p><p>Here were the motivations and goals for the redesign:</p><h4>1. Host my blog articles on my own website</h4><p>I’ve been writting a lot on both <a href="https://medium.com/@robertcooper_rc">Medium</a> and a bit on <a href="https://dev.to/robertcoopercode">Dev Community</a>, but I want to have a bit more control in the design and presentation of my blog posts. One of my biggest gripes with Medium is the lack of syntax highlighting for code blocks.</p><h4>2. Better highlight past projects</h4><p>In 2019, I want to work with a few clients on a part-time basis to supplement the income I make through my full-time job. The first step to doing that was to make sure I can showcase some of my past work in a favorable light.</p><h4>3. New tech stack</h4><p>My previous website was using gulp to build HTML pages from templated <a href="https://pugjs.org/api/getting-started.html">pug files</a>. This wasn’t that bad since I only had one page on the website, so there wasn’t a need to move between pages. However, now that I was going to include a blog, I was going to have to have multiple pages on the website and thus I wanted to use React to get the performance associated with a single page application.</p><h3>Design</h3><p>So with those three goals in mind I started to research blogs that I admired. I made sure to screenshot and anotate any elements that stood out to me. I gathered all those screenshots in my design app of choice: <a href="https://www.figma.com/">Figma</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T02EQUrJzQIJUWDbElEXtw.png" /><figcaption><em>A collection of screenshots from the blogs and websites that I admire.</em></figcaption></figure><p>After I gathered all the pieces of inspiration, I went ahead and designed my own website. I knew I wanted to have both a light and dark theme to my website, so I made sure to design both variations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wjsxXfbaGCz_ahaSD7qEZw.png" /><figcaption><em>The designs for both light and dark theme pages of my new website.</em></figcaption></figure><p>The reason why I create design mockups instead of just coding the site straight away is so that I can quickly test out which designs look good. I find that I end up doing a few design interations before coming up with a final design. Doing those different variations in code rather than in a design software would take much longer. I also find it helps me better organize my work when I design the project before going into the code, and it ultimately saves me time.</p><h3>Home Page</h3><p>The home page, being the first place site visitors land when they visit my site, includes a short description of who I am, the blog articles I’ve recently written, as well as a preview of the recent projects I’ve worked on. I made sure to animate elements on the page, using the <a href="https://github.com/michalsnik/aos">animate on scroll library</a>, to make the experience slightly more enjoyable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EddZe0LcOn37BeEO8P86zg.gif" /><figcaption><em>The home page elements fade into the page as a user scrolls.</em></figcaption></figure><p>I’ve included a headshot of myself and I tried to crop out all of the background from the image. Unfortunately, I don’t have the design skills required to get rid of some of the white background from my hair and it is prooving to be quite the annoyance every time I see it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bytEiknGiJ3hWI9bhLhhcg.png" /><figcaption><em>Lingering white background that remains on the headshot image 😑</em></figcaption></figure><h3>Projects</h3><p>I’ve created a page to better showcase my past projects. Each app is presented in a similar way, with screenshots of the apps found within desktop/mobile device frames. Each project is also given it’s own section with a short description along with keywords indicating the main technologies used for the projects. A call to action section is found at the bottom of the page for any visitors interested in working together on a project.</p><p>In the future, I plan to create full pages for each project in order to present them as full blown case studies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bf4a07VFwWl5WhGm09LBZw.png" /><figcaption><em>The new projects page of the website showcases three recent projects and a call to action link at the bottom of the page.</em></figcaption></figure><h3>Blog</h3><p>The blog is where things get exciting technology wise. The website is built with React and <a href="https://www.gatsbyjs.org/">Gatsby</a>. I’m also using <a href="https://gatsby-mdx.netlify.com/">gatsby-mdx</a> which allows me to write my blog posts using MDX. <a href="https://github.com/mdx-js/mdx">MDX</a> is a different flavour of Markdown which allows for the use of JSX and React components to coexist with markdown in the same file.</p><p>If I want to include a custom React component into a blog post to make the post more interactive, I can now do that in MDX. As an example, I can embed the theme switcher component I’m using for my website right into this post:</p><blockquote>See <a href="https://www.robertcooper.me/refreshing-my-personal-website">article on my website</a> for the embed React component.</blockquote><p>I’m quite excited to take advantage of the power of MDX in some of my future blog articles.</p><p>Another feature I’ve added to my blog is the horizontal progress bar indicating a user’s progress through a blog post. I’ve seen this UI pattern on some other blogs and have enjoyed it myself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sQUrFQJkH8h_8YIF_d_pow.gif" /><figcaption><em>An horizontal progress bar at the top of a blog article indicates how much further a user needs to scroll to reach the bottom of the page.</em></figcaption></figure><p>I’ve also include a comment section to blog posts using the Disqus embed. This was surprisingly easy to incorporate into the website using <a href="https://github.com/disqus/disqus-react">disqus-react</a>.</p><h3>Dark / Light Theme</h3><p>Perhaps my favourite part of the website is the ability to toggle between a dark and light themes. I’m using <a href="https://www.styled-components.com/">Styled Components</a> to manage the styles on my website and it fortunately has great a <a href="https://www.styled-components.com/docs/advanced#theming">API for managing theming</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mXUTlubYiPqKnu_JkdQNkA.gif" /><figcaption><em>Toggling between dark and light theme.</em></figcaption></figure><p>I’d like to point out that the design and functionality of the theme toggle switch was all taken from <a href="https://twitter.com/thekitze">@thekitze</a>’s Twizzy App <a href="https://twizzy.app/">landing page</a>. I’m always thankful when talented people like this make their projects open source to allow others to benefit.</p><p>I hope to continue to make incremental improvements to my website. Some of the things I’d like to add include unit testing, end to end testing, and an RSS feed to the website. There are also a few bugs I need to squash 👞🐜.</p><p><a href="https://github.com/robertcoopercode/personal-website">View the source code</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d7efec2db64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Idea to App Store: Building My First iOS App With React Native]]></title>
            <link>https://uxdesign.cc/from-idea-to-app-store-building-my-first-ios-app-with-react-native-c64f1ed76fca?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/c64f1ed76fca</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[passive-income]]></category>
            <category><![CDATA[app-store]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[mobile-development]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Mon, 22 Oct 2018 23:11:42 GMT</pubDate>
            <atom:updated>2018-12-25T06:34:26.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g90N2597wOZn6mqXeQ__GA.png" /></figure><p>I recently got my first iPhone app accepted into the Apple App Store. It is quite exciting to be able to have a product i’ve been working on by myself now available for a whole bunch of people to download. I tried to use a structured approach for the whole app creation/release process and I’ve outline that process in this article.</p><h4>Motivation</h4><p>Why did I want to build an iOS app in the first place? Well, I like <strong>building out things that could be of use to myself and others</strong>. Creating an app downloadable from the App Store makes it very easy for others to get the app on their phone and start using it. I have a bit of experience working with React Native at one of my previous jobs, so I was confident I could build the app myself.</p><p>There is also the <strong>possibility for me to generate some passive income with iOS apps</strong>, if I choose to monetize the app. I realize that the majority of apps in the app store make very little, so this is by no means my primary objective.</p><h4>App Idea</h4><p>I wanted to <strong>build an app that I would want to use</strong>, but that others would also want to use. I also, didn’t want to create something that already exists since I wanted to provide a unique solution to a problem. A lot of developers create games for the App Store, but I did not want to do that since I don’t play games on my iPhone and I find that games generally don’t positively impact a person when they play them.</p><p>I’m someone that’s interested in keeping up-to-date with the latest in health, nutrition, and performance, and I’ve noticed a dieting trend called the <a href="https://meat.health/knowledge-base/carnivore-diet-what-to-eat/"><strong>carnivore diet</strong></a>, that a lot of people have been benefiting from. Out of curiosity, I decided to try the diet, and I quite enjoy it, so I’ve stuck with it so far. The diet only allows for meat products to be eaten.</p><p>Since the carnivore diet is something that is a fairly recent phenomena, there weren’t any apps catered towards the diet and so I thought that might be a good void to fill. I got the <strong>idea of creating a food journalling app that would only allow for the addition of meat as food entries</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lIPi2H6AMr_mivY0AeR9Ww.jpeg" /><figcaption>I decided to go ahead and create a meat journaling app for the carnivore diet (Photo by <a href="https://unsplash.com/photos/DVRXFIH42d0?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jez Timms</a> on <a href="https://unsplash.com/search/photos/meat?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>)</figcaption></figure><h4>Planning</h4><p>Once I decided what my iOS app would be about, I <strong>wrote a summary of what I wanted the app to do</strong> so that I could keep it in mind while looking at features to add. Here’s what I came up with:</p><blockquote>An application to record entries of the meat eaten during the day. Targeted towards those following a carnivore diet. The app is simple and doesn’t include calories because people on the carnivore diet just eat until they are full. The app is a way to journal the amount of food eaten. A simple app with no extra fluff.</blockquote><p>Notice the emphasis I put on <strong>keeping the app simple</strong>. Since this was my first mobile app, I wanted to make sure I didn’t make things too complicated for myself. Had I envisioned a feature-rich application, I know I would likely get discouraged and potentially give up on the entire project.</p><p>Once I had a better idea of what I wanted to build, I started to list out the features I’d like to have in the app. I categorized things under V1 and V2, where V1 are features that should be part of the first version of the app and V2 would be features that would be cool to have in a future release.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7ifGX_eSVUw1873OPBpzg.png" /><figcaption>The list of features I planned to have in the app for the first and second versions of the app.</figcaption></figure><h4>Design</h4><p>I care greatly for the user interface of applications as I believe it makes an application more enjoyable to use when the application looks good. For my application, I made sure to <strong>look at the design of other mobile apps for inspiration </strong>on how I wanted my app to look. I collected screenshots of some apps I had on my phone as well as designs I found on <a href="https://dribbble.com/">dribbble</a>, and combined them all into a document. In the document, I made notes on the UI elements I liked and how a similar design might fit in with my app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DCexBJyyI0Bex7kmei8dvQ.png" /><figcaption>Annotated design images I compiled related to other mobile app user interfaces.</figcaption></figure><p>After I had gathered some inspiration for the UI, I <strong>sketched out wireframes</strong> for the screens I would need in the app. I did this by hand and then uploaded images of the sketches to <a href="https://www.figma.com">Figma</a>, the design app I use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gYFe5ku0QjZ2sgv_HSQJBA.png" /><figcaption>The hand drawn wireframes for the screens in the app.</figcaption></figure><p>Next up, I started building out high fidelity designs for the application. I did this all in Figma, and you can actually <a href="https://www.figma.com/file/FuctAJdJ15WcqL0vw7wdYM5U/Meat-Journal?node-id=0%3A1">view the designs for yourself</a>. I took all the icons from <a href="https://www.flaticon.com/">FlatIcon</a> and made sure to pay for the rights to use them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iiE6oRAhc32bQvBNOXb17g.png" /><figcaption>Designs for each screen of the app.</figcaption></figure><h4>Development</h4><p>I decided to <strong>use React Native for the app</strong> as I already had experience with it and did not want to learn a new programming language. I also decided I would <strong>only focus on developing for iOS</strong>, even though React Native also allows you to build for Android. The decision to only focus on iOS is because making everything work exactly as intended on both iOS and Android takes a lot of work. Just because something works on iOS, doesn’t mean it will work on Android. Also, since I own an iPhone and not an Android it made sense to develop on iOS as I could test the app in both a simulator and physical device.</p><p>I used a <a href="https://github.com/infinitered/ignite-ir-boilerplate-bowser"><strong>React Native boilerplate</strong></a> to quickly get up and running with the app development process. The boilerplate includes <a href="https://www.typescriptlang.org/"><strong>TypeScript</strong></a><strong> and </strong><a href="https://github.com/mobxjs/mobx"><strong>MobX</strong></a>, which was really nice to work with. I had never used MobX prior to this project, but I really enjoyed using it to manage the global application state.</p><p>I also setup the project with <strong>continuous integration/deployment with </strong><a href="https://visualstudio.microsoft.com/app-center/"><strong>Visual Studio App Centre</strong></a> so that every commit I made to my master branch would build the app and deploy it to Itunes Connect. Itunes Connect is where you can submit your app to the App Store as well as conduct using testing with <a href="https://testflight.apple.com/">TestFlight</a>.</p><p>I chose Visual Studio App Centre for the CI/CD of the project because their free tier was able to accommodate all of my needs with 240 minutes of build time per month with a max build time of 30 minutes per build. I wanted to use <a href="https://circleci.com">Circle CI</a>, but their free plan doesn’t allow for builds on MacOS machines, which is required for iOS. I also considered using <a href="https://www.bitrise.io/">Bitrise</a> since their UI/UX is really nice, but their max build time is 10 minutes per build and my builds were taking just over 10 minutes to complete.</p><h4>User Testing</h4><p>Apple has their own user testing app called <strong>TestFlight</strong>, which allows you to invite others to download and test an app before it gets released to the app store. I didn’t really have a good pool of trustworthy and interested people to test my app, but I did manage to get two of my friends to download my app through TestFlight. <strong>User testing of my app wasn’t really a priority for me as I did not have high expectations for the app.</strong></p><p>Where I did end up <strong>getting a lot of feedback for my app was at a local UI/UX feedback meetup</strong> I attended. I presented my app to a crowd of people who then provided feedback on how the app could be improved along with potential features I might want to add to the app. A lot of people were interested in the app, but I think it’s mainly because the carnivore diet seems so strange.</p><h4>App Store Submission</h4><p>Before submitting to the app store, I made sure to read the <a href="https://developer.apple.com/app-store/review/guidelines/">App Store Review Guidelines</a> to make sure I didn’t miss anything that I should have done. There is a section of the submission form where you can include notes for the App Reviewers, and <strong>I made sure to leave a detailed description of what exactly the app should be able to do</strong>. I’ve heard that this gives the Apple reviewers more confidence in your app and reduces the likelihood of your app being rejected.</p><p>Also, I made sure to <strong>put effort into the screenshots I submitted with the app</strong>, as those act as the initial impression of the app for those viewing the app in the App Store. I followed a typically design trend for the screenshots, where you include a screenshot of the app inside of the frame of an iPhone, with an accompanying short description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1sKcXVPeC1TOi6CVG01-jA.png" /><figcaption>App screenshots I submitted along with my app.</figcaption></figure><p>After I submitted my app for approval, I got an email less than 24 hours later saying that my app was approved, and a few hours later my app could be found in the App Store!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0clpoo3TLGidQU4MOrpkDA.png" /><figcaption>The MeatJournal app <a href="https://itunes.apple.com/ca/app/meatjournal-carnivore-diet/id1438311847?mt=8">in the App Store</a>.</figcaption></figure><h4>Summary</h4><p>From idea to release, the <strong>entire process took me a month</strong>. Also, in terms of cost, I spent $136 CAD for the Apple Developer License and $15 CAD for the rights of the icons I used in the app. So in total, <strong>I spent $151 CAD (approx. $117 USD) on the app</strong>. The Apple Developer License is good for 1 year, after which I would have to renew the license.</p><h4>What’s Next</h4><p>I’ll continue using the app myself and see if there are other features I want to add to the app. I’ll monitor the number of downloads of the app and gather any feedback from users to see if it’s worth investing more time into further developing the app. I quite enjoyed the entire experience so I may even try to develop more apps for the app store.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F50d69a%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F50d69a%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href">https://medium.com/media/05d5fd32eda31cbd1b83287606744532/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c64f1ed76fca" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/from-idea-to-app-store-building-my-first-ios-app-with-react-native-c64f1ed76fca">From Idea to App Store: Building My First iOS App With React Native</a> was originally published in <a href="https://uxdesign.cc">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I Deleted Facebook and Instagram]]></title>
            <link>https://medium.com/@robertcooper_rc/why-i-deleted-facebook-and-instagram-a25d15b10819?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/a25d15b10819</guid>
            <category><![CDATA[facebook]]></category>
            <category><![CDATA[instagram]]></category>
            <category><![CDATA[social-media]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Sun, 14 Oct 2018 02:55:58 GMT</pubDate>
            <atom:updated>2018-10-14T02:57:46.369Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E5z6d1Mr08opH45IQl9S7A.png" /></figure><p>Ya, I deleted Facebook and Instagram. No, i’m not better than everyone else because I did so. I just wasn’t getting any value from both platforms and wasn’t enjoying the things I was reading and seeing on both apps.</p><h4>Facebook</h4><p>Looking at my Facebook feed, I saw posts related to people’s political views, pictures of pets, random status updates on people’s lives, videos of people doing epic fails, etc. None of that stuff really interested me. If I want to know more about what one of my friends is up to, I’d rather just message or call them.</p><p>Also, I’m not a huge fan of having <em>likes</em> associated with posts. It almost feels like some sort of fail when your post doesn’t get a good number of <em>likes</em>. Who the hell I was trying to impress, I do not know. I also felt as though other people might not like me as much if I didn’t make an effort to interact with their content on the platform. I know, I sound like a crazy person.</p><p>I ended up using a Chrome extension that completely <a href="https://chrome.google.com/webstore/detail/news-feed-eradicator-for/fjcldmjmjhkklehbacihaiopjklihlgg?hl=en">blocks anything from showing up on my newsfeed</a>. I also deleted Facebook from my phone, so I was no longer looking through my Facebook newsfeed. This was actually a nice improvement to my social media experience, as I was spending less time on Facebook because of this. However, I was still making the occasional post myself and with posting comes likes and comments. I found myself frequently checking Facebook just to see if I got more likes on my post or to see if anyone commented on my stuff 😐.</p><p>It seemed strange for me to not consume any content from others on Facebook, but I was still posting stuff myself for others to look at. The only thing I was doing in the app was posting the occasional life update as well messaging people.</p><p>After doing a bit of research, I found out you could still use Facebook messenger if you deleted your Facebook account, so I ended up deleting my Facebook account. Before I deleted my account, I made sure to <a href="https://www.facebook.com/help/1701730696756992?helpref=hc_global_nav">download all my data</a> so I could keep the pictures and videos I uploaded to the platform.</p><h4>Instagram</h4><p>Even after deleting my Facebook account, I kept Instagram on my phone for a bit. After all, it’s just your friends sharing pictures, right? Well, I opted to eventually delete Instagram as well.</p><p>I found myself browsing Instagram like I use to browse my Facebook feed. I would also often go into the <em>discover</em> tab to find stupid videos I couldn’t stop watching. Instagram has the same problem for me with their <em>like</em> system which often leads to comparing my posts with other people’s. When I was posting my pictures, I didn’t feel as though I was really appreciating the picture I took and the memories associated with it. There was always that lingering thought of how others would react.</p><p>So ya, I downloaded all of my Instagram data and GTFO’ed.</p><h4>What Now</h4><p>I bought a cabin in Tasmania and I am now planning to live the rest of my days there, feeding off wild game. Ok, that’s a lie. I’m still using social media in the form of LinkedIn &amp; Twitter. I’m also working on completely redoing my website and I’m hoping to have a <em>Life Updates</em> page where I can post some of my favourite pictures that I take as well as keep a record of some of my major life milestones.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a25d15b10819" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transitioning from React Web to React Native Development]]></title>
            <link>https://medium.com/hackernoon/transitioning-from-react-web-to-react-native-development-c8e6df57a92e?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8e6df57a92e</guid>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[react-web]]></category>
            <category><![CDATA[react-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Mon, 03 Sep 2018 11:51:01 GMT</pubDate>
            <atom:updated>2019-05-24T06:25:58.420Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ghfEivqtCdLAFXbgBDEoyw.png" /></figure><p>In the past few months I’ve been doing work with <a href="https://hackernoon.com/tagged/react">React</a> Native, which is a change of pace from the React web apps I was more familiar with developing. Now that i’ve gained experience with React Native, I’m going to explain a bit how React Native differs from React for the web, and what to expect when developing with React Native.</p><h3>React</h3><p>Let’s first briefly talk about React. React is a JavaScript library used for building user interfaces. It was initially released by <a href="https://hackernoon.com/tagged/facebook">Facebook</a> in 2013. React uses a concept of a Virtual DOM to represent how your UI should look like while the state of your application changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*AHE0q2FKAGyosXYsalw_Lw.png" /><figcaption>Code screenshot of a React component’s render method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2uxMazccV10IabaCXH8G-Q.png" /><figcaption>Check out this sick React web app I built</figcaption></figure><h3>React Native</h3><p>React Native is a mobile framework used to build out mobile apps with JavaScript. It, unsurprisingly, uses the React library to construct the UI components as well as define an application’s business logic. It was initially released, again by Facebook, in 2015. One novel feature React Native development provides that standard native development doesn’t is its live reload feature that can quickly re-compile and serve a bundled javascript file after making changes in the code. This feature has been available on the web for some time, but in the mobile development sphere, it was a new concept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*eNm5UV3oGLswYoJjmp-Ncg.png" /><figcaption>Code screenshot of a React Native component’s render method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*JRPzPK5yYgWHsM3nGUm6Uw.png" /><figcaption>Check out this sick React Native app I built</figcaption></figure><h3>Similarities</h3><h4>Both use…React!</h4><p>Both the UIs for apps built with React on the web and React Native will have the same general JavaScript structure with props , state , and all the standard React component lifecycle methods. You can use the same state management libraries (e.g. Redux) in React Native as you would for React on the web.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*Uhlof1a3cdErW18J64xo4g.png" /><figcaption>In React Native, you can find all the standard React lifecycle methods you’ve learned to love in React</figcaption></figure><h4>JSX</h4><p>React Native stills uses JSX as the templating language in the component’s render method to define the UI. Although the base components used in React Native aren’t DOM elements, like &lt;div&gt;, you still use the same syntax since it’s all JSX.</p><h4>Browser Debugging</h4><p>The JavaScript code in React Native usually gets parsed on a device’s JavaScript engine, called the JavaScript Core. However, if you enable debug mode on a mobile simulator, you will be able to run the JavaScript through a browser’s JS engine and you will therefore have access to tools such as the Chrome debugging tools. This allows you to use console.log() statements and read the output in a browser’s console. You can also inspect XHR requests being made and if you’re using Redux, you can take advantage of the <a href="https://github.com/zalmoxisus/redux-devtools-extension">Redux Devtools</a> as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8QcsTdBo1ylqpHExleFwzw.gif" /><figcaption>You can use a brower’s debugging tools with React Native when operating the app in “debug mode”</figcaption></figure><h4>package.json</h4><p>JavaScript dependencies can all be managed with yarn or npm and you will see all those lovely dependencies tracked in a package.json file. This allows you to take advantage of all the packages NPM has to offer and so popular dependencies such as lodash , date-fns, and immutable can be used in React Native projects. However, any dependency that relies on HTML, SVGs or the browser canvas will not be usable with React Native.</p><h3>Differences</h3><h4>Base Components</h4><p>React native comes with a set of built-in components that can be used to render UI elements on the page. These are different than the standard &lt;div&gt;, &lt;p&gt;, &lt;input&gt;, and other DOM elements that are used with React on the web. Some of the React Native built-in components include &lt;Text&gt;, &lt;View&gt;, &lt;TextInput&gt;, and &lt;Image&gt;. There are of course <a href="https://facebook.github.io/react-native/docs/components-and-apis.html">many other</a> and there are also some 3rd party components that can be downloaded from NPM.</p><h4>Styling</h4><p>Styling isn’t done with CSS in React Native, however the syntax is quite similar. To apply styles in React Native, a <a href="https://facebook.github.io/react-native/docs/stylesheet">StyleSheet</a> object is created and applied to a component’s style attribute. The property and values used in the StyleSheet object are similar to what you would find in CSS, but the naming uses camelCase and there are also many features missing in the React Native styles that you would otherwise find in regular CSS.</p><p><strong>Styling on the web:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*16nEGYqXfHOc2IU9PBMJDw.png" /><figcaption>A class name is associate with a DOM element</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*TgC9JhbtPDD7NUzeMG3pQA.png" /><figcaption>CSS targets the element via a classname and assigns a set of properties and values to the associated element</figcaption></figure><p><strong>Styling on native:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*RfMOSFnmVg6nezVmcM3ZTw.png" /><figcaption>A style object is assigned to a component’s style attribute</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*xdfHaKmn9UC1XMjXKxsvXQ.png" /><figcaption>The style object is created using the StyleSheet module</figcaption></figure><h4>Routing &amp; Navigation</h4><p>React Native has 2 popular choices for implementing native navigation in an application: <a href="https://reactnavigation.org/">React Navigation</a> &amp; <a href="https://wix.github.io/react-native-navigation/#/">React Native Navigation</a>. Really great original names if you ask me. Personally, React Native Navigation is the solution I prefer since it uses the actual native navigation API associated with iOS and Android, whereas React Navigation’s implementation is done purely in JavaScript.</p><p>Honestly, incorporating Navigation on Native can be painful when dealing with complex nested routing and styling navigation related elements isn’t always obvious. Routing React web apps is much simpler.</p><h4>Platform Specific Code</h4><p>React Native can detect which platform an application is running on (iOS or Android) and serve a different set of code based on that platform. This can either be done by separating React Components into files ending in ios.js and android.js or it can be done using the Platform module that ships with React Native.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*nT4w9a_MBxzOjtCVm7QJeg.png" /><figcaption>The Platform module is used to serve a different set of styles for iOS and android</figcaption></figure><h4>JavaScript Runtime</h4><p>React Native runs its JavaScript through the device’s <em>JavaScript Core</em>, unless the app is running in debug mode, in which case the browser’s JavaScript engine parses the JavaScript.</p><p>React Native runs on 2 different threads. The <em>Main</em> thread is responsible for rendering the UI and receiving user gestures while the <em>JavaScript</em> thread is responsible for defining the structure of the UI as well as handling the application’s business logic.</p><p>The React Native architecture is quite interesting and you can find many good talks on YouTube from the Facebook developers talking about the inner workings of React Native. Here’s two talks worth checking out if you’re interested in learning more: <a href="https://www.youtube.com/watch?v=7rDsRXj9-cU">one</a>, <a href="https://www.youtube.com/watch?v=plTTFqbEiEE">two</a>.</p><h3>Personal Opinions</h3><p>Ok, real talk: developing for the web is more pleasant then developing for mobile. React Native doesn’t have as large of a developer community than the the community surrounding web applications, so it isn’t surprising that the tooling isn’t as great for React Native. Debugging code in React Native can be difficult at times which can be the cause of some frustration.</p><p>Although React Native is arguably the best tool for cross platform mobile apps, i’m hoping that Progressive Web Applications continue to grow in popularity and will eventually allow for responsive web applications to include native mobile functionality. When that day comes, developers will be able to develop a web application that is responsive, include some native mobile functionalities through browser APIs, and only have to worry about one codebase!</p><p>Until then, React Native is a great way to quickly get started with building applications with JavaScript 🚀.</p><p>If you found this article interesting and front end development interests you, consider following me on <a href="https://twitter.com/RobertCooper_RC"><strong>Twitter</strong></a>, <a href="https://github.com/robertcoopercode"><strong>Github</strong></a>, or <a href="https://www.linkedin.com/in/robert-cooper/"><strong>LinkedIn</strong></a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8e6df57a92e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/transitioning-from-react-web-to-react-native-development-c8e6df57a92e">Transitioning from React Web to React Native Development</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Web Developer's Attempt Not to Suck at Design]]></title>
            <link>https://medium.com/@robertcooper_rc/a-web-developers-attempt-not-to-suck-at-design-f3c5e3320528?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3c5e3320528</guid>
            <category><![CDATA[sketch]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[web-developer]]></category>
            <category><![CDATA[design-development]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Wed, 25 Jul 2018 01:54:07 GMT</pubDate>
            <atom:updated>2018-10-16T00:16:17.807Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Web Developer’s Attempt Not to Suck at Design</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RT2F-coIy96VeBeExqYg3g.png" /></figure><p>I’m a web developer. I put together the technical components required to make a web application functional. Often times, I’m given designs to follow along with which makes my life easier since I don’t have to put any thought into creating an aesthetically pleasing app. However, that’s not always the case.</p><p>There are often times I wish I had some real design skills. For example, whenever I make a new blog post, I’d love to be able to make some killer illustrations to help clarify my topic of discussion. Also, whenever I work on a new side project, I’d like for whatever I create to <strong>not look like a pile a crap</strong>.</p><p>Recently, I got a hold of a Sketch license for work and I decided to take on a side project where I would <strong>first create the design</strong> using Sketch, and <strong>then move on towards implementing</strong> the design in the form of a website.</p><p>My sister owns a floral design studio and she already has a website she built using <a href="https://www.squarespace.com/">SquareSpace</a>. I wanted to take on the challenge of creating a completely new website for her built on <a href="https://www.shopify.ca/">Shopify</a>. I’ve built sites with Shopify before and I’m comfortable working with their templating language to build out a custom site.</p><p>So I opened up a new blank document in Sketch and got started 👨🏼‍🎨.</p><h4>Design Phase</h4><p>The design process took me forever… and I only ended up designing the home page 😐. I went into the design wanting everything to be perfect and I wanted to try to use good design practices. This definitely hindered how quickly I was able to come to a solution.</p><p>I made a design for <strong>3 different screen sizes</strong> (desktop, tablet, and mobile). I used symbols wherever I thought was appropriate in order to follow a sort of <strong>atomic design</strong> methodology. I organized and <strong>grouped my typography</strong> components in a way that allowed for easy changes to sizes, colours, and font family across the design. And on top of that, I <strong>installed a handful of plugins</strong> to try to make certain things easier like <a href="https://github.com/rodi01/RenameIt">renaming multiple layers</a> and creating <a href="https://medium.com/sketch-app-sources/introducing-auto-layout-for-sketch-24e7b5d068f9">flexbox-like responsive layouts</a>.</p><p>I <strong>struggled with setting up symbols</strong> in a way that allowed them to display exactly how I wanted them to look for all cases. For example, I created a tag symbol that allowed the text to be changed as well as the colour to be one of two values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*teuQ0_9jSbekJFwifGnRQA.png" /><figcaption>The setup of my `tag` symbol.</figcaption></figure><p>When I ended up changing the text to something other than the default, I didn’t end up getting what I wanted…</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*5PQOMj47fD7-AtvPExvL6g.png" /><figcaption>This instance of the tag symbol has text cutoff at the ends.</figcaption></figure><figure><img alt="This symbol grows nice with the words, unlike the previous example. However, both symbols are the same so I&#39;m not sure why one doesn&#39;t have the words wrapping to a new line like the other -.-" src="https://cdn-images-1.medium.com/proxy/1*IALKE0h6Ve7DRyWqKZlsqQ.png" /><figcaption>This symbol instance nicely wraps the text within the coloured box. Both this symbol instance and the one shown above use the same symbol so I’m not sure why one doesn’t have the words wrapping to a new line like the other ¯\_(ツ)_/¯</figcaption></figure><p>This constant <strong>tweaking of symbols took up a lot of time</strong>, and I still didn’t get them all setup quite right. Also, I found it quite difficult to maintain the design of the homepage in 3 different screen sizes. As you can imagine, as I changed the look for one screen, I had to change the look for the other two. Also, some of the symbols I used for desktop where too large when I used them on mobile, so I had to maintain two sets of symbols in certain cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*81Hl2QbGNndh7wJRwob04w.png" /></figure><p>What I ended up coming up with as a design for the home page is the following (desktop version):</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*vxBIN-3Q-o_aRn9lQRldQA.png" /><figcaption>Desktop version of the home page design.</figcaption></figure><p>Here’s a zoomed out version of the 3 screen size designs of the same home page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*kvzmN9MqDfP7JKKfDUqshg.png" /><figcaption>Sketch app showing the 3 artboards representing different screen sizes for the home page.</figcaption></figure><p>After spending so much time in Sketch designing the home page I had enough of designing things and ended up going straight to implementing the design and creating the other pages of the site on the fly.</p><h4>Implementation Phase</h4><p>I built out the Shopify site using Shopify’s theme development toolkit, <a href="https://github.com/Shopify/slate">Slate</a>. It gives you the bare essentials required to get started with building out a custom theme on Shopify.</p><p>Before I started this project, I had envisioned that I would design something in Sketch and then try to replicate the design right down to the pixel on the web. Well, I didn’t end up doing that. The mockup I made in Sketch ended up being a rough guide to how I implemented the design on the web.</p><p>In fact, I had to <strong>change the design</strong> of the home page a bit because the layout I had created in Sketch <strong>was too complex to implement in a responsive manner</strong> on the web, so I ended up simplifying it.</p><figure><img alt="I had designed one of the home page sections with a set of pictures with a set of words spaced out between the images. This was difficult to get the positions of the words looking good on all screen sizes." src="https://cdn-images-1.medium.com/proxy/1*RQezlGDSbUOfRc0r7gcRCA.png" /><figcaption>One of the designed home page sections included some pictures with words spaced out between the images in a collage style. This was difficult to get the positions of the words looking good on all screen sizes, so I didn’t end up implementing this.</figcaption></figure><figure><img alt="I instead decided to place images in a carousel and then list all of the words within a list layout." src="https://cdn-images-1.medium.com/proxy/1*Hjo1z236mVBCo7GSrismvg.png" /><figcaption>I instead decided to place images in a carousel and then list all of the words within a list layout.</figcaption></figure><p>I deviated a lot from the design as I started adding everything to the site and the final result looks kinda-sorta like the design I made in Sketch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-JA5ldHGVXHod9Rn0HtXfw.png" /><figcaption>The final implementation of the site’s home page.</figcaption></figure><p>For the other pages of the website, I looked into other e-commerce sites for some inspiration and I also looked up specific component designs on <a href="https://dribbble.com/">Dribbble</a>. For example, the contact forms were based off a design <a href="https://dribbble.com/shots/3759326-Jampps-contact-us-form">I found on Dribbble</a>.</p><figure><img alt="Contact form created with the help of inspiraction I found on Dribbble" src="https://cdn-images-1.medium.com/proxy/1*VPSWmj-IbfGLQKFJhxHyTg.png" /><figcaption>Contact form created based off a design I found on Dribbble</figcaption></figure><p><a href="https://daisies-dandelions.robertcooper.me/"><strong>Click here to see the live website</strong></a> if you want to see how I designed the other pages on the site and see some of the animations/transitions I’ve incorporated. Note that my sister did not end up using the Shopify site I designed for her (Shopify has a higher monthly cost than SquareSpace and my redesign didn’t particularly “wow” her). I’ve changed some of the content to be more generic and am keeping the site live for illustration/demo purposes.</p><h4>Takeaways</h4><p>If I had to repeat this process I would definitely do some things differently:</p><p><strong>Don’t focus on creating high fidelity designs</strong></p><p>For my use case, I think it would be more beneficial for me to do more of a wireframe design in Sketch, at least to start off with.</p><p><strong>Do more research beforehand</strong></p><p>I did most of my research on the fly for how the design of the site should look. I think it would have been more useful had I done more upfront research and then went on to design more pages in Sketch before moving on to implementing the design on the web. It would have made the development process less “fragmented”.</p><p><strong>Don’t try to prematurely optimize designs</strong></p><p>I wasted a lot of time trying to figure out how to properly used symbols and try to setup Sketch plugins that were suppose to make the design process easier. However, I don’t even have a good grasp of the fundamental tools in Sketch so I haven’t even had the chance to experience most of the pain points these tools were suppose to help resolve. I think I would have benefitted from sticking to the bare essentials while designing because I would have been able to produce designs faster and I would have better understood how more advanced tools can help with common pain points.</p><p><strong>Don’t strive for perfection</strong></p><p>The more I tried to get something “just right”, the more my progress was impeded. It also takes a lot of time to get the last bit of a design to where you ideally want it. This is a common phenomena represented by the “80/20” rule, where the last 20% of the work will take 80% of the total required time.</p><p>I will try to apply what I’ve learn to my next side project and l’m excited to see how my next attempt at the whole design &amp; development process goes.</p><p>If you found this article interesting and front end development interests you, consider following me on <a href="https://twitter.com/RobertCooper_RC"><strong>Twitter</strong></a>, <a href="https://github.com/robertcoopercode"><strong>Github</strong></a>, or <a href="https://www.linkedin.com/in/robert-cooper/"><strong>LinkedIn</strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3c5e3320528" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Untangling the Color Variable Mess in JavaScript and Sass Apps]]></title>
            <link>https://codeburst.io/untangling-the-color-variable-mess-in-javascript-and-sass-apps-dd6311baa2e4?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd6311baa2e4</guid>
            <category><![CDATA[css-in-js]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[sass]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Tue, 10 Jul 2018 21:46:36 GMT</pubDate>
            <atom:updated>2018-10-16T00:15:11.283Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6xl5q8Y1NGaSpALr4GWerw.png" /><figcaption>I plan to sell this masterpiece of art for a gazillion dollars</figcaption></figure><p>There really is no universally accepted standard for naming colors in web applications, which usually leads to a whole bunch of different implementations. However, having a system for naming colors in projects is important, not only for consistency in the codebase, but it also helps when needing to change the colors in your app.</p><p>Since I’ve been working a lot on React projects that use CSS-in-JS as well as other projects that use Sass, I will outline two approaches for each type of app. Both approaches share the same approach, but the syntax is different because JavaScript and Sass are different programming languages (that’s probably pretty obvious, but I said it anyway because i’m <em>shameless</em>).</p><p>Also, please note that this is an opinionated guide on how to name colors and I realize that many people prefer other approaches. Like they say: <em>“different strokes for different folks”</em>.</p><h4>CSS-in-JS</h4><p>Color variables should live in a colors.js file where a <strong>colors</strong> object is defined with a bunch of color names as properties and values being defined as a hex/rgba/hsl color.</p><pre>const <strong>colors</strong> = {<br>    bertaBlue: &quot;#4BDAFF&quot;,<br>    black: &quot;#000000&quot;,<br>    bloodBurst: &quot;#FF4B4B&quot;,<br>    bloodOrgan: &quot;#630E10&quot;,<br>    blueSparkle: &quot;#0076FF&quot;,<br>    chickenComb: &quot;#DE2525&quot;,<br>    deepLilac: &quot;#9B59B6&quot;,<br>    heartBeat: &quot;#AA0000&quot;,<br>    mango: &quot;#FFA628&quot;,<br>    nero: &quot;#262626&quot;,<br>    palePurple: &quot;#B089D5&quot;,<br>    schoolBusYellow: &quot;#ffd800&quot;,<br>};<br><br>export default <strong>colors</strong>;</pre><p>The color names used for the object keys are determined using a color namer app I built called <a href="https://colornamer.netlify.com/"><strong><em>Color Namer</em></strong></a>. All you need to do is type in the color in hex or rgb format and an associated color name will appear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jz7uPgq9XFdcA3rx0mBCcg.png" /><figcaption>Screenshot of the <strong>Color Namer</strong> app</figcaption></figure><p>Alright, so far we’ve made the names of our colors more memorable by associating their hex or rgb value to a user-friendly name like bloodOrgan. If we were to use those color variables for the styling of our app components, we would run into an issue if we ever wanted to change the colors. We would have to do a global search in our code editor to find the name of the color variable and replace it with another color. We would also have to make sure to only replace the color for the components that needs replacing.</p><p>For example, imagine you use the color <strong>schoolBusYellow</strong> for the background color of all your <em>buttons</em> and the background of you main <em>navbar</em>. Down the line, you need to change the background color of the buttons, but not the background color of your navbar, so you need to find each of your buttons and change their background color. That kind of defeats the purpose of using variables, since variables are suppose to allow you to change their value in one place and have all occurrences of that variable update accordingly.</p><p>What’s the solution to this? Well you should have a second level of variable naming that looks like this:</p><pre>const <strong>colors</strong> = {<br>    bertaBlue: &quot;#4BDAFF&quot;,<br>    black: &quot;#000000&quot;,<br>    bloodOrgan: &quot;#630E10&quot;,<br>    mango: &quot;#FFA628&quot;,<br>    nero: &quot;#262626&quot;,<br>    schoolBusYellow: &quot;#ffd800&quot;,<br>};</pre><pre><em>export default </em>{<br>    primaryBackground: <strong>colors</strong>.mango,<br>    secondaryBackground: <strong>colors</strong>.bertaBlue,<br>    primaryText: <strong>colors</strong>.black,<br>    secondaryText: <strong>colors</strong>.nero,<br>    primaryButtonBackground: <strong>colors</strong>.bloodOrgan,<br>    primaryButtonText: <strong>colors</strong>.schoolBusYellow<br>};</pre><p>Now when you use these color variables in your components, you will easily be able to change the colors of all associated components by changing their value in the colors.js file. To use the colors, all you need to do is import colors.js and assign the colors to CSS properties.</p><pre><em>import </em><strong>colors</strong> from &quot;./colors&quot;;<br><br><em>const </em><strong>styles</strong> = {<br>    outerContainer: {<br>        backgroundColor: <strong>colors</strong>.primaryBackground,<br>        padding: &quot;40px&quot;<br>    },<br>    innerContainer: {<br>        backgroundColor: <strong>colors</strong>.secondaryBackground,<br>        padding: &quot;20px&quot;,<br>        textAlign: &quot;center&quot;<br>    },<br>    title: {<br>        color: <strong>colors</strong>.primaryText,<br>        margin: 0<br>    },<br>    subtitle: {<br>        color: <strong>colors</strong>.secondaryText,<br>        marginBottom: 0<br>    },<br>    button: {<br>        backgroundColor: <strong>colors</strong>.primaryButtonBackground,<br>        color: <strong>colors</strong>.primaryButtonText,<br>        border: &quot;none&quot;,<br>        padding: &quot;10px&quot;,<br>        marginTop: &quot;20px&quot;,<br>        textTransform: &quot;uppercase&quot;<br>    }<br>};</pre><p>Here’s a demo of this would look like in a React application:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fx93oo895ko&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fx93oo895ko&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fx93oo895ko%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2c3b65e84b2a5dd469139649ea9e6fe/href">https://medium.com/media/a2c3b65e84b2a5dd469139649ea9e6fe/href</a></iframe><p>The above example uses inline styling for the components, but the color import can be used with any sort of CSS-in-JS library such as <a href="https://github.com/paypal/glamorous">Glamorous</a>, <a href="https://github.com/emotion-js/emotion">Emotion</a>, or <a href="https://www.styled-components.com/">Styled Components</a>.</p><h4>Sass</h4><p>A similar approach would be used for projects that use Sass for their styles. All color variables should be kept in a variables.scss file with Sass variables beginning with $color- and ending with the name of the color as determined through <a href="https://colornamer.netlify.com/"><strong><em>Color Namer</em></strong></a>. Prefixing your variables with $color- allows code editors to list all colors when a user types $color- when declaring a color.</p><pre>$color-blue-sparkle: #0076ff;<br>$color-black: #000000;<br>$color-pale-purple: #b089d5;<br>$color-berta-blue: #4bdaff;<br>$color-nero: #262626;<br>$color-mango: #ffa628;<br>$color-deep-lilac: #9b59b6;<br>$color-heartbeat: #aa0000;<br>$color-blood-burst: #ff4b4b;<br>$color-chicken-comb: #de2525;<br>$color-blood-organ: #630e10;<br>$color-school-bus-yellow: #ffd800;</pre><p>The next step would be to have a second level of variable names to associate colors with more general groups.</p><pre>$color-primary-background: $color-mango;<br>$color-secondary-background: $color-berta-blue;<br>$color-primary-text: $color-black;<br>$color-secondary-text: $color-nero;<br>$color-primary-button-background: $color-blood-organ;<br>$color-primary-button-text: $color-school-bus-yellow;</pre><p>Here’s a demo of how this would look like in an application:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Fx3vj433mjo&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Fx3vj433mjo&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Fx3vj433mjo%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/223e8c39fb91b828a76ccd681be8b3b9/href">https://medium.com/media/223e8c39fb91b828a76ccd681be8b3b9/href</a></iframe><p>So that’s the approach I like to use when naming color variables in apps. In truth, I usually skip the second level of color variable names (e.g. <strong>$color-primary-background</strong>) and just straight up use the named colors (e.g. <strong>$color-school-bus-yellow</strong>). The reason being is that it eliminates the thinking involved when determining if a component should use <strong>$color-primary-background</strong> or if it should have a new color variable associated with it, such as <strong>$color-primary-nav-background</strong>.</p><p>If you found this article interesting and front end development interests you, consider following me on <a href="https://twitter.com/RobertCooper_RC"><strong>Twitter</strong></a>, <a href="https://github.com/robertcoopercode"><strong>Github</strong></a>, or <a href="https://www.linkedin.com/in/robert-cooper/"><strong>LinkedIn</strong></a>.</p><figure><a href="http://bit.ly/codeburst"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3hPOj27LTt0ZPn5TQuhZg.png" /></a></figure><blockquote>✉️ <em>Subscribe to </em>CodeBurst’s<em> once-weekly </em><a href="http://bit.ly/codeburst-email"><strong><em>Email Blast</em></strong></a><strong><em>, </em></strong>🐦 <em>Follow </em>CodeBurst<em> on </em><a href="http://bit.ly/codeburst-twitter"><strong><em>Twitter</em></strong></a><em>, view </em>🗺️ <a href="http://bit.ly/2018-web-dev-roadmap"><strong><em>The 2018 Web Developer Roadmap</em></strong></a><em>, and </em>🕸️ <a href="http://bit.ly/learn-web-dev-codeburst"><strong><em>Learn Full Stack Web Development</em></strong></a><em>.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd6311baa2e4" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/untangling-the-color-variable-mess-in-javascript-and-sass-apps-dd6311baa2e4">Untangling the Color Variable Mess in JavaScript and Sass Apps</a> was originally published in <a href="https://codeburst.io">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Perfect Code Review Process]]></title>
            <link>https://medium.com/osedea/the-perfect-code-review-process-845e6ba5c31?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/845e6ba5c31</guid>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[pull-request]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Tue, 10 Jul 2018 18:15:42 GMT</pubDate>
            <atom:updated>2019-05-23T19:50:34.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hGxQRFKWSRch-OC8FD2_Vg.jpeg" /><figcaption>Chances are usually pretty low that you see this image on a pull request</figcaption></figure><p>T his article talks about a fictional scenario that tries to represent a near-ideal code review process. The story revolves around app development for a company and not an open source project. Also, it should be noted that this is <strong>an opinionated article</strong> of what makes a good code review. There are many different approaches that can make up an excellent code review process and the optimal process will vary depending on a variety of factors.</p><p>That being said, enjoy the story 📖</p><p>Meet Jimmy. Jimmy is working away on a new feature for his project. Jimmy and his team are using Git as their version control system and he is making his commits on a feature branch that will eventually get merged into the development (<em>dev</em>) branch (the team follows a <a href="https://datasift.github.io/gitflow/IntroducingGitFlow.html">GitFlow</a> branching model). Before Jimmy can get his feature merged into the dev branch, his code needs to go through a <strong>code review</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oOl6WrUyypNVJvWDFr_t1Q.png" /><figcaption>Simplified representation of the branches in Jimmy’s project. Jimmy is currently working on a feature branch and will soon be merging his feature into dev.</figcaption></figure><p>Why does Jimmy’s code need to be reviewed before merging? Well, all the code in the dev branch should leave the project in a functional state and follow certain project level standards. Some examples of project level standards include <strong>adding the appropriate tests</strong>, correctly <strong>defining variable types</strong>, and having the code <strong>logic in the appropriate files/functions</strong>. Since Jimmy isn’t a perfect programmer (especially after a late night of binge watching the latest season of Black Mirror), his code needs to be checked by his team members.</p><p>Jim-<em>bo</em> works with 3 other team members. When Jimmy has completed his feature, he <strong>pushes his feature branch to Github and makes a Pull Request</strong> (PR) to initiate a code review. Jimmy then adds one or two of his teammates as reviewers to his pull request.</p><p>Why doesn’t Jimmy add all of his team members as reviewers? Well the <strong>more people that are asked to review</strong> the code, the <strong>more hours/resources you are dedicating</strong> to reviewing code and those hours can probably best be used on other things than having 3 people review the same code.</p><blockquote>If the purpose for adding all team members to a PR is to receive the quickest response, this usually doesn’t work out as expected. There is usually one person that is the first to always review a PR and after this happens for many consecutive PRs, everyone expects the same person to review the pull request and then the requests for review end up getting ignored by most. This isn’t so bad for a team of 4, but the problem gets amplifies with larger teams.</blockquote><p>If one of Jimmy’s teammates is a “senior” level developer and Jimmy is a “junior” level developer, this shouldn’t prevent Jimmy from being included in the code review process. <strong>Everyone should be able to participate in the code review process</strong> as it helps the team learn from each other. However, if Jimmy goes to review the PR and doesn’t understand much of what is going on in the code, he should not accept the PR because he “trusts” the work done by his team mate, but rather someone else should review the pull request.</p><p>Before Jim-mister adds his colleagues as reviewers to his PR, he needs to <strong>write a detailed Pull Request description</strong> that addresses the following:</p><ul><li><strong>What has changed</strong> between his feature branch and the dev branch</li><li>Checklist of <strong>prerequisites</strong> (e.g. added documentation, added tests, ready to merge, etc.)</li><li><strong>How to use the feature</strong> (a GIF of the feature in action is extremely useful here)</li><li><strong>How the design has changed</strong> and how it compares to the design mockups (screenshots comparing the designs to the implementation)</li><li><strong>Additional notes</strong> the reviewers should be made aware of</li></ul><blockquote>What goes into a pull request is usually highly project-dependant. Often times, you will see projects that have lots of pull requests make use of <a href="https://blog.github.com/2016-02-17-issue-and-pull-request-templates/">pull request templates</a> to pre-populate a lot of the required information for the PR description.</blockquote><p>Once Jimmy is done submitting his detailed pull request, he waits…<strong>but not too long</strong>!</p><blockquote>A good review process requires that pull requests get addressed as soon as possible in order to prevent the project from being impeded. Ideally, pull requests are reviewed within two hours of their submission.</blockquote><p>Think of this for a minute, if a PR is submitted by Jimmy, he will likely tackle some smaller tasks on his plate, such as responding to email or maybe addressing some tasks on the internal projects he is working on. If an hour goes by and nobody has reviewed his PR, Jimmy will have to start working on a new feature for the project. Let’s say that he is 3 hours into working on a new feature and then he finally receives feedback on his PR which requests some changes. Jimmy then switches back to his old feature branch to address the issues on his code review and then leaves a message on the PR saying that his PR is ready to be re-reviewed. Jimmy switches back to the new feature he has started and doesn’t get additional feedback on the PR until mid-day the following day where he is asked for EVEN MORE modifications. As you can see, this process is being drawn out and <strong>requires a lot of context switching</strong>, which usually <strong>hinders productivity</strong>.</p><p>So ideally, Jimmy’s PR quickly gets reviewed by his colleagues and he receives requests for changes on certain parts of his feature. The feedback Jimmy receives is worded so as to explain <strong>what should be changed</strong> and more importantly, <strong>WHY it should be changed</strong> (some comments even include links to external documentation/articles that provide more detailed information on the subject). This is extremely helpful for Jimmy because he can <strong>learn from his mistakes</strong> and <strong>better understand the best practices</strong> that should be followed. The language Jimmy’s teammates use in their <strong>feedback is friendly</strong> and isn’t in any way accusatory or trying to shame Jimmy.</p><p>Ok, now that Jimmy-<em>two-shoes</em> has received his feedback, he can now act on it by applying changes to his code. Ideally, Jimmy uses <strong>interactive rebasing </strong>when making changes so as not to add extra commits to his branch with commit messages such as “Fixed xxx” or “Added more tests”. <a href="https://robots.thoughtbot.com/git-interactive-rebase-squash-amend-rewriting-history">Interactive rebasing</a> allows previous commits to be edited with additional changes. Here’s an illustration of what Jimmy’s commits should look like after updating his feature branch with the feedback he received on his pull request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UoMYbxGGU4H8S37hSIKATg.png" /></figure><p>Notice how, for the recommended way of doing things, the commits are the same before and after the changes have been made to the feature branch? This is because an <strong>interactive rebase was used to edit individual commits</strong>. So instead of making a commit such as “Added more Jest tests”, the commit called “Added Jest tests” would be modified to include the added tests. This way, <strong>all the commit messages are still relevant</strong> and then there <strong>are not a bunch of extra commits</strong> spread about the feature branch.</p><p>Ok, so Jimmy made his changes, he pushed his changes to Github and has notified the other reviewers of his changes. If there are additional changes requested by Jimmy’s teammates, he will address those, otherwise Jimmy can merge his changes into the development branch. Jimmy proceeds to high-five all his teammates, bust out some office break-dance moves, and can continue living a full life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OMD_QtA1Yha6VQ3Plgnm9g.jpeg" /><figcaption>Jimmy on a beach walking into the sunset and living a full life after having his PR merged into dev — Photo by <a href="https://unsplash.com/photos/B6TX1ktfyyA?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Dekeister Leopold</a> on <a href="https://unsplash.com/search/photos/walking-on-the-beach?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>That’s what I would describe as an ideal code review process. Does this always end up being followed? Unfortunately, no. Sometimes reviewers are too busy and don’t make the time to promptly review PRs. Other times the details of a PR are not clearly outlined in the Pull Request message and this makes it more difficult for the reviewers to provide a beneficial review. That being said, it is something to strive for and will make the development process more enjoyable.</p><p>Be like Jimmy and his perfect teammates and make the development world a better place for everyone 👫👬👭.</p><p><strong>Other resources related to code reviews and pull requests</strong></p><p><a href="https://dev.to/samjarman/giving-and-receiving-great-code-reviews">Giving and Receiving Great Code Reviews</a></p><p><a href="https://dev.to/codemouse92/10-principles-of-a-good-code-review-2eg">10 Principles of a Good Code Review</a></p><p><a href="https://blog.scottnonnenberg.com/top-ten-pull-request-review-mistakes/">Top ten pull request review mistakes</a></p><p><a href="https://blog.rangle.io/the-art-of-humanizing-pull-requests-prs/">The Art of Humanizing Pull Requests</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=845e6ba5c31" width="1" height="1" alt=""><hr><p><a href="https://medium.com/osedea/the-perfect-code-review-process-845e6ba5c31">The Perfect Code Review Process</a> was originally published in <a href="https://medium.com/osedea">Osedea</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Useful Javascript Array and Object Methods]]></title>
            <link>https://codeburst.io/useful-javascript-array-and-object-methods-6c7971d93230?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c7971d93230</guid>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[array-methods]]></category>
            <category><![CDATA[objects]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Sun, 27 May 2018 15:10:55 GMT</pubDate>
            <atom:updated>2018-10-16T00:14:25.698Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*89Rl1aLLRDI1OEX3vkUtPw.png" /></figure><p>I listened to a great <a href="https://syntax.fm/">Syntax FM podcast</a> that summarized useful JavaScript array and object methods. These methods help developers write clean and readable code. A lot of these methods reduce the need to reach for utility libraries like <a href="https://lodash.com/">Lodash</a>.</p><p>All the methods in this article are chainable, meaning they can be used in combination with one another and they also don’t mutate data, which is especially important when working with React. With all these array and object methods you’ll find you never have to reach for a for or while loop ever again.</p><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter">.filter()</a></h4><p>Creates a new array based on whether the items of an array pass a certain condition.</p><p><strong>Example</strong></p><p>Create an array of student ages that meet the legal drinking age.</p><pre>const studentsAge = [17, 16, 18, 19, 21, 17];<br>const ableToDrink = studentsAge.filter( age =&gt; age &gt; 18 );</pre><pre>// ableToDrink will be equal to [19, 21]</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map">.map()</a></h4><p>Creates a new array by manipulating the values in another array. Great for data manipulation and it is often used in React because it is an immutable method.</p><p><strong>Example</strong></p><p>Create an array that adds a $ to the beginning of each number.</p><pre>const numbers = [2, 3, 4, 5];<br>const dollars = numbers.map( number =&gt; &#39;$&#39; + number);</pre><pre>// dollars will be equal to [&#39;$2&#39;, &#39;$3&#39;, &#39;$4&#39;, &#39;$5&#39;]</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce">.reduce()</a></h4><p>This often overlooked method uses an accumulator to reduce all items in an array to a single value. Great for calculating totals. The returned value can be of any type (i.e. object, array, string, integer).</p><p><strong>Example</strong></p><p>Add up the integers in an array.</p><pre>const numbers = [5, 10, 15];<br>const total = numbers.reduce( (accumulator, currentValue) =&gt; accumulator + currentValue);</pre><pre>// total will be equal to 30</pre><p>There are some really cool use cases for .reduce() outlined in the MDN docs that provide examples on how to do things likes flattening an array of arrays, grouping objects by a property, and removing duplicate items in array.</p><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach">.forEach()</a></h4><p>Applies a function on each item in an array.</p><p><strong>Example</strong></p><p>Log each array item to the console</p><pre>const emotions = [&#39;happy&#39;, &#39;sad&#39;, &#39;angry&#39;];<br>emotions.forEach( emotion =&gt; console.log(emotion) );</pre><pre>// Will log the following:<br>// &#39;happy&#39;<br>// &#39;sad&#39;<br>// &#39;angry&#39;</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some">.some()</a></h4><p>Checks if any item in an array passes the condition. A good use case would be checking for user privileges. It can also be used similarly to a .forEach() where you would perform an action on each array item and break out of the loop once a <em>truthy</em> value is returned.</p><p><strong>Example</strong></p><p>Check if there is at least one &#39;admin&#39; in an array.</p><pre>const userPrivileges = [&#39;user&#39;, &#39;user&#39;, &#39;user&#39;, &#39;admin&#39;];<br>const containsAdmin = userPrivileges.some( element =&gt; element === &#39;admin&#39;);</pre><pre>// containsAdmin will be equal to true</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every">.every()</a></h4><p>Similar to .some(), but checks if all items in an array pass a condition.</p><p><strong>Example</strong></p><p>Check if all ratings are equal to or greater than 3 stars.</p><pre>const ratings = [3, 5, 4, 3, 5];<br>const goodOverallRating = ratings.every( rating =&gt; rating &gt;= 3 );</pre><pre>// goodOverallRating will be equal to true</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes">.includes()</a></h4><p>Checks if an array contains a certain value. It’s similar to .some(),but instead of looking for a condition to pass, it looks if the array contains a specific value.</p><p><strong>Example</strong></p><p>Check if the array includes an item with the string ‘waldo’.</p><pre>const names = [&#39;sophie&#39;, &#39;george&#39;, &#39;waldo&#39;, &#39;stephen&#39;, &#39;henry&#39;];<br>const includesWaldo = names.includes(&#39;waldo&#39;);</pre><pre>// includesWaldo will be equal to true</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from">Array.from()</a></h4><p>This is a static method that creates an array based on another array or string. You can also pass a map callback function as an argument to further shape the data in the new array. Honestly, I’m not too sure why someone would use this over the .map() method.</p><p><strong>Example</strong></p><p>Create an array from a string.</p><pre>const newArray = Array.from(&#39;hello&#39;);</pre><pre>// newArray will be equal to [&#39;h&#39;, &#39;e&#39;, &#39;l&#39;, &#39;l&#39;, &#39;o&#39;]</pre><p>Create an array that has double the value for each item in another array.</p><pre>const doubledValues = Array.from([2, 4, 6], number =&gt; number * 2);</pre><pre>// doubleValues will be equal to [4, 8, 12]</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values">Object.values()</a></h4><p>Return an array of the values of an object.</p><p><strong>Example</strong></p><pre>const icecreamColors = {<br>    chocolate: &#39;brown&#39;,<br>    vanilla: &#39;white&#39;,<br>    strawberry: &#39;red&#39;,<br>}<br><br>const colors = Object.values(icecreamColors);</pre><pre>// colors will be equal to [&quot;brown&quot;, &quot;white&quot;, &quot;red&quot;]</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys">Object.keys()</a></h4><p>Return an array of the keys of an object.</p><p><strong>Example</strong></p><pre>const icecreamColors = {<br>  chocolate: &#39;brown&#39;,<br>  vanilla: &#39;white&#39;,<br>  strawberry: &#39;red&#39;,<br>}<br><br>const types = Object.keys(icecreamColors);</pre><pre>// types will be equal to [&quot;chocolate&quot;, &quot;vanilla&quot;, &quot;strawberry&quot;]</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries">Object.entries()</a></h4><p>Creates an array which contains arrays of key/value pairs of an object.</p><p><strong>Example</strong></p><pre>const weather = {<br>  rain: 0,<br>  temperature: 24,<br>  humidity: 33,<br>}<br><br>const entries = Object.entries(weather);</pre><pre>// entries will be equal to<br>// [[&#39;rain&#39;, 0], [&#39;temperature&#39;, 24], [&#39;humidity&#39;, 33]]</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax">Array spread</a></h4><p>Spreading arrays using the spread operator (…) allows you to expand the elements in an array. It’s useful when concatenating a bunch of arrays together. It’s also a good way to avoid using the splice() method when looking to remove certain elements from an array because it can be combined with the slice() method to prevent direct mutation of an array.</p><p><strong>Example</strong></p><p>Combine two arrays.</p><pre>const spreadableOne = [1, 2, 3, 4];<br>const spreadableTwo = [5, 6, 7, 8];<br><br>const combined = [...spreadableOne, ...spreadableTwo];</pre><pre>// combined will be equal to [1, 2, 3, 4, 5, 6, 7, 8]</pre><p>Remove an array element without mutating the original array.</p><pre>const animals = [&#39;squirrel&#39;, &#39;bear&#39;, &#39;deer&#39;, &#39;salmon&#39;, &#39;rat&#39;];<br>const mammals = [...animals.slice(0,3), ...animals.slice(4)];</pre><pre>// mammals will be equal to [&#39;squirrel&#39;, &#39;bear&#39;, &#39;deer&#39;, &#39;rat&#39;]</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax">Object spread</a></h4><p>Spreading an object allows for the addition of new properties and values to an object without mutations (i.e. a new object is created) and it can also be used to combine multiple objects together. It should be noted that spreading objects does not do nested copying.</p><p><strong>Example</strong></p><p>Add a new object property and value without mutating the original object.</p><pre>const spreadableObject = {<br>  name: &#39;Robert&#39;,<br>  phone: &#39;iPhone&#39;<br>};<br><br>const newObject = {<br>  ...spreadableObject,<br>  carModel: &#39;Volkswagen&#39;<br>}</pre><pre>// newObject will be equal to<br>// { carModel: &#39;Volkswagen&#39;, name: &#39;Robert&#39;, phone: &#39;iPhone&#39; }</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters">Function Rest</a></h4><p>Functions can use the rest parameter syntax to accept any number of arguments as an array.</p><p><strong>Example</strong></p><p>Display the array of passed arguments.</p><pre>function displayArgumentsArray(...theArguments) {<br>  console.log(theArguments);<br>}<br><br>displayArgumentsArray(&#39;hi&#39;, &#39;there&#39;, &#39;bud&#39;);</pre><pre>// Will print [&#39;hi&#39;, &#39;there&#39;, &#39;bud&#39;]</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze">Object.freeze()</a></h4><p>Prevents you from modifying existing object properties or adding new properties and values to an object. It’s often what people think const does, however const allows you to modify an object.</p><p><strong>Example</strong></p><p>Freeze an object to prevent the name property from being changed.</p><pre>const frozenObject = {<br>  name: &#39;Robert&#39;<br>}<br><br>Object.freeze(frozenObject);<br><br>frozenObject.name = &#39;Henry&#39;;</pre><pre>// frozenObject will be equal to { name: &#39;Robert&#39; }</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal">Object.seal()</a></h4><p>Stops any new properties from being added to an object, but still allows for existing properties to be changed.</p><p><strong>Example</strong></p><p>Seal an object to prevent the wearsWatch property from being added.</p><pre>const sealedObject = {<br>  name: &#39;Robert&#39;<br>}<br><br>Object.seal(sealedObject);<br><br>sealedObject.name = &#39;Bob&#39;;<br>sealedObject.wearsWatch = true;</pre><pre>// sealedObject will be equal to { name: &#39;Bob&#39; }</pre><h4><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign">Object.assign()</a></h4><p>Allows for objects to be combined together. This method is not really needed because you can use the object spread syntax instead. Like the object spread operator, Object.assign() does not do deep cloning. Lodash is your best friend when it comes to deep cloning objects.</p><p><strong>Example</strong></p><p>Combine two objects into one.</p><pre>const firstObject = {<br>  firstName: &#39;Robert&#39;<br>}<br><br>const secondObject = {<br>  lastName: &#39;Cooper&#39;<br>}<br><br>const combinedObject = Object.assign(firstObject, secondObject);<br>// combinedObject will be equal to { firstName: &#39;Robert&#39;, lastName: &#39;Cooper&#39; }</pre><p>If you found this article interesting and front end development interests you, consider following me on <a href="https://twitter.com/RobertCooper_RC"><strong>Twitter</strong></a>, <a href="https://github.com/robertcoopercode"><strong>Github</strong></a>, or <a href="https://www.linkedin.com/in/robert-cooper/"><strong>LinkedIn</strong></a>.</p><figure><a href="http://bit.ly/codeburst"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3hPOj27LTt0ZPn5TQuhZg.png" /></a></figure><blockquote>✉️ <em>Subscribe to </em>CodeBurst’s<em> once-weekly </em><a href="http://bit.ly/codeburst-email"><strong><em>Email Blast</em></strong></a><strong><em>, </em></strong>🐦 <em>Follow </em>CodeBurst<em> on </em><a href="http://bit.ly/codeburst-twitter"><strong><em>Twitter</em></strong></a><em>, view </em>🗺️ <a href="http://bit.ly/2018-web-dev-roadmap"><strong><em>The 2018 Web Developer Roadmap</em></strong></a><em>, and </em>🕸️ <a href="http://bit.ly/learn-web-dev-codeburst"><strong><em>Learn Full Stack Web Development</em></strong></a><em>.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c7971d93230" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/useful-javascript-array-and-object-methods-6c7971d93230">Useful Javascript Array and Object Methods</a> was originally published in <a href="https://codeburst.io">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rebase — One of the Most Powerful Git Commands]]></title>
            <link>https://medium.com/osedea/git-rebase-powerful-command-507bbac4a234?source=rss-3f6e1adb0f22------2</link>
            <guid isPermaLink="false">https://medium.com/p/507bbac4a234</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[rebase]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Robert Cooper]]></dc:creator>
            <pubDate>Tue, 01 May 2018 17:45:34 GMT</pubDate>
            <atom:updated>2019-05-23T19:49:19.788Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wT_8UQ0PZzNGj5P0IAha-w.jpeg" /></figure><h3>Rebase — One of the Most Powerful Git Commands</h3><p>W hen a programmer is first learning <a href="https://git-scm.com/">git</a> the typical commands that are picked up include add, commit, push, pull, status, branch, checkout and merge. After those foundational commands are learned, I think that the <a href="https://git-scm.com/docs/git-rebase">rebase</a> command should be understood.</p><p>Rebasing is often used as an alternative to merging. Rebasing a branch updates one branch with another by applying the commits of one branch on top of the commits of another branch. For example, if working on a feature branch that is out of date with a dev branch, rebasing the feature branch onto dev will allow all the new commits from dev to be included in feature. Here’s what this looks like visually:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*wkjh178sjkzFYoLEbbH6Hw.png" /><figcaption>A <strong>feature</strong> branch prior to being rebased onto <strong>dev</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*X28QJvS7TErafXt8XUy8LQ.png" /><figcaption>A <strong>feature</strong> branch after being rebased onto <strong>dev</strong></figcaption></figure><p>For the above example, this is what it would look like from the command line:</p><p><strong>git rebase feature dev</strong></p><p>However, it is more common to first checkout a branch and then run the rebase command with the name of the branch you wish to rebase on to:</p><pre><strong>git checkout feature<br>git rebase dev</strong></pre><h3>Typical Rebase Use Cases</h3><h4><strong>Updating a Feature Branch</strong></h4><p>Lets say you’re working away on a feature branch, minding your own business.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*KUHtbtm24ojaJvPhJP9y2A.png" /><figcaption>Look at all those commits you’ve been adding to your <strong>feature</strong> branch. Good job!</figcaption></figure><p>Then you notice some new commits on dev that you’d like to have in your feature branch, since the new commits may affect how you implement the feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*-H3elhFFXJNEk0oAr54Eog.png" /><figcaption>Oh man, your <strong>feature</strong> branch is now out of date with <strong>dev</strong>.</figcaption></figure><p>You decide to run <strong>git rebase dev</strong> from your feature branch to get up-to-date with dev.</p><p>However when you run the rebase command, there are some conflicts between the changes you made on feature and the new commits on dev. Thankfully, the rebase process goes through each commit one at a time and so as soon as it notices a conflict on a commit, git will provide a message in the terminal outlining what files need to be resolved. Once you’ve resolved the conflict, you <strong>git add</strong> your changes to the commit and run <strong>git rebase --continue</strong> to continue the rebase process. If there are no more conflicts, you will have successfully rebased your feature branch onto dev.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*ojp92UHnwskIs6r3WRDyEw.png" /></figure><p>Now you can continue working on your feature with the latest commits from dev included in feature and all is well again in the world. This process can repeat itself if the dev branch is updated with additional commits.</p><h4>Updating a Feature Branch Prior to Merge</h4><p>Another popular use for rebasing is to rebase a feature branch, just prior to merging into a dev branch. Let’s say that the current state of a feature and dev branch is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*wkjh178sjkzFYoLEbbH6Hw.png" /><figcaption>Initial state of a <strong>feature</strong> and dev <strong>branch</strong></figcaption></figure><p>Once thefeature is complete, it should be merged into the dev branch. First, thefeature branch should be updated with dev using <strong>git rebase dev</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*X28QJvS7TErafXt8XUy8LQ.png" /><figcaption>State of a <strong>feature</strong> and <strong>dev</strong> branch after a rebase and just prior to a merge</figcaption></figure><p>Next, merge feature into dev. This is usually done through a Pull Request, so others can review the work done in the feature branch. Once this is done, the result is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*GsMF563WyopqrIisKdKyPw.png" /><figcaption>The result of merging the <strong>feature</strong> branch into <strong>dev </strong>immediately after a rebase</figcaption></figure><p>Notice how all the commits from the feature branch are added to the <em>end</em> of the dev branch. This will always be the case if rebasing is immediately done prior to merging. The reason this happens is that rebasing <em>rewrites</em> the git history and so the timestamp of the commits on the rebased branch will all be the moment at which the rebase command was run. To be clear, rewriting history with rebase <em>recreates commits</em> that contain the same changes and commit message, but with a new <a href="https://blog.thoughtram.io/git/2014/11/18/the-anatomy-of-a-git-commit.html#introducing-sha-1">hash</a> and timestamp. Therefore, when merging a recently rebased feature branch into dev, all the feature branch commits will be added at the end of dev since <strong>merging orders commits in chronological order</strong>.</p><p>Github actually has an option on Pull Requests to rebase a branch prior to merging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*gW5ea-IKgn7eimAhzGoecw.png" /><figcaption>Github’s allows to rebase and merge branches through their Pull Request interface</figcaption></figure><h4>Renaming &amp; Consolidating Commits in Feature Branches</h4><p>Odds are, when nearing the completion of a feature in a feature branch, the commit history could be improved upon by renaming some commits to something more appropriate, combining closely related commits, and/or reordering commits in a more logical order. Rebasing allows for all of this!</p><p>Since rebasing rewrites the git history, it provides some tools to specify exactly <em>how</em> to rewrite the history. The best way to take advantage of these <em>extra</em> rebase features is by running rebase in interactive mode by passing the -i flag with the command (i.e. <strong>git rebase -i feature dev</strong>).</p><p>When running an interactive rebase, a list of commits that will be rebased along with the word pick at the beginning of each commit message is presented in the default git editor configured on your machine (in my case it’s <a href="https://code.visualstudio.com/">Visual Studio Code</a>). The word pick can be changed with any of the following options (all of which are listed when running an interactive rebase):</p><pre>pick = use commit<br>reword = use commit, but edit the commit message<br>edit = use commit, but stop for amending<br>squash = use commit, but meld into previous commit<br>fixup = like &quot;squash&quot;, but discard this commit&#39;s log message<br>exec = run command (the rest of the line) using shell<br>drop = remove commit</pre><p>For the examples mentioned earlier here’s how you would tackle them:</p><ul><li>A commit message can be reworded using the reword option for a commit.</li><li>Combining commits is done with the squash or fixup option on a commit that should be combined with another commit. Ensure that the commit specified with squash/fixup immediately follows the commit with which it should be combined.</li><li>Reordering commits is as simple as moving around the commit messages in the desired order.</li></ul><h3>What’s So Great About Rebasing?</h3><h4><strong>No Merge Commits</strong></h4><p>Merging two branches together always requires a merge commit. If a feature branch is continually being updated with a dev branch using a merge, there will be several merge commits resulting in a less clear git history.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*qWKTZG72Ke6aD6qYq8eVDQ.png" /><figcaption>Here is a <strong>feature</strong> branch out of date with a <strong>dev</strong> branch</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*-ZUr3fOPCM6-MiM8xkz9Gw.png" /><figcaption>Updating the <strong>feature</strong> branch with <strong>dev</strong> using a merge results in a merge commit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*f5ZbNmORaZB4dItuXgdGtg.png" /><figcaption>Here, there are additional new commits to <strong>dev</strong> after the first merge has occured on the <strong>feature</strong> branch</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*XsFPRqtHKUEBTvlyZdbw8g.png" /><figcaption>A second merge between <strong>feature</strong> and <strong>dev</strong> is performed to update the <strong>feature</strong> branch. Now, there are 2 merge commits on the <strong>feature</strong> branch.</figcaption></figure><p>These merge commits can be completely mitigated if rebase is used to update the feature branch instead of a merge.</p><h4><strong>Linear &amp; Sequential Git History</strong></h4><p>When rebasing a branch prior to a merge, all the the feature branch commits are grouped together at the end of the dev branch whereas the feature branch commits are interspersed in the dev branch when a rebase is not used prior to merge. This is because merging orders commits chronologically. Grouping feature commits together, as is the case with a rebase, makes it simple to understand/analyze the git history afterwards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*AMbrgMQ3OkDwTg_qnSTL5Q.png" /><figcaption>The result of merging a <strong>feature</strong> branch into <strong>dev </strong>without rebasing prior to merging. Notice how the <strong>feature</strong> commits are scattered among the <strong>dev</strong> commits. The red commit is the merge commit.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*GsMF563WyopqrIisKdKyPw.png" /><figcaption>The results of rebasing prior to merging a <strong>feature</strong> branch into <strong>dev</strong>. Notice how all the <strong>feature</strong> commits follow the <strong>dev</strong> commits. The red commit is the merge commit.</figcaption></figure><h4><strong>Simpler Time Resolving Conflicts</strong></h4><p>When rebasing, git applies each commit one at a time and so <strong>conflicts can be resolved progressively</strong>. When resolving conflicts for a merge, all conflicts must be resolved at once which can make it a bit more difficult to handle.</p><p>If a conflict is encountered while rebasing, git will indicate which files are conflicting and need to be modified. After changes have been made, the changes need to be staged to the commit and then the rebase can resume using <strong>git rebase --continue</strong>. There is also the option of running <strong>git rebase --abort</strong> while resolving conflicts in a rebase, which will cancel the rebase and leave the branch unchanged.</p><h4><strong>Well Organized and Clean Git History</strong></h4><p>With all the benefits above in addition to the ability to change commit messages, combine commits, and reorder commits, rebasing makes for a very clean git history that is easy to understand. Having an understandable git history is great when trying to pinpoint when a certain feature or bug was introduced in your codebase.</p><h3>When Not To Rebase</h3><p>Ok, rebasing is pretty sweet, but there are certainly cases where you should not rebase. The <a href="https://www.atlassian.com/git/tutorials/merging-vs-rebasing#the-golden-rule-of-rebasing">golden rule of rebasing</a> is to <strong>not rebase public branches</strong>. The reason you shouldn’t rebase a public branch is that you are <em>rewriting</em> the git history for that branch and this will result in your version of the public branch to differ from the version other users are working with. This will result in a bunch of conflicts and can be a tedious problem to resolve once it’s done, so make sure to <strong>only rebase branches you, <em>and only you</em>, are working on</strong>.</p><p>Adding <strong>git rebase</strong> to your git workflow can be an extremely valuable way of cleaning up your git history and making the overall git workflow easier to work with. The way rebase works may not be completely intuitive at first, but after using the command a few times on feature branches to better familiarize yourself with it, you’ll hopefully end up seeing some of the benefits mentioned in this article.</p><h4>Related Git Rebase Resources &amp; Readings</h4><p><a href="https://git-scm.com/docs/git-rebase">Git Rebase Documentation</a></p><p><a href="https://www.atlassian.com/git/tutorials/merging-vs-rebasing#the-golden-rule-of-rebasing">Merging vs. Rebasing — Bitbucket</a></p><p><a href="https://shift.infinite.red/git-time-travel-magic-amend-rebase-319c5a0f4e9c">Git Time Travel Magic — Gant Laborde</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=507bbac4a234" width="1" height="1" alt=""><hr><p><a href="https://medium.com/osedea/git-rebase-powerful-command-507bbac4a234">Rebase — One of the Most Powerful Git Commands</a> was originally published in <a href="https://medium.com/osedea">Osedea</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>