<?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 Persis Randolph on Medium]]></title>
        <description><![CDATA[Stories by Persis Randolph on Medium]]></description>
        <link>https://medium.com/@persis-randolph?source=rss-5d450a8b5b78------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LM_Xg6gYGoi3MD0ow1a_PQ.jpeg</url>
            <title>Stories by Persis Randolph on Medium</title>
            <link>https://medium.com/@persis-randolph?source=rss-5d450a8b5b78------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 00:15:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@persis-randolph/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[Women in Tech]]></title>
            <link>https://persis-randolph.medium.com/women-in-tech-26837d217836?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/26837d217836</guid>
            <category><![CDATA[history-of-technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Wed, 14 Jul 2021 20:08:03 GMT</pubDate>
            <atom:updated>2021-07-14T20:08:03.511Z</atom:updated>
            <content:encoded><![CDATA[<p>…and their frequently ignored stories</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*rGat46iEGxucAJ-ZB9_Wzg.jpeg" /><figcaption>Image of Ada Lovelace: MASHABLE COMPOSITE ALFRED EDWARD CHALON/SCIENCE &amp; SOCIETY PICTURE LIBRARY</figcaption></figure><p>As a woman, and as a person with a multi-racial background, diversity and inclusivity is a major area of concern. After hearing a recent <a href="https://redcircle.com/shows/big-technology-podcast">Big Technology Podcast</a> where former Microsoft board member Maria Klawe asked Bill Gates why Microsoft wouldn’t consider a single woman (in a cast of 50 potential succession candidates for the then-CEO) and his response was “Are you f — king trying to destroy the company?”, it occurs to me that I need to play more of an active role in trying to encourage other women to enter STEM (Science, Technology, Engineering, and Mathematics) fields and make our voices and concerns heard.</p><p>According to the <a href="https://www.commerce.gov/data-and-reports/reports/2017/11/women-stem-2017-update">2017 Women in STEM update</a>, “Women filled 47 percent of all U.S. jobs in 2015 but held only 24 percent of STEM jobs. Likewise, women constitute more slightly more than half of college-educated workers but make up only 25 percent of college-educated STEM workers.”</p><p>Personally, my interest in STEM fields started when I was young, being raised in the 90s very aware of the burgeoning internet, and with a software developer father (and a former programmer analyst mother). I was very lucky to live in a part of the country that had a good public school system and was exposed to science and mathematics at a very young age. I quickly decided I wanted to be an astronaut (that went out the window pretty quickly) but have eventually landed myself as a participant in the tech industry.</p><p>I’m very proud to be in the tech industry, but I definitely don’t see myself surrounded by very many examples of other women in my field. Per research done by the <a href="http://www.equality-of-opportunity.org/data/">Equality of Opportunity Project</a>, giving young girls exposure to female inventors “has the potential to reduce the gender gap in technical STEM fields by half.” I wanted to write this article to learn and teach some about just a few of the many female contributors to the technology industry over time.</p><h3>Ada Lovelace (1815–1852)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*C9or1aMkAMXOFYyF.jpg" /><figcaption>US Public Domain — Painting of Ada Lovelace at a piano in 1852 by Henry Phillips</figcaption></figure><p>She’s so monumental they’ve dubbed every second Tuesday in October Ada Lovelace Day. This is meant to celebrate women&#39;s achievements in STEM fields.</p><p>Ada Lovelace was the sole child of Lord and Lady Byron, Lord Byron being known as a prominent English politician and poet. She didn’t have a real relationship with her father, but she was a mathematician and writer herself. Lovelace had a great interest in the Analytical Machine, a theoretical machine designed by Charles Babbage. She was the first to realize the potential of the machine to make computations beyond calculations and created the first algorithm for such a machine. Because of this, she is often thought of as the first computer programmer.</p><p>Lovelace had a short life of 36 years and was frequently ill throughout. Regardless of her illnesses, she had a very unique perspective coming at science with a poetic and imaginative mind. Her desire to question basic assumptions of maths and science led to forward-thinking ideas.</p><h3>Annie Easley (1933–2011)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*M0hLldccqRC9ZOVU.jpg" /><figcaption>US Public Domain — NASA Science and Engineering Newsletter featuring Easley at the Lewis Research Center</figcaption></figure><p>Easley was brought up before the Civil Rights Movement and despite all of the adversity she faced, she became valedictorian of her high school class and went on to study pharmacy at Xavier University in New Orleans (shout out to my city) for two years.</p><p>Easley ended up moving to Cleveland with her then-husband to be near to his family and was unable to continue her education in pharmacy. Upon reading about two twin sisters who were “human computers” at the nearby NACA (National Advisory Committee for Aeronautics — a predecessor of NASA) Center, she promptly applied for a job and became one of four African American employees out of their 2500 total.</p><p>Honestly, Annie Easley just blows my mind as a role model. Not only did she go on to work as a computer scientist, mathematician, and rocket scientist for NACA, but also led the team which developed software for the Centaur rocket stage and developed code that led to the battery used in hybrid cars. She eventually went back to Cleveland State while working full-time, earning her degree in mathematics went on to additional take on the role of EEO (Equal Employment Opportunity) Counselor, helping to address issues of gender, race, and age discrimination. She was also one of the first female workers to wear pants and paved the way for other women’s rights in the workplace. The IAU named one of the moon’s craters was named after Easley in February.</p><h3>Mary Wilkes (1937-present)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/0*hUcaGL7bxiaV1fJn.jpg" /><figcaption>CC License — Photo of Mary Allen Wilkes — With the LINC computer at Home — 1965</figcaption></figure><p>During Mary Wilkes’s childhood, she was encouraged by a teacher to be a computer programmer when she grew up. Surely enough, Wilkes went on to work at MIT programming two IBM computers, the IBM 704 and 709. She was notably the first user of a personal computer in her own home while working on the LINC LAP6 operating system, which she developed and had many interactive capabilities. She is quoted saying, “I’ll bet you don’t have a computer in your living room.” which was definitely a good bet at the time.</p><p>I’m also a big fan of her quote, “We had the quaint notion at the time that software should be completely, absolutely free of bugs. Unfortunately, it’s a notion that never really quite caught on.” Hard to think of truer things said.</p><p>Wilkes did eventually leave the computer sciences in 1972 and received her law degree from Harvard. Don’t fret, she did still focus on cases involving computer science and information technologies with the American Arbitration Association.</p><h3>Summing It Up</h3><p>Hopefully, you’ve learned something about these stand-out women in technology as I have while spending the time to research them. I hope to revisit this article later on and to add more information. Please let me know some of your favorite women in tech so I can add them to the list! And finally, please encourage the women in your life to pursue their interests, whatever they may be.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26837d217836" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publishing an iOS App to the App Store]]></title>
            <link>https://persis-randolph.medium.com/publishing-an-ios-app-to-the-app-store-84b1fef6d5df?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/84b1fef6d5df</guid>
            <category><![CDATA[guidelines]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[ios-apps]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Fri, 09 Jul 2021 03:37:10 GMT</pubDate>
            <atom:updated>2021-07-09T03:37:10.725Z</atom:updated>
            <content:encoded><![CDATA[<p>Guidelines for Submission</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8LMbgRdkHHhLtG3RYvCxA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@lastly?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Tyler Lastovich</a> on <a href="https://unsplash.com/s/photos/iphone?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>When submitting an iOS app to the App Store, you may come across the same lengthy set of documentation that I did — the <a href="https://developer.apple.com/app-store/review/guidelines/">App Store Review Guidelines</a>. If you’re anything further like me, you may have felt a little overwhelmed by the sheer length. I’ve provided a short rundown on the guidelines to help those who are getting ready to submit their first iOS app!</p><h3>Prerequisites</h3><p>In order to submit an app to the App Store, you need to have an Apple Developer’s account which costs a fee of $99 annually.</p><p>We’ll focus on 5 different sections breaking down the guidelines — safety, performance, business, design, and legal.</p><h3>Safety</h3><ol><li>Don’t include anything that could be upsetting or offensive. This includes anything that could be considered as negative to any particular group of people, violent imagery, pornographic material, or inaccurate, misleading information.</li><li>If accepting user-generated content, you need to be able to filter out anything that might be offensive, remove users who break rules, and users need to be able to report concerns.</li><li>Developer contact information needs to be provided and up to date in order to be reachable for help or support issues.</li><li>Data security is important. The app needs to properly handle user information, taking precautionary steps when needed, in order to prevent unauthorized data usage.</li></ol><h3>Performance</h3><ol><li>Testing should have been thoroughly done before the app is submitted for review. They don’t accept demos, betas, and trial versions. Bugs should be gone and there shouldn’t be any obvious technical issues.</li><li>The app should be complete and fully functional at a production level when submitted. All temporary/placeholder content should have been replaced with the real stuff and everything should be ready to go.</li><li>Metadata needs to be up to date, this includes the app description, screenshots, previews, and privacy information that you provide with the submission. This data needs to be kept up to date with each new version. You also need to select an appropriate category, answer age rating questions, and choose a unique app name.</li><li>The App Store suggests that iOS should be able to run on both the iPhone and the iPad if possible. The app should also preserve power and cannot make any changes to the device’s system settings.</li><li>As far as software goes, the app shouldn’t include any deprecated features or technologies. They also need to request user consent if they are recording or logging user activities. The app must be self-contained, which means it cannot be set up to download, install, or execute code that affects your device.</li></ol><h3>Business</h3><ol><li>This section mainly focuses on payments and In-App Purchases. They mostly stress that you cannot set up your own payment systems, you need to utilize in-app purchases if including unlockable features or subscription systems. Purchases are not allowed to expire, and the policies for auto-renewal for subscriptions need to be clearly disclosed.</li><li>With advertisements you should avoid dark patterns, this includes tricking users into clicking things they don’t intend on clicking. If ads are in the main user experience they need to be clearly marked as such and should be able to be easily closed or skipped. Ads also need to consider the age rating, don’t include inappropriate advertisements on an app deemed appropriate for children.</li><li>This is hopefully obvious, but you cannot manipulate reviews or inflate rankings by incentivizing feedback or creating fake feedback or you risk having your app removed and your developer account banned.</li></ol><h3>Design</h3><ol><li>No copycat apps. Apps cannot be slightly altered versions of pre-existing apps.</li><li>Needs to be more functional or have more entertainment value than a website. If it doesn’t seem like an app, and it seems like it could function as a website, the App Store probably won’t accept it.</li><li>Things like push notifications have to be opt-in. These cannot be required for app functionality.</li><li>If you offer any sort of third-party or social login service (i.e. Facebook, Google, GitHub, Twitter), you also need to offer Sign In with Apple.</li></ol><h3>Legal</h3><ol><li>Privacy policies need to be linked to the app. The privacy policy must include what identifying data will be collected, how the data will be used, identify any data sharing that will be done with third parties, and must include data retention and deletion policies.</li><li>You should only request data from the users that will be relevant to the core functionality of the app.</li><li>Data use and sharing can only be done with explicit user consent. You cannot repurpose without further consent.</li><li>If you need to include account sign-in (only do if necessary), you need to include a way for users to delete their accounts directly from the application.</li><li>You must follow all local and federal laws, as well as consider privacy laws for children (if your age rating includes children or is categorized as a kid’s app) like COPPA (Children’s Online Privacy Protection Act).</li><li>Only use your own intellectual property. You must have created the content directly or be licensed to use it.</li></ol><h3>Conclusion</h3><p>So, there are a lot of rules to follow and they can technically change whenever Apple deems it suitable. I believe the best approach is to try your hardest to meet all of those already specified, but leave yourself enough time for the review process and a possible revision if requested before approval. The App Store reviews about 1000K apps per week and it can take anywhere from a few days to a couple of weeks to get a response.</p><p>Once approved, make sure you keep your app up to date with non-deprecated technologies, keep it maintained, and keep the metadata up to date. Happy apping!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84b1fef6d5df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running cron jobs with node.js]]></title>
            <link>https://persis-randolph.medium.com/running-cron-jobs-with-node-js-5ff9fee4da56?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ff9fee4da56</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[cron]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Thu, 01 Jul 2021 03:32:56 GMT</pubDate>
            <atom:updated>2021-07-01T03:32:56.566Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VyVEdcJFgt9h1fPMAzhKaQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ikukevk?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Kevin Ku</a> on <a href="https://unsplash.com/s/photos/time-management?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>What are cron jobs?</h3><p>Cron jobs are a way to schedule repeated tasks, mostly used by system administrators. Crons are a background process (daemon) that you can set up to run commands on a schedule. Automating tasks like monitoring disk space, performing system maintenance, backing up files, backing up databases, or running any other type of script can also be greatly beneficial for a busy dev.</p><h3>Let’s do it!</h3><p>A cron is usually a text file, but today we’ll be using a dependency, node-cron, to simplify the process.</p><p>Install cron in your project’s root directory with the following script.</p><pre>npm install cron</pre><p>You’ll need to have a server running where you can set up your cron job. In the example below I’ve set up a simple server using express. This is my index.js file.</p><pre>const express = require(&#39;express&#39;);</pre><pre>const app = express();<br>const PORT = 8080;</pre><pre>app.listen(`localhost:${PORT}`, `cron-demo listening on port ${PORT}`);</pre><p>I’ve set up another file for the cron job. This is cron.js.</p><pre>const { CronJob } = require(&#39;cron&#39;);</pre><pre>console.log(&#39;this will log before job instantiation&#39;);<br>const job = new CronJob(&#39;* * * * * *&#39;, () =&gt; {<br>  console.log(&#39;cron is executing now. timestamp: &#39;, new Date());<br>})<br>console.log(&#39;this will log after job instantiation&#39;);</pre><pre>module.exports = { job };</pre><p>Let’s break down this file so you know what’s happening. Here, we require our necessary dependency, cron.</p><pre>const { CronJob } = require(&#39;cron&#39;);</pre><p>When your server boots up, we’ll run the cron job (it isn’t set up in app.js yet, we’ll do that a few steps down the line). You’ll be able to tell the job is starting with this line.</p><pre>console.log(&#39;this will log before job instantiation&#39;);</pre><p>This is where we’ll define the new cron. Here you see the keyword new used in conjunction with CronJob to invoke a new instantiation of a cron job. The first parameter will be six asterisks, or number values in their place, depending on how you’d like to schedule the cron.</p><p>Six asterisks means that this job will run every second, of every minute, of every hour, of every day of the month, of every month, on every day of the week.</p><p>These are the ranges as defined by the <a href="https://github.com/kelektiv/node-cron">node-cron documentation</a>:</p><ul><li>Seconds: 0–59</li><li>Minutes: 0–59</li><li>Hours: 0–23</li><li>Day of Month: 1–31</li><li>Months: 0–11 (Jan-Dec)</li><li>Day of Week: 0–6 (Sun-Sat)</li></ul><p>For each asterisk, you can replace it with the corresponding value from the above ranges.</p><pre>const job = new CronJob(&#39;* * * * * *&#39;, () =&gt; {<br>  console.log(&#39;cron is executing now. timestamp: &#39;, new Date());<br>});</pre><p>If our cron works correctly, you should be able to see a console.log statement every second with a current timestamp.</p><p>Next, we see a log that shows you the job instantiation has been completed and we also export the job to be used elsewhere.</p><pre>console.log(&#39;this will log after job instantiation&#39;);</pre><pre>module.exports = { job };</pre><p>Now, let’s run the cron by importing it and using it after starting up our server. Back in index.js, let’s add a line to import, and to call the newly created cron job.</p><pre>const express = require(&#39;express&#39;);<br>const { job } = require(&#39;./cron&#39;); // require the job</pre><pre>const app = express();<br>const PORT = 8080;</pre><pre>app.listen(`localhost:${PORT}`, `cron-demo listening on port ${PORT}`);<br>job.start(); // here we instantiate the cron job</pre><p>When you start up your server you should now see the console.log statements coming from the cron job every second. It should look something like this:</p><pre>➜  cron-demo node index.js<br>this will log before job instantiation<br>this will log after job instantiation<br>cron is executing now. timestamp:  2021-07-01T03:26:15.003Z<br>cron is executing now. timestamp:  2021-07-01T03:26:16.003Z<br>cron is executing now. timestamp:  2021-07-01T03:26:17.000Z<br>cron is executing now. timestamp:  2021-07-01T03:26:18.002Z<br>cron is executing now. timestamp:  2021-07-01T03:26:19.001Z<br>cron is executing now. timestamp:  2021-07-01T03:26:20.004Z<br>cron is executing now. timestamp:  2021-07-01T03:26:21.000Z<br>cron is executing now. timestamp:  2021-07-01T03:26:22.000Z<br>cron is executing now. timestamp:  2021-07-01T03:26:23.004Z</pre><p>Next, I’d recommend playing around with some different time ranges. See if you can get the cron to run every 20 seconds or every few minutes. There are lots of examples in the documentation in case you want to run a command each day at midnight, or even simply once a month!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ff9fee4da56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chart Making with Chart.js]]></title>
            <link>https://persis-randolph.medium.com/chart-making-with-chart-js-dc84a05b7aa7?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc84a05b7aa7</guid>
            <category><![CDATA[charts]]></category>
            <category><![CDATA[top-javascript-libraries]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Tue, 22 Jun 2021 01:00:47 GMT</pubDate>
            <atom:updated>2021-06-22T01:00:47.935Z</atom:updated>
            <content:encoded><![CDATA[<p>Chart.js is an open-source chart creation library that developers and designers can use for quick and flexible chart creation in their projects. They currently offer bar, line, bubble, scatter, doughnut, pie, polar area, radar, scale, and many more chart options. You can customize charts using different colors, labels, scaling, tooltips, and other provided options. We’ll go over a few in more detail below.</p><h3>Installation</h3><p>Typically, users should install Chart.js into their root project directory with <a href="https://www.npmjs.com/package/chart.js?activeTab=readme">npm</a>. Or if you prefer, there are a few alternative methods listed on their <a href="https://www.chartjs.org/docs/latest/getting-started/installation.html">installation page</a> (CDNJS, jsDelivr, or downloading the repo on Github — not recommended).</p><pre>npm install chart.js</pre><p>After installation, include it on your page with the following script tag:</p><pre>&lt;script src=&quot;https://cdn.jsdelivr.net.npm/chart.js&quot;&gt;&lt;/chart&gt;</pre><h3>Chart Creation</h3><p>To create a chart, you’ll first need to include canvas. For the sake of responsiveness, they recommend you wrap the chart in its own container.</p><pre>&lt;div&gt;<br>  &lt;canvas id=&quot;sleepChart&quot;&gt;&lt;/canvas&gt;<br>&lt;/div&gt;</pre><p>Once you’ve created the canvas, you can include a script to set up and configure your chart. A label array is used to label the index axis (defaults to x, but can be set as the y axis).</p><pre>const labels = [<br>  &#39;Monday&#39;,<br>  &#39;Tuesday&#39;,<br>  &#39;Wednesday&#39;,<br>  &#39;Thursday&#39;,<br>  &#39;Friday&#39;,<br>  &#39;Saturday&#39;,<br>  &#39;Sunday&#39;<br>];</pre><p>And a data object is used to hold the rest of the setup information.</p><pre>const data = {<br>  labels: labels,<br>  datasets: [{<br>    label: &#39;Hours of Sleep This Week&#39;,<br>    backgroundColor: [&#39;red&#39;, &#39;orange&#39;, &#39;yellow&#39;, &#39;green&#39;, &#39;blue&#39;,    &#39;indigo&#39;, &#39;violet&#39;],<br>    borderColor: &#39;black&#39;,<br>    borderWidth: 1,<br>    data: [6, 8, 5, 7.5, 6, 5.5, 9, 8.5],<br>  }]<br>};</pre><p>The data object contains the labels, set to the labels array from above, and a datasets array which holds an object setting some general information about the desired chart. In this case, we’ve set the label (chart title) to ‘Hours of Sleep This Week’, an array of backgroundColor (you can just specify one instead of an array), a chart border color, border width, and also set some data to include in our chart.</p><p>You will also need to include a configuration object.</p><pre>const configuration = {<br>  type: &#39;bar&#39;,<br>  data: data,<br>  options: {<br>    scales: {<br>      y: {<br>        beginAtZero: true<br>      }<br>    }<br>  }<br>};</pre><p>This configuration sets the type of graph, I’ve specified a bar graph, data, which specifies the data object from above, and options. This options object includes a scales object which specifies that the y axis labeling should begin at zero.</p><p>After setting all of your preferences you can declare a new chart using the proper id and configuration in order to append it to the document.</p><pre>const sleepChart = new Chart(<br>  document.getElementById(&#39;sleepChart&#39;),<br>  configuration<br>);</pre><p>In the end, I’ve made a chart only I could love (and even that is questionable) just to demonstrate some of the basic options you can play around with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-DzC9vs5Ovjbo6PaYRQmhA.png" /></figure><h3>Line Graph</h3><p>Here’s the setup for a basic line graph.</p><pre>const labels = [<br>  &#39;A&#39;,<br>  &#39;B&#39;,<br>  &#39;C&#39;,<br>  &#39;D&#39;<br>];</pre><pre>const data = {<br>  labels: labels,<br>  datasets: [{<br>    label: &#39;Beginner\&#39;s Line Graph&#39;,<br>    backgroundColor: &#39;#FFF&#39;,<br>    borderColor: &#39;#000&#39;,<br>    data: [1, 3, 4, 2]<br>  }]<br>};</pre><pre>const config = {<br>  type: &#39;line&#39;,<br>  data: data,<br>  options: {}<br>};</pre><pre>const myChart = new Chart(<br>  document.getElementById(&#39;beginnerChart&#39;),<br>  config<br>);</pre><p>And the output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*_RUMo6dtEb4TQR9QsYAY1w.png" /></figure><p>You can see that this chart did not specify the y-axis starting at 0 so it simply includes values given in the data set.</p><h3>Other Charts</h3><p>Here are some examples of other chart options from the Chart.js documentation.</p><h4>Radar Chart</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*ZWthgB4YgKNPYiP-jgDKYg.png" /><figcaption>All further examples from chartjs.org</figcaption></figure><h4>Doughnut Chart</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*Bb4-6cwcRhFQXJ21f5_mBQ.png" /></figure><h4>Pie Chart</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*PUIrmlGHfc2hFqMh8vRSNg.png" /></figure><h4>Scatter Chart</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*uqi_Op-4enrOK6u95gCJeg.png" /></figure><p>As you can see, there are a variety of options and customizations available to create quick and easy charts for your application. Compared to other charting libraries, this one is very easy to integrate into your app in a flexible and responsive way. Have fun charting!</p><p><em>Check out the Chart.js documentation at </em><a href="https://www.chartjs.org/"><em>chartjs.org</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc84a05b7aa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Actions]]></title>
            <link>https://persis-randolph.medium.com/github-actions-c3bf443a421f?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3bf443a421f</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[github-actions]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Mon, 14 Jun 2021 06:05:13 GMT</pubDate>
            <atom:updated>2021-06-14T06:05:13.728Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are GitHub Actions?</h3><p>GitHub actions are a way to quickly automate software development workflows. As a developer, there are a lot of tedious and repetitive tasks that must be done to keep an app organized and managed when trying to deploy or do pre-deployment steps. Some of these tasks include checking pull requests, merging a branch back in with the main branch, testing, building, deploying, adding new contributors, dealing with user-submitted issues (assigning, labeling, trying to reproduce bugs).</p><p>There are so many tasks to complete, especially with a growing or larger project, that it is to our advantage to automate as many of these tasks are possible so that the devs have more time to concentrate on the actual coding and functionality of the project.</p><h3>Events</h3><p>When something happens in or to your repo, these are called events. GitHub actions will respond and execute designated workflows when specified events occur. Some examples of events that you might have GitHub actions listen for are creations of new pull requests, merging of pull requests, new contributors joining the project, and creation of issues.</p><p>If the event was a new issue created by a user, you might have a workflow that sorts that issue by the level of severity, labels it, assigns it to a developer, or tries to reproduce the reported bug. This triggered workflow would be composed of GitHub actions that would run each of these desired steps.</p><h3>A Quick Look</h3><p>Let’s walk through an example workflow file. GitHub offers many templates to choose from. You can view them by simply clicking on the Actions tab from your repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-K-FaLjd5U2fwRjGLULuiw.png" /><figcaption>GitHub Action tab default view</figcaption></figure><p>Here I’ve decided to select the option on the right — Node.js. This workflow is designed to “Build and test a Node.js project with npm.”</p><p>When you click “Set up this workflow” you will be presented with a file that looks like this:</p><pre># This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node<br># For more information see: <a href="https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions">https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions</a></pre><pre>name: Node.js CI</pre><pre>on:<br>  push:<br>    branches: [ main ]<br>  pull_request:<br>    branches: [ main ]</pre><pre>jobs:<br>  build:</pre><pre>runs-on: ubuntu-latest</pre><pre>strategy:<br>      matrix:<br>        node-version: [10.x, 12.x, 14.x, 15.x]<br>        # See supported Node.js release schedule at <a href="https://nodejs.org/en/about/releases/">https://nodejs.org/en/about/releases/</a></pre><pre>steps:<br>    - uses: actions/checkout@v2<br>    - name: Use Node.js ${{ matrix.node-version }}<br>      uses: actions/setup-node@v2<br>      with:<br>        node-version: ${{ matrix.node-version }}<br>    - run: npm ci<br>    - run: npm run build --if-present<br>    - run: npm test</pre><p>By default, this file will be a .yml file created in your root folder in a directory called .github/workflows. You can designate whatever name you choose for the file itself.</p><p>Let’s break down this file.</p><pre>name: Node.js CI</pre><p>This line simply designates a description of the workflow.</p><pre>on:<br>  push:<br>    branches: [ main ]<br>  pull_request:<br>    branches: [ main ]</pre><p>The lines in the on section designates the events that trigger the workflow. This workflow would be triggered on both push requests to the main branch, and pull requests to the main branch.</p><pre>jobs:<br>  build:</pre><pre>runs-on: ubuntu-latest</pre><pre>strategy:<br>      matrix:<br>        node-version: [10.x, 12.x, 14.x, 15.x]<br>        # See supported Node.js release schedule at <a href="https://nodejs.org/en/about/releases/">https://nodejs.org/en/about/releases/</a></pre><p>This section specifies the action that will be taken on push and pull requests to the main branch, in this case, a build action.</p><p>runs-on specifies the environment for which this build will need to work. You can specify multiple environments if you wish using matrix. You can see this at work in the strategy section. strategy shows the node versions that should be acceptable for this build.</p><pre>steps:<br>    - uses: actions/checkout@v2<br>    - name: Use Node.js ${{ matrix.node-version }}<br>      uses: actions/setup-node@v2<br>      with:<br>        node-version: ${{ matrix.node-version }}<br>    - run: npm ci<br>    - run: npm run build --if-present<br>    - run: npm test</pre><p>The steps section is the actual run-down of specifications in order to do the build. Here we start with uses: actions/checkout@v2. This line specifies that we will use the pre-defined action called checkout (version 2). This action actually checks out your repository and prepares it in a new virtual environment in order to run this workflow.</p><pre>name: Use Node.js ${{ matrix.node-version }}<br>      uses: actions/setup-node@v2<br>      with:<br>        node-version: ${{ matrix.node-version }}</pre><p>These lines instruct using the node versions specified in the strategy matrix in the pre-defined action setup-node (version 2).</p><pre>    - run: npm ci<br>    - run: npm run build --if-present<br>    - run: npm test</pre><p>Then, last but not least, the workflow will run these 3 commands, npm ci, npm run build --if-present and npm test.</p><p>For each job, GitHub Actions prepares a new virtual environment so you don’t have to worry about any cross-contamination. These jobs run in parallel by default, but you can run consecutively instead, overriding the default with the line needs: &lt;name of previous job required&gt; in the successive jobs.</p><h3>Summing It Up</h3><p>GitHub Actions are a great way to quickly automate tasks that you will need to perform on a regular basis. Since you already have your repository hosted on GitHub you have one less tool to use, instead of relying on another third-party integration. The setup is very minimal due to their templates and pre-defined actions. A lot of different technologies can be used in tandem with the differently configured workflows available.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3bf443a421f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mocha.js Basics]]></title>
            <link>https://persis-randolph.medium.com/mocha-js-basics-901196a831bb?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/901196a831bb</guid>
            <category><![CDATA[mocha]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[testing-framework]]></category>
            <category><![CDATA[chai]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Mon, 10 May 2021 13:25:34 GMT</pubDate>
            <atom:updated>2021-05-10T13:25:34.746Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H0kxZzvNvGvnn7sso9rfww.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@framemily?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Frame Harirak</a> on <a href="https://unsplash.com/s/photos/mocha?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Testing is a crucial step of the development process. Having comprehensive tests allows for developers to safely make changes without the fear of having caused bugs in another part of the program, or unintentional side effects. A thorough set of tests would expose these errors quickly and make sure that the program was still in working order when the bug-fix or new feature was released. The goal is to expose problems as quickly as possible, allow for easy debugging, and no unintentional steps backward in functionality.</p><p>Mocha is a great example and one of the most popular frameworks you can use for this testing. It’s an open-source JavaScript testing library that runs on Node.js and in the browser. Since Mocha was designed specifically for testing Node applications, it has more back-end tools and documentation compared to other testing frameworks. However, it does generally require more dependencies than other testing libraries, and is typically used in conjunction with the assertion library, <a href="https://www.chaijs.com/">Chai</a>.</p><p>It uses Behavior Driven Development (BDD) to describe expected behaviors in a way that is clear to all contributors to the software, instead of just the testers and the developers. BDD expands from Test Driven Development (TDD) in this way. Using language close to common English allows accessibility of intention to be understood by others with stakes in the same project (project managers, salespeople, product owners, etc.) and reads more simply than some other testing frameworks.</p><pre>expect(2 + 2).to.equal(4);<br>expect(exampleArray).to.have.lengthOf(7);</pre><p>Mocha executes tests in the specified order and logs results to the terminal or the browser, depending on how the tests are set up. It uses unit testing, which is breaking up the behavior of code into small bits, and testing each behavior at the smallest meaningful chunk of independent code. For this to occur properly, it is important to have independent test cases. Each test run must not affect the software state. There are built-in tools for cleaning the software state — using stub or mock.</p><h3>Prerequisites and Set-Up</h3><p>The only prerequisites for using Mocha are the installation of node and npm.</p><p>To use Mocha for a project, using npm, you can install globally, usingnpm install -global mocha, or you can install it as a dependency for a single project while in that project’s root folder, usingnpm install mocha.</p><p>Mocha expects a directory created in the project called “test” which specifically contains the test files. If this has been done, you can run tests in the terminal using the prompt mocha (or mocha --recursive if you need to include subdirectories). You can also include a script in package.json if you’d like to run tests using the shorthand npm test.</p><pre>&quot;scripts&quot;: {<br>  &quot;test&quot;: &quot;mocha&quot;<br>}</pre><p>Running the tests will display formatted text in the terminal/console to display details on whether your tests passed or failed on the current code.</p><pre>Calculator Application</pre><pre> Addition Functionality</pre><pre>  ✓ adds 2 numbers together<br>  ✓ adds multiple numbers together</pre><pre> Subtraction Functionality</pre><pre>  ✓ subtracts the specified numbers</pre><pre>3 passing (9ms)</pre><h3>Describe and It Keywords</h3><p>Mocha uses the keyword describe in order to batch a test suite (group of tests relating to a single desired functionality). Then, it uses the keyword it in order to batch unit tests (singular descriptions of the desired behavior which can either pass or fail).</p><p>The first describe keyword takes 2 arguments, the name of the program being tested, and a function. That function is made up of each test suite, each described using another describe keyword. Each of those describe keywords take 2 arguments, a description of the functionality being tested, and a function. Finally, within those blocks, we use the it keyword to take in another 2 arguments. The first being a description of the unit test, the second being another function. That function body contains a “matcher”, A.K.A. an assertion (from the Chai library), which tests the expected behavior and allows for either a pass or fail.</p><pre>const expect = require(&quot;chai&quot;).expect;<br>const calculator = require(&quot;../app/calculator&quot;);</pre><pre>describe(&quot;Calculator Application&quot;, function() {<br>  describe(&quot;Addition Functionality&quot;, function() {<br>    it(&quot;adds two numbers together&quot;, function() {<br>      const total = calculator.add(2, 3);</pre><pre>      expect(total).to.equal(5);                  <br>    };<br>    it(&quot;adds multiple numbers together&quot;, function() {<br>      const total = calculator.add(1, 2, 3);</pre><pre>      expect(total).to.equal(6);<br>    });<br>  });<br>... // other test suites here<br>}</pre><h3>Final Notes</h3><p>Mocha can be effectively used for both front-end and back-end testing, but is stronger on the back-end. You can test asynchronous behaviors using promises or the async/await pattern. If you’d like to work with fake data and requests you can use a mock server like chai-http or other similar alternatives.</p><p>In order to use this testing most efficiently, the tests are generally written before the actual application code. This is in line with Behavior Driven Development (BDD) and makes sure that the outcome of your application produces the expected behaviors. The tests should be focused on the expected results, not upon the implementation of functionality. This produces applications that stand up to change, have predictable results, and few bugs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=901196a831bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WAI Standards on Accessible Design for the World Wide Web]]></title>
            <link>https://persis-randolph.medium.com/wai-standards-on-accessible-design-for-the-world-wide-web-c971d04b9e82?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/c971d04b9e82</guid>
            <category><![CDATA[web-standards]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Tue, 04 May 2021 13:40:56 GMT</pubDate>
            <atom:updated>2021-05-04T13:40:56.133Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AI-fknSjORP3irD-giNl2g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@sigmund?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Sigmund</a> on <a href="https://unsplash.com/collections/9988127/accessibility?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>With the internet such a commonplace tool for almost everyone to do just about everything you can think of, more than ever, it’s important to think about inclusivity and accessibility when designing a website or web application.</p><h3>W3C and the WAI</h3><p>Luckily for us, there is an organization called the World Wide Web Consortium, A.K.A. the W3C (led by the inventor of the World Wide Web, Sir Tim Berners-Lee!), which develops all sorts of web standards including those for HTML, CSS, and the Web Accessibility Initiative (WAI). Straight from their website, the WAI “develops web accessibility guidelines, technical specifications, and educational resources to help make the web accessible to people with disabilities.”</p><p>The WAI goes into detailed standards, reasoning behind their guidelines, technical specifications on how to follow each guideline, and even user experience stories and videos from people who have greatly benefitted from the initiative! I highly recommend taking a look at their website if you have more interest in the subject, but I’ve also laid out some WAI basics to consider when trying to design a user-friendly accessible website or application (will refer to solely websites below, but these recommendations are applicable across the board).</p><h3>Design Recommendations</h3><h3>Color Contrast</h3><p>More technically, I’m referring to “luminance contrast”, but it is best to give options of high and low contrasting colors for background and text in order to accommodate those with visual impairments or reading disabilities. One way to accommodate this need is to build in a few color options for a website that a user could choose from in the settings.</p><p>Those with low contrast sensitivity from aging or those with other visual impairments frequently benefit from high contrast between text and background colors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*_1Y0vOq707DdJ_K0X_iF2w.png" /><figcaption>All example images from www.w3.org/WAI</figcaption></figure><p>Although high contrast colors work well for most users, others, like those with reading disabilities such as dyslexia, need low contrast colors in order for the material to be legible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*XJNWhRhED3BDPTFTRgRn3A.png" /></figure><p>In many applications, you can use the color eyedropper tool when selecting a text color and background color to show you the contrast ratio.</p><h3>Don’t Depend Solely on Color</h3><p>Although color can be important for legibility, it’s important to not rely on color as an indicator. A few examples of this are the frequent use of the color red to indicate a required field, using a faded out color to represent a previous price, or green to indicate a sale price.</p><p>People who are colorblind would have difficulty differentiating the red, required fields on the left marked solely with color, but could easily see the asterisk added on the right-side example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*Z7rGhRRW-AaNj9Sdir8o9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*O6D9mK4O7aeCIO8FP-WHfg.png" /></figure><p>The same concept applies here when making graphs or charts. You can use numbers to label or use different patterns to differentiate things, in addition to marking them with color.</p><h3>Clear Navigation</h3><p>Navigation on websites should be consistent on all of the website’s pages. This includes naming, styling, and positioning. A clear indicator of the user’s position on the website at any given time can be very helpful for those who need these visual cues.</p><p>Users who use the keyboard to toggle through a website also need this clear navigation. Toggling through a cluttered website with unclearly laid out sections using the keyboard can cause a user to get stuck in an unintended section of text. Headings make it easy for screen readers to know which sections are relevant to their search for content and allow easy tabbing through the page.</p><p>For people with certain disabilities, navigating a website just using one method can be daunting, and certain navigation features can be implemented to make this easier for them. For example, for users with dyslexia, adding a search feature can be very helpful. Since search bars allow users to misspell words and offer error correction or word prediction, they can be very helpful for those users who have difficulty with various cognitive impairments.</p><h3>Include Alternate Text and Media Choices</h3><p>For those who depend on screen readers to view the web, alternate text for images and proper labeling through the website can be incredibly helpful. Audio-described versions of videos should be made available for videos without much audio content if at all possible.</p><p>For those with hearing impairments, you can offer visible links to transcripts of the audio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*flAehdCuqIKIn-maD838PA.png" /></figure><h3>Less is More</h3><p>Websites with lots of ads and moving content can be very distracting for people with ADHD and dyslexia, among others. Try to minimize these distractions, or if they are required, make sure you include controls for those things that start movement automatically, such as advertisements, audio, and carousels of content.</p><p>Consider viewport sizes and those who need to enlarge text to make it clearly legible. In order to design for max legibility, on smaller screens, navigation and secondary information should be made viewable through icons and not be part of the main view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*4zsUyG6v_Xw6VnMRa4gMIw.png" /></figure><p>Minimizing the amount of information on each page when compared to larger viewports can be super helpful and make the most of the amount of space available on smaller screens. Make sure text can enlarge on websites and will reflow and populate the page in a manner that doesn’t cause design flaws.</p><p>Certain methods of user authentication should be avoided due to their downfalls in this area. CAPTCHA images do not resize well and cause difficulties for those with visual impairments so try to use other alternatives.</p><p><strong>For More Information:</strong></p><p>Please check out the very comprehensive WAI section of the W3C website: <a href="https://www.w3.org/WAI/">https://www.w3.org/WAI</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c971d04b9e82" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git-ting Personal with git reset, revert, merge, and rebase]]></title>
            <link>https://persis-randolph.medium.com/git-ting-personal-with-git-reset-revert-merge-and-rebase-767e90415cc6?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/767e90415cc6</guid>
            <category><![CDATA[git-rebase]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[git-reset]]></category>
            <category><![CDATA[git-merge]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Mon, 26 Apr 2021 13:36:53 GMT</pubDate>
            <atom:updated>2021-04-26T13:38:39.954Z</atom:updated>
            <content:encoded><![CDATA[<p>Dealing with change is hard for everyone, but it doesn’t have to be quite such an ordeal!</p><p>In git world, you can pretend your mistakes never happened. You’ve got the help of git reset and revert.</p><p>When you finally grow and learn from your mistakes, you can be ready to work with others. Do this with the help of trusty git merge and rebase.</p><p>Now that I’m done saying that… here’s some information on the differences between these git methods, how, and when, to use them to your advantage.</p><h3><strong>git reset and revert (the “undo” commands)</strong></h3><h4><strong>git reset</strong></h4><p>git reset unstages the specified file and discards commits in a private branch or throws away uncommitted changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*Clc5Eect8QGBwKgNanUmag.png" /><figcaption>All images from <a href="https://www.atlassian.com/git/tutorials">https://www.atlassian.com/git/tutorials</a></figcaption></figure><pre>git reset b<br>// where b is the commit you&#39;d like to change reset back to</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*XUQKZK8Oh3vTbHgSY2ueKQ.png" /></figure><p>This is great for undoing changes that haven’t yet been shared with other developers. Compare this to if you wrote a new chapter to a book that hasn’t been published and just wanted to act like it never happened. The cmd/ctrl + z of the git world.</p><p>git reset can modify the history of a repository and should not be used on shared branches/repositories as it could cause conflicts you’d have to deal with later.</p><p><strong>Reset flags:</strong></p><p>--soft : Does not alter the working directory.<br>--mixed : The default. It updates the staged snapshot but doesn’t alter the working directory.<br>--hard : Updates both the staged snapshot and the working directory to match your specified commit.</p><p>You can either specify a file path for git reset or it will work on the full commit.</p><h4><strong>git revert</strong></h4><p>Takes a specified commit and creates a new commit that undoes the changes from that specified commit. These can be the last changes you committed, or you can specify commits further back from the HEAD.</p><pre>git reset &lt;commit id&gt; // in this case you would specify the id of the blue circle</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*X8_p3yQolRLUzuLsbMF9cg.png" /><figcaption>git reset &lt;commitid&gt; // takes you back to the specified commit (blue circle)</figcaption></figure><p>git reset takes you back to the commit specified (blue circle), effectively undoing later commits (red square). Whereas:</p><pre>git revert &lt;commit id&gt; // in this case you would specify the id of the red square</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/1*R49LPQv3E4rEbQyqmSxaeA.png" /></figure><p>git revert adds a new commit (blue circle) which undoes the changes from the specified commit (red square). The original commit you are reverting would still remain intact in the project history.</p><p>This is much safer for public branches/repositories since it undoes the specified commit by making a new commit with those revisions and doesn’t rewrite any commit history.</p><p><strong>Differences: </strong>git reset HEAD is good for undoing uncommitted changes in a private setting. git revert is a tool for undoing committed changes in a public repository.</p><h3><strong>git merge and </strong><strong>git rebase</strong></h3><p>These two commands both do very similar jobs — both are used to combine changes from one branch with another. When working with other programmers who make changes you also need to implement, these commands can be super necessary and helpful to understand.</p><h4><strong>git merge</strong></h4><p>Using git merge allows you to create a new commit that merges the specified branches together into one.</p><pre>git switch main // main might be substituted for master in older projects<br>git merge &lt;name of feature/bugfix branch you want to merge back with main&gt; // in the below example: &quot;Some Feature&quot;</pre><p>Before the merge:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*5yUg6ccYY0yEy29xglMUiA.png" /></figure><p>After the merge:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*RP0qjslo-R-ZwILv85j6zQ.png" /></figure><p>You can see that a new merge commit (the blue circle) has been added to combine these branches back together. All previous commits are still accessible and the history is not changed.</p><p><strong>Weaknesses:</strong> You have an extra commit just for this merge. A lot of developers don’t love this approach on larger projects because it can make the project path very complex and difficult to follow.</p><p><strong>Strengths: </strong>Non-destructive. Doesn’t change or remove any of the existing commits.</p><h4>git rebase</h4><p>Using git rebase moves the entire new branch to begin on the HEAD of the current main branch (Makes the main the new base for the rebased branch). This makes everything into one linear path by creating brand new commits on the main branch for each of your commits on the feature or bugfix branch.</p><pre>git checkout &lt;feature branch name&gt;<br>// where &quot;feature branch name&quot; is the branch you want to rebase back to the main/master branch</pre><pre>git base &lt;main&gt;<br>// where main is the name of the branch you&#39;d like to rewrite/rebase your feature commits to, usually the main or master branch</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*IU7x36Vu-WXgjfMtEPABRw.png" /></figure><p><strong>Weaknesses:</strong> Destructive, changes/rewrites history by changing commit names when re-written on base. Harder to tell what was done since there is no merge-specific commit. Not good to do with shared work since it changes commit references other people may be working off of. The golden rule of rebasing — don’t use on public branches!</p><p>Note: You can use other git rebase commands to make this path easier to track. I won’t go into detail about them here, but you can look into rewording commits, dropping them entirely, or squashing branches into single commits.</p><p><strong>Strengths: </strong>Linear project path, very clean and easy to follow. No extra merge commits to muddy the path.</p><p>All images from <a href="https://www.atlassian.com/git/tutorials">https://www.atlassian.com/git/tutorials</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=767e90415cc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Big O Notation for Binary Search Trees]]></title>
            <link>https://persis-randolph.medium.com/big-o-notation-for-binary-search-trees-8f0f50b016ef?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f0f50b016ef</guid>
            <category><![CDATA[binary-search-tree]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[big-o-notation]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Tue, 20 Apr 2021 19:25:49 GMT</pubDate>
            <atom:updated>2021-07-20T15:11:39.253Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-WN6iByiHsh_jRlzu0D58A.png" /><figcaption>Daniel Stor: <a href="http://turnoff.us/geek/binary-tree/">http://turnoff.us/geek/binary-tree/</a></figcaption></figure><h3>What’s a Binary Search Tree?</h3><p>A Binary Search tree is a tree-like data structure that contains uniquely valued nodes. The nodes can have at most two children (or branches), one which is a smaller value (typically the left node), and another which houses a larger value (typically the right node).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*tQ9_GIzieVPtN86lzg7Cag.png" /></figure><p>Binary Search Trees are great for storing numbers since they have very fast access, search, insert, and delete functionality.</p><h3>The Big O (notation)</h3><p>The simplest way I can think to talk about big O notation is by stating its purpose. Big O notation is a mathematical notation designed to classify algorithms based upon the time they take to process (time complexity) or by the space they take up (space complexity) as the input size grows. Big O notation uses very generalized notations and is definitely not an exact science, but can be used to consider how scalable a data structure or operation is.</p><p>If a company was building a big application, they would want to store their data in a way that took the smallest amount of time possible or took up the least amount of space dealing with memory usage. They can use the terminology as defined by big O notation in order to talk about these complexities in a way that is easy to compare and contrast.</p><p>Let’s look at some basic examples for the most common time complexities and how they relate to big O notation.</p><p><strong>Constant Time: O(1)</strong></p><pre>function add(num1, num2) {<br>  return num1 + num2;<br>}</pre><p>For the above function, there will always be two inputs: num1 and num2. The only operation that will ever be done on them is simple addition. This means that no matter what the input, it will always take a very small amount of time to complete the function and the amount of time does not vary depending on input size.</p><p><strong>Linear time: O(n)</strong></p><pre>function loopThroughArray(array) {<br>  for (let i = 0; i &lt; array.length; i++) {<br>    console.log(array[i]);<br>  }<br>};</pre><p>For this function, we are looping through a very basic array. What length is the array? Hard to tell from looking at this general code. You could input an array with a length of 3, or you could be inputting an array with a length of hundreds of elements. This is where linear time complexity comes into play. The amount of elements in the array (n elements) directly influences the time it will take to calculate the output. On a graph, you could see this demonstrated by a line going straight up the opposite corner at a 45-degree angle. O is calculated in relation to n, or the number of input elements.</p><p><strong>Quadratic: O(n²)</strong></p><pre>function nestedArrayLoop(arr1,v ) {<br>  for (let i = 0; i &lt; array.length; i++) {<br>    for (let j = 0; j &lt; array[i].length; j++) {<br>      console.log(array[i][j];<br>    }<br>  }<br>}</pre><p>For nested arrays, we’d need to loop through both the outer array and each inner array. The amount of time it takes the loop through is multiplied by the number of elements contained in each array. If we take n * n elements we can also state this as n². The amount of input affects the output time exponentially.</p><p>…and finally, <strong>Logarithmic: O(log(n))</strong></p><h3>Remind me what a logarithm is again?</h3><p>“A logarithmic function is the opposite of an exponential function. When you say something grows exponentially, it’s being <em>multiplied</em>. When something grows logarithmically, it is being<em> divided</em>.” (Jasmine Webb, <a href="https://betterprogramming.pub/a-gentle-explanation-of-logarithmic-time-complexity-79842728a702">A Gentle Explanation of Logarithmic Time Complexity</a>)</p><p>Each node in the Binary Search Tree only can have 2 child nodes. That means that each time we go one step further down our tree we are proportionally decreasing the number of choices you have for output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*tQ9_GIzieVPtN86lzg7Cag.png" /></figure><p>I know this is a <em>really </em>basic example of a Binary Search Tree, but let’s consider it again while exploring the basic functionality of this tree and how it relates to big O notation.</p><p><strong>Access/Search: </strong>When trying to access or search for a particular node of a tree, you have to start at the top, or the root. Say we’re trying to get to the node with the value of 4. First, we must access from 5. We know the value we’re searching for is less than 5 so that means the value can be found somewhere in the left branches. This effectively gets rid of half our choices, allowing us to rule out the nodes with higher values.</p><p>Then, we are at the node with value 3. We know 4 is a higher value than 3 so we can search its right branch and cut off the possibilities from the left branch. In cutting off about half of the possible choices each time we move down the tree we are seeing logarithmic time complexity in action. The further we go, the fewer choices we have. The input number of nodes directs the output time resulting in an average time complexity of O(log(n).</p><p><strong>Insert/Delete:</strong> Exactly the same as access/search, in order to insert an element or delete an element of any given value, at most we need to search one branch from each node from the time. This makes the average time complexity the same as above, O(log(n)).</p><p>When thinking about what time complexity is best, logarithmic is as close to constant as you can get without quite touching it. The line on the graph tracking O(log(n)) hovers down close to constant and is far more effective and scalable than linear time, which is next best. That each common operation for a Binary Search Tree is consistently logarithmic is a really good mark in regards to its scaling and much better than if the operation had linear time complexity or even quadratic time complexity and makes it worth considering as a data structure as opposed to unsorted arrays or hash table structures.</p><h3>Space Complexity</h3><p>Just a final note here to round things out. When considering space complexity we are considering how the number of input values (nodes in this case) directly increases the amount of space taken up in memory. In the case of the Binary Search Tree, the more nodes added to the tree, the more space is taken up, and that number is directly proportional. This makes the space complexity of a Binary Search Tree O(n), or linear.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f0f50b016ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting On Board with Let, Const, & Arrow Functions]]></title>
            <link>https://persis-randolph.medium.com/getting-on-board-with-let-const-arrow-functions-846def7514f1?source=rss-5d450a8b5b78------2</link>
            <guid isPermaLink="false">https://medium.com/p/846def7514f1</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tips]]></category>
            <dc:creator><![CDATA[Persis Randolph]]></dc:creator>
            <pubDate>Tue, 16 Mar 2021 22:45:24 GMT</pubDate>
            <atom:updated>2021-07-20T02:02:11.801Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4GPoL-x1OsFpWbUqNXPmKA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@tomasjolmes?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Tomas Anton Escobar</a> on <a href="https://medium.com/s/photos/train?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Setting off on your journey, into the land of a beginner JavaScript programmer, you were probably taught right off the bat to use some older conventions which aren’t standard practice anymore.</p><p>It has been quite a while since the release of ES6 in 2015 and these not-so-new features have become standard practice. Even though you began learning without these features, you will need to familiarize yourself with them to become a well-rounded developer.</p><p>Over the course of my own learning trek, having to make this switch myself, I noticed a lot of fellow students struggling to understand how best to adopt these new and better habits. My goal is to help the reader better understand why it’s worth making the switch and providing some (<em>hopefully</em>) helpful tips on making the change.</p><h3><strong>Bad Habit: Using var to declare every single variable.</strong></h3><h4><strong>Why Should We Use Let &amp; Const?</strong></h4><h4><strong>Redeclaration</strong></h4><p>One of the big reasons that let and const were created is that variables declared with var can then be redeclared. This can create a big problem.</p><p>Let’s say you declare a variable early on in your code. Declaring it with var, there is a possibility you could forget that you had already declared the variable. You’d end up declaring it again to represent something else entirely, unintentionally changing the value set when you created it the first time.</p><pre>var data = 1;<br>var data = 5;</pre><p>The above JavaScript code does not generate an error. If we need to store a brand-new value, representing a new idea, we shouldn’t be able to reuse a variable name.</p><pre>let data = 1;<br>let data = 5;</pre><p>With let and const, redeclaration is not allowed. This code would throw SyntaxError: Identified ‘data’ has already been declared.</p><p>This may not seem like a glaring issue when working with small bits of code, but when you end up working with large codebases (and alongside other programmers who are working on that same code) this can become a real pain point.</p><h4><strong>Function-Scoped</strong> <strong>vs. Block-Scoped</strong></h4><p>In addition to the problem with redeclaration, var is function scoped, but not block-scoped like let and const. Take a look at the following code:</p><pre>// Using var</pre><pre>var i = 30;</pre><pre>for (var i = 1; i &lt;= 5; i++) {<br>  console.log(i); // logs 1 through 5<br>}</pre><pre>console.log(i); // logs 6</pre><p>In this example, you can see that even though the variable i was initially set to 30, the code in the loop resets this value to start at 1, loops through, and eventually results in i being set to 6. This is extremely problematic. While being scoped in functions, var is not scoped for just any block of code.</p><pre>// Using let<br><br>let i = 30;</pre><pre>for (let i = 1; i &lt;=5; i++) {<br>  console.log(i); // logs 1 through 5<br>}</pre><pre>console.log(i); // logs 30</pre><p>In the above example, you can see that the looped i variable declared with let did not affect the originally defined i from line 3. This makes much more sense than the above example with var and behaves as one would hope. This behavior is due to let being block-scoped. The variablei inside of the loop does not access the variable i defined in the global scope (line 3).</p><h4><strong>When to Opt for Const</strong></h4><p>Between let and const, you could technically always use let (like we always used var) but const is a great choice for when you have something to represent that will never change, a <em>constant</em> value. For that reason, some programmers opt to use const any time you have a variable that will not need to be redeclared.</p><p>One common example is pi. Pi will always be approximately 3.14159265. If you are doing operations using pi, you don’t want to accidentally change the value. With const, you couldn’t accidentally do this, even if you tried.</p><pre>const pi = 3.14159265;<br>pi = 5.43;</pre><pre>// throws TypeError: Assignment to constant variable.</pre><p>Another place you might see const being used a lot is when declaring functions, arrays, and objects (complex data types). While the values inside these data types can be changed through their respective methods (because these values are stored by reference and not by value), the pointer (variable name) should never be changed.</p><p>For more on values passed by value versus by reference see: <a href="https://codeburst.io/javascript-passing-by-value-vs-reference-explained-in-plain-english-8d00fd06a47c">https://codeburst.io/javascript-passing-by-value-vs-reference-explained-in-plain-english-8d00fd06a47c</a></p><h3><strong>Bad Habit: Declaring every function with the function keyword.</strong></h3><h4><strong>Why Should We Bother with Arrow Functions?</strong></h4><p>Arrow functions are very widely used, and you need to at least be able to understand the syntax since are bound to see them all over the place. When using higher-order functions, or any type of anonymous function, using arrow functions will help you greatly. In general, they are more concise and make code a lot more readable.</p><p>At this point, as not to take up the rest of your day, I highly suggest this read from freeCodeCamp if you’d like to learn more on this topic: <a href="https://www.freecodecamp.org/news/when-and-why-you-should-use-es6-arrow-functions-and-when-you-shouldnt-3d851d7f0b26/">https://www.freecodecamp.org/news/when-and-why-you-should-use-es6-arrow-functions-and-when-you-shouldnt-3d851d7f0b26/</a></p><p>Moving along. I’d like to demonstrate my technique for making the switch to using these ES6 features.</p><h3><strong>Breaking Your Habits</strong></h3><p>Weaning yourself off of always declaring with a function keyword and using var, as opposed to let and const, might be seen as a challenge to your existing coding abilities. Rather than jumping straight into it and having another aspect of your code to thoroughly debug, I propose a stepped approach.</p><p>Start small. If you don’t feel comfortable changing everything at once, take a little step first. When you feel comfortable with that change, make another. You can even write your code first in the way you are most familiar with, and then, once ensuring the code is working as expected, throw a wrench in and try to refactor using these newer conventions. This way, if something breaks, you know exactly where you went wrong and have far fewer problems to debug.</p><p>Here are some examples of small steps you could take to implement using arrow functions.</p><p>Step 1: Write your function as usual. Ensure it works.</p><pre>const add = function(num1, num2) {<br>  return num1 + num2;<br>}</pre><p>Step 2: Get rid of the function keyword. Add the function arrow instead.</p><pre>const add = (num1, num2) =&gt; {<br>  return num1 + num2;<br>}</pre><p>Step 3: Make the return implicit. Get rid of those curly braces and the return keyword. Note: You should only do this for simple one-line return statements. Anything more complex and you’ll want to leave the return keyword and those braces intact.</p><pre>const add = (num1, num2) =&gt; num1 + num2;</pre><p>Step 4: If there is only one parameter, you can get rid of the parens around it. If there are no given parameters you’ll need a pair of empty parens.</p><pre>var squared = (num) =&gt; num * num;<br>var sqare = num =&gt; num * num;</pre><p>Either of the above functions would work the same, although, you would just want to use one or the other, not both.</p><p>I hope this is helpful for someone out there. Please let me know if you have any interesting methods of implementing these ES6 features for yourself!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=846def7514f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>