<?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 Serena Bright on Medium]]></title>
        <description><![CDATA[Stories by Serena Bright on Medium]]></description>
        <link>https://medium.com/@serenabright?source=rss-63d294d696a3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mslQ1PibqSEoGWCn.jpg</url>
            <title>Stories by Serena Bright on Medium</title>
            <link>https://medium.com/@serenabright?source=rss-63d294d696a3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 05:45:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@serenabright/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[On Recent Landmark Climate Achievement for California]]></title>
            <link>https://medium.com/@serenabright/on-recent-landmark-climate-achievement-for-california-960bc324f7ff?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/960bc324f7ff</guid>
            <category><![CDATA[sustainability]]></category>
            <category><![CDATA[career-change]]></category>
            <category><![CDATA[climate-change]]></category>
            <category><![CDATA[climate-action]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Sun, 08 Oct 2023 01:17:44 GMT</pubDate>
            <atom:updated>2023-10-08T01:17:44.572Z</atom:updated>
            <content:encoded><![CDATA[<p>As an individual who packed up my life and moved to the beautiful state of California just last year, the recent strides in corporate climate action feel deeply personal and incredibly inspiring. Next few paragraphs are about why this news was so exciting for me personally. Feel free to skip it and jump straight to the section about SB 253 to learn what it is.</p><h4>My Climate Journey</h4><p>My journey towards a career dedicated to tackling the climate crisis led me on a path that consciously avoided roles that shifted the weight of climate responsibility solely onto consumers. While positions related to crafting sustainability newsletters for employees and consumers certainly hold their value, my heart always whispered that it was somewhat unfair to divert all the attention away from the immense environmental impacts that corporations were having.</p><p>A year has passed since the world celebrated the Paris Agreement, and those deeply invested in the cause wondered how the lofty national commitments to reduce emissions would materialize in practice. Serendipitously, this was also the juncture at which I neared the culmination of my master’s degree in sustainability management. It was during my capstone seminar that I embarked on a project for two esteemed clients: the Office of Planning and Research under the leadership of Governor Jerry Brown in California and the esteemed Climate Group.</p><p>The Climate Group, renowned for orchestrating The Climate Week in New York for the past 15 years, stands at the forefront of global climate initiatives. Held in conjunction with the United Nations General Assembly and the City of New York, Climate Week NYC serves as a powerful platform to advance our shared mission of propelling tangible climate action forward, so I was thrilled that a project of such significance was offered at the time of my last semester and I was elected to manage it.</p><p>Our project entailed conducting interviews with stakeholders in both national and subnational governments, aiming to comprehensively evaluate the state of coordination between these entities in the sphere of climate action. To culminate our efforts, we devised a tool and formulated strategic recommendations, with the intention that they would be utilized by NAZCA, the United Nations’ Global Climate Action portal.</p><p>Upon graduating, I secured a contract as a Target Data Analyst at CDP. In this role, my primary responsibility was to deliver crucial data to the NAZCA portal, a central platform for monitoring climate action back in 2018. However, I encountered a significant challenge due to the voluntary nature of annual emission disclosures to CDP, which led to data quality issues. The absence of legally mandated greenhouse gas (GHG) reporting posed a substantial hurdle, especially in accounting for not only scope 1 and 2 emissions but also the often-neglected scope 3 emissions. Remarkably, some companies attributed over 90% of their total emissions to scope 3, yet these were often left unaccounted for. To grasp the full picture, I meticulously reviewed hundreds of responses to ensure that whatever data was reported was accurate and comprehensive. This rigorous process included discerning whether a company’s climate goals pertained solely to a specific office or encompassed global operations. During this period, our toolkit for handling unstructured data was limited, relying mainly on Python code for data cleanup.</p><p>Recognizing the urgent need for more effective solutions, my professional focus naturally shifted towards leveraging technology to propel the climate mission forward. Following the conclusion of my contract, I embarked on a transformative journey to bolster my technological skills by enrolling in a software engineering bootcamp. Throughout this transitional phase, I remained committed to providing guidance to early-stage sustainability founders. My unwavering belief was that one day, emissions reporting would be mandated by law.</p><h4>SB 253</h4><p>SB 253 is nothing short of a game-changer. It establishes mandatory emissions reporting regulations that apply not only to large public corporations but also to private organizations with annual gross revenues exceeding $1 billion USD, encompassing approximately 5,400 companies operating in California. This broad scope ensures that both public and private entities are held accountable for their environmental impact.</p><p>One of the most notable aspects of SB 253 is its insistence on comprehensive reporting. The legislation requires companies to disclose their full carbon inventories, encompassing all three scopes of emissions. This includes the notoriously challenging scope 3 emissions, which often account for more than 90% of an organization’s climate impact. Such a comprehensive approach is essential for gaining a true understanding of a company’s environmental footprint.</p><p>To ensure transparency and accountability, SB 253 outlines strict reporting requirements for affected companies. They must submit their emissions calculations to a digital reporting platform, making it easier for residents, investors, and other stakeholders to access and understand the data. Moreover, independent auditors must verify these reported emissions, adding an extra layer of credibility to the disclosed information.</p><p>The California Air Resources Board will play a pivotal role in overseeing the reporting process and ensuring data verification by collaborating with reputable carbon accounting experts. This collaborative effort will enhance the reliability of emissions data and boost public trust in the reporting process.</p><p>Importantly, SB 253 also outlines consequences for companies that fail to comply with the new regulations. Companies that do not meet the reporting requirements could face penalties enforced by the state’s attorney general. This strict enforcement mechanism reinforces the seriousness of the legislation and underscores California’s commitment to holding corporations accountable for their contributions to climate change.</p><p>While SB 253 shares some common ground with the Securities and Exchange Commission (SEC)’s climate proposal, it stands out in two crucial aspects. First, SB 253 mandates the reporting of all three scopes of emissions, making it more comprehensive than the SEC’s rule, which only covers scopes 1 and 2, and scope 3 emissions when they are deemed material. Second, SB 253 extends its requirements to both public and private companies, whereas the SEC’s rule applies exclusively to publicly traded entities.</p><p>The passage of SB 253, the Climate Corporate Data Accountability Act, represents a landmark achievement for the state of California and sets a precedent for climate action in the United States. As someone who recently moved to California, it’s inspiring to witness the state’s commitment to transparency, accountability, and environmental responsibility. This legislation not only addresses the urgent need to tackle greenhouse gas emissions but also showcases California’s leadership in shaping climate policy that goes beyond federal regulations. SB 253 serves as a beacon of hope in the global fight against climate change and paves the way for a more sustainable and accountable corporate future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=960bc324f7ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I signed up for 100 days of code]]></title>
            <link>https://medium.com/swlh/my-100-days-of-coding-day-1-3360902b83bc?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/3360902b83bc</guid>
            <category><![CDATA[codingbootcamp]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[climate-action]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[climate-change]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Wed, 27 Nov 2019 02:03:12 GMT</pubDate>
            <atom:updated>2020-02-03T15:23:25.278Z</atom:updated>
            <content:encoded><![CDATA[<p>Chasing climate action barefoot … won’t get you far.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bQCIdHWvNbXj1IST" /><figcaption>Photo by <a href="https://unsplash.com/@unandalusgus?utm_source=medium&amp;utm_medium=referral">Gustavo Quepón</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong><em>Quitting my coding bootcamp. Who does that?</em></strong></p><p>It’s been a few weeks since I put my coding Bootcamp on hold. Why would someone voluntarily quit an in-person coding school, being only 6 weeks away from graduation? It took me several months to learn the fundamentals of Javascript only to pass the technical interview and get accepted into the program. Treating my career as a product influenced me to switch the priorities.</p><blockquote>I kept asking the questions “why”.</blockquote><p>Why was I becoming a web developer after having a career in investment banking, sustainability management, education, and even teaching yoga? I needed to learn a few programming languages to continue my professional growth in sustainability without compromising my own financial health. The short answer is, I was learning web development to get a job in a startup that does good things for the planet.</p><p>As I was getting closer to the finish line, I was becoming aware of the reality of the job search as a recent bootcamp grad. Too many friends from the prior cohorts were struggling with finding a job for months after graduation. Most of them were <strong>settling for any entry-level job as a web developer, which did not excite me. </strong>Also, I was running out of savings and needed a job right away.</p><p><strong>This is why rushing to graduate did not make sense to me.</strong> Thankfully, my school also has an online option, so I’ve decided to complete the remaining 20% of school work online. For my specific career goals, building a stronger portfolio was more important than just getting a job.</p><p><strong>The New York vibe will keep you on your toes. </strong>I learned how to be frugal, however, that wasn’t enough. It is one of those places that will treat you accordingly, based on how you feel about yourself. When I didn’t feel certain about what’s next, I trusted that everything will work out if I show up in the right place. Or, if I at least keep showing up in many places, in case if one of them could be that right place. When an opportunity appears, grab it just in case. So, instead of panicking and feeling embarrassed for leaving campus, I opened up to networking. I applied to participate in the Next Gen Cohort within the upcoming Lesbians Who Tech Conference in October, and got accepted! I was excited to join the supportive community coming together in thousands under one roof. For three days, I got the thrills from the enthusiastic speakers, women I can trust celebrating each other strengths and potential…</p><blockquote>…Potential that evolves into accomplishments once it&#39;s given attention.</blockquote><p><strong><em>The romanticization of my life purpose</em></strong></p><p>The unexpected thing about it was that I finally got to use my knowledge and skills from the career that I have paused — Sustainability Management and Climate Action. In the past few years, this ex-career of mine has shaped itself into the equivalent of an unattainable romantic object. The more I chased it, the more it got away from me. To merge my passion with living a life of a global citizen, which was to conserve what is left on the planet and protect living beings from the effects of climate change, I have explored an overwhelming number of career paths.</p><p>And then, I stopped. I have given enough time to volunteer, intern, organize events in sustainability, attended over a hundred conferences on the subjects including water access/quality, food waste, plastic pollution, deforestation, renewable energy, carbon capture, to name a few. I spent a year serving AmeriCorps through a fellowship at The Parks Department, which counted as an experience at the city agency, and I got to use an email ending in .gov. The choice to stop romanticizing my career was pivotal for the very career I kept chasing. The analogy between the relationship with a lover and a relationship with a career is striking. As much my passion led me to the depths of attempt, a pragmatic look at my actual skillset was what I was missing.</p><p>Interestingly, just like with a typical love life dynamics, the moment I started focusing on myself, specifically, on personal financial sustainability, “the one who got away” came knocking on my door. Not only my old career wanted me back, but at this time, it wanted to properly compensate me!</p><p>Well, it’s been great. The resurrected career, my “first love” in the professional context, swept me off my feet. The first two months I was on cloud nine. My old career in sustainability and I made sweet new plans about the future together. I could finally play so many roles by wearing different hats in this project, things would never get boring!</p><p><strong>My next phase in “The Pattern” is <em>letting go of illusions</em></strong></p><p>In my mid-30’s, however, what I appreciate the most is an expanded capacity to integrate the lessons learned. This wisdom will not let me stay naive and hope that somehow things will work out, as long as I am passionate about the cause. It is time to get proactive and take care of my needs first. This is why I am looking ahead, and equipping my skillset with the tools for success.</p><p><strong><em>The intriguing security of a career in web development</em></strong></p><p>Coding is a wonderful skill that provides security to support the passion to save the environment. This is the reason I got myself into a coding Bootcamp in the first place — to learn the skills of the tangible future. In addition to my idealistic vision of the beautiful tomorrow, where the resources are managed effectively, the air is clean, water is available to all, and we still have the bees, I need provide food and shelter for myself and my family. Now, I am back in my online learning program, tackling JavaScript.</p><h4>Turning a commitment into a ritual</h4><p>Since I have decided to add web development to my list of careers, I kept hearing about a commitment to 100 days of code. I hope I am not alone in feeling intimidated by both the length of this commitment, and the uncertainty of being able to produce consistent results.</p><p>Wait, what do those consistent results look like, anyway? What are the rules for 100 days of code? When I have decided to join this challenge, I assumed that as long as I am doing anything, but showing up daily, that would do. So, I watched a tutorial during the Thanksgiving holiday after coming home past midnight. <strong>Apparently, I was doing it wrong. </strong>There are rules, and one is to code for one hour daily. Another rule is to share the results publicly, preferably on Github, which helps not only with accountability but also shows your progress to the hiring managers.</p><p>Oh well, I do not regret taking a few days doing it my way. The main benefit of showing up is behavior change and building a routine. The behavior change that will stick to the commitment depends on the attitude towards it. For me, whether I will succeed is not the best way to goal setting. It sounds abstract and could add anxiety, which might interfere with the process. Will I keep going with this no matter what? This is the question I can say yes to, every day. At some point, just because repetition will wire my brain to the point of forming a new habit, showing up will be the comforting routine that brings nothing but positive emotions.</p><p>As I am learning something new every day, there might be a time when I won’t be understanding the concept for a while. Instead of allowing myself to get discouraged, I focus on showing up and being patient with myself. In the past few days, I kept watching the same tutorial before going to bed. Each day things made more sense, and this is the success that counts for me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3360902b83bc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/my-100-days-of-coding-day-1-3360902b83bc">Why I signed up for 100 days of code</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Too busy to work out and too much passive time at work? Try this…]]></title>
            <link>https://medium.com/@serenabright/too-busy-to-work-out-and-too-much-passive-time-at-work-try-this-6bc160d36c4a?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/6bc160d36c4a</guid>
            <category><![CDATA[health]]></category>
            <category><![CDATA[back-pain]]></category>
            <category><![CDATA[lower-back-pain-treatment]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Thu, 15 Aug 2019 22:50:46 GMT</pubDate>
            <atom:updated>2019-10-15T00:09:56.440Z</atom:updated>
            <content:encoded><![CDATA[<p>Sitting through the long meetings or lectures that require your complete presence, peak attention, and active listening, while not being able to get involved in the conversation is hard!</p><p>Back pain?</p><p>Too busy to get your exercise?</p><p>Let’s make the lemonade from those lemons.</p><p>Why wait until the end of the workday to either go or skip your workout?</p><p>Your body is craving it, and there are always ways to not only stretch but also strengthen the muscles and get proper alignment of your spine.</p><p>The solution is to get up and stand by the wall and… do the wall sit! This <a href="https://www.verywellfit.com/the-wall-sit-quad-exercise-3120741">article</a> shows what you need to know, but, really, just mimic the picture!</p><p>Upper or lower back hurts, or both?</p><p>Stand by the wall really closely, trying to completely attach your entire back to it. According to multiple studies, better posture also improves confidence and mood.</p><p>Standing by the wall might be the safest, cheapest, and more sustainable solution than going to the specialists who would align your bones to where they belong. Proper alignment needs muscle support. This is why this daily exercise could improve your posture and the muscles holding it in place will strengthen.</p><p>The simple technique is:</p><ol><li>stand really close to a wall</li><li>push your lower back trying to touch the wall as well. This could relieve tension in your lower back</li><li>also push the back of your neck, elongate and stretch it upwards</li><li>stay a minute or two, increasing it to 10 minutes</li></ol><p>That’s it!</p><p>Now, back to work!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6bc160d36c4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Opportunities in data for recent web development graduates]]></title>
            <link>https://medium.com/swlh/understand-the-flow-of-the-get-and-patch-actions-in-javascript-bb2105a34731?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb2105a34731</guid>
            <category><![CDATA[employment]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-dev-bootcamps]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Tue, 13 Aug 2019 13:00:07 GMT</pubDate>
            <atom:updated>2020-01-06T23:19:49.079Z</atom:updated>
            <content:encoded><![CDATA[<h4>Consider working with data science if you seek more ways to utilize your coding skills.</h4><p>Coding bootcamps open the doors to those who need to change career path and are willing to work for it. Getting through a 3–6 month-long training is still not enough to find employment right away. A lot of companies are looking for at least two years of experience, which many of us don’t have.</p><p>Besides the helpful advice from your career coach and numerous blogs about succeeding as a fresh outta bootcamp web developer, this post attempts to expand the list of potential opportunities in employment.</p><p>Big Data has been the buzzword in the past few years. The popularity of free apps in the app store google play in exchange for data has been increasing. This means that the amount of data that has been analyzed is only the tip of an iceberg. So, what’s to come?</p><p>During my most recent employment experience as a data analyst working for an NGO that collects data on climate action, I struggled with so-called “dirty data”. So much insight is hidden underneath the walls of text coming from 7000 companies, 600 cities, and 120 states and regions through a survey. Simply applying an algorithm would peel away the important context of the individual story. This is why there is a need to engineer better systems to collect data.</p><p>I looked at job opportunities at a few companies and noticed that there are more positions available for data scientists/analysts/engineers than for software engineers. Although the requirements for data include proficiency in other programming languages, there are some overlaps. The more significant overlap might be the knowledge of <strong>database</strong>/<strong>SQL </strong>(and such), an overall understanding of <strong>data structures</strong>, as well as of <strong>object-oriented programming </strong>concepts.</p><p>If you know a few programming languages, it would be easier to pick up another one for work with data. Jobs in data have great potential to utilize your programming skills and create a positive impact around you.</p><p>Start by accessing the open data available to you from the sources like <a href="https://opendata.cityofnewyork.us/">NYC Open Data</a> and see how you could use it to show off your coding skills. Now, you are not so far away from having an additional option for employment in data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*L94zIVgYQ-Y81_R7.png" /></figure><p>Below is an example of how you can use data to build a web app using JavaScript.</p><ol><li>Get a list of items from an API &amp; render them.</li></ol><p>To show all the items (for example, books) on the page, we need to fetch it first. When we get the response from our local host that is set to a variable URL, we convert it to a JSON format. Then, we grab the result (the books array) and iterate it so that each book can find its place in the list_UL (located inside the list “container” that contains the cells for our items. Since we want to grab an item by the id, but don’t necessarily want to show the id to the user, we place it inside the li tag and interpolate the title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*fCOQdocIzGgPwH7VzLiG1A.png" /><figcaption>Flow for GET: fetch and iterate; insert interpolated result(s) into the li</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*KSdpUTpzwGHJEj_DzdeqUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*BlM-QnuVHve4der1sN3bqA.png" /></figure><p>2. Be able to click on a book and see the book’s thumbnail, its description and a list of users who have liked the book.</p><p>First, we need to set an event listener to catch that click, with the condition that the click happened in a specific location on our page: LI. In that case, we anchor our event target to li, and pair it to its id through dataset.id (which is equivalent to data-id in the HTML language, used in deliverable #1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*nraik39K70DrGizLUMwq5g.png" /><figcaption>Flow for the click: find your li, create a condition using the tagName, locate your id in on the page</figcaption></figure><p>We already have book’s title, so now we are going to pull the rest of the details by fetching through the book id and insert it in the HTML container, as well as the array of users who liked the book.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*VEZMWEZCbjZ27z2EoPtGOA.png" /><figcaption>Flow for getting the list of likers: iterate through the array of what the likers like, push it in the empty array and place that array in the appropriate location on the page</figcaption></figure><p>Again, we iterate through the array of books and get the users that need to be organized in the empty array. Not only do we need to prepare the space in our js file, but we also make sure the users land nicely on the page. We work with what we have, which is the show-panel that we have located as one of the elements in index.html.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*2070-UCgmRbxk1VxWEQtYg.png" /></figure><p>We nickname the found space as show_Panel_Div and transform this div into a space that can accept an HTML object (a user). Then, we add those users as they get added to the list of book likers.</p><p>For the image source, alt is optional, yet, recommended for when you are completing the project for your client. Image sources may change when the code is inherited by other developers, so it is nice to accommodate them with an alternative link to the image as a backup.</p><p>3. You can like a book by clicking on a button: let’s set that up</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*zr4hC5X8d5XaMwwMAxhTrQ.png" /></figure><p>We are tasked with a particular request to accommodate the user with the following attributes {&quot;id&quot;:1, &quot;username&quot;:&quot;pouros&quot;}, so to like a book send a PATCH request to http://localhost:3000/books/:id with an array of users who like the book. This array should be equal to the existing array of users that like the book, plus your user. For example, if the previous array was &quot;[{&quot;id&quot;:2, &quot;username&quot;:&quot;auer&quot;}, {&quot;id&quot;:8, &quot;username&quot;:&quot;goodwin&quot;}], you should send as the body of your PATCH request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*7nFmSTRn6bp03RfqZA5JsQ.png" /></figure><p>Again, we start with the event listener attached to our checkout button. We also want to add the preventDefault button, so that the result is not skipped, but persisted in the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*Ec3dfpl_UWPUKwFQ01QMXw.png" /></figure><p>Then, we fetch and pull the array of users, data by id, since this is what we need for PATCH (and DELETE!) actions, and update it with an additional user via concat. Headers represent the information about what we are doing, what type of data is expected to go out or get returned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*uTsNAJTK_9Oy5ibbAYqL1A.png" /><figcaption>Flow for PATCH: method, headers (standard accept &amp; content-type), body (JSON.stringified).</figcaption></figure><p>And we push the results back into the div with the updated book JSON including the list of users who have liked the book (using .join).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*4fjfhdTtLzmCcu4ztsrYNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*zrYI3XTCvRds4d4K.png" /></figure><p>That’s it! I hope this post is helpful to understand the flow of the abovementioned get and patch tasks!</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb2105a34731" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/understand-the-flow-of-the-get-and-patch-actions-in-javascript-bb2105a34731">Opportunities in data for recent web development graduates</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The cookie sessions]]></title>
            <link>https://medium.com/@serenabright/the-cookie-sessions-6ddfc1b81e55?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ddfc1b81e55</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Wed, 07 Aug 2019 22:33:37 GMT</pubDate>
            <atom:updated>2019-08-07T22:33:37.161Z</atom:updated>
            <content:encoded><![CDATA[<p>HTTP is a stateless protocol. Sessions make it stateful. (Rails Docs)</p><pre>What&#39;s a cookie?<br>What&#39;s the data flow problem cookies solve?<br>How to find all the cookies on a page?<br>What&#39;s a session, as far as Rails is concerned?<br>Where is session data stored?</pre><p>What does this mean to a coder?</p><p>When we had the flash and key of errors, why did we have to differentiate between create and update where one is set up with render and another one with redirect? What is good for one request, the contents of the flash?</p><p>Let’s explore an example of a shopping cart.</p><p>I have the list of items that I need to be added to my shopping cart. I need those to stay in the shopping cart. What do we use for storing that data? If I click on the “buy”, or “add to shopping cart” button next to the item on the online store page, I need this action to <em>last</em> more than one single request. My shopping cart needs to be in the format of an array to store my items. When I go back there, I should be able to see all the items I have added.</p><p>Stateless protocol means that one request does not know about the previous request. HTTP server receives requests, processes them, returns data, then forgets about them. If were to go to the new page, do I still have access to the array of items? No, because it is a different controller action, it’s a different method. In my show page, I do not have access to this array, because of Ruby’s scope. From one RESTular request to another, the state’s data is not transferred from one to another.</p><p>In terms of the web requests. Inside the headers, a lot of the information gets passed, sent back and forth. If you open your Chrome console, in Application, there will be a cookie (found in Storage), with the http//localhost:3000 with a hash of name and value. Each domain tracks its own cookies. You can’t read and understand the value in these cookies. Does it make sense to make it readable? Of course not, it’s not safe! The information that is passed back and forth can keep track of you.</p><p><strong>Cookies</strong> are a way for an HTTP server to ask the user’s browser to store some of its data for it, and then to retrieve that data back from the browser later. Cookies also play the main role in making sure you remain logged in to your account for as long as you need so that you don’t have to re-sign in each time you refresh a browser.</p><p>What if I go ahead and delete the cookie, what will happen? My array will get deleted. But also, the server will create more cookies if there is nothing there. One cookie’s name is called sess-session. With this session, will Ruby be able to track the user and user data? This cookie is actually tracking the data.</p><p>If the session is stored inside this cookie, I can get access to the data that goes back and forth.</p><p>So, how do I create the shopping cart?</p><p>If I click on that button, I need to set it up to go to the cart route. The item is going to go to the URL that I specify. The hash will need to get added to that array.</p><p>I check my index page.</p><p>I go to my routes.</p><p>I want to be able to name things properly.</p><p>Adding something to a cart. I am not actually creating a new cart — I am updating, hence, I use method: PATCH. In routes, I add an action patch ‘/cart’, to: carts controller and I want the update method. Now I make the Rails g controller carts. Inside the carts controller, we want to hit the update method. I want to test if I can even hit the controller action. If I can’t, I will find out why. Now I want to check params, to see what comes through, what is useful. What would be very useful? Any information. If I hit a button, I want item’s id to show up. Inside my index, I do :patch, params: {item_id: item:id}</p><p>Now I want to let the user know they did something. I use a flash message</p><pre>def update<br>   @item = Item.find(params[:item_id])<br>   flash[:notice] = “you’ve just added this #{item.name} to the cart”<br>   session[:cart] = []<br>   session[:cart] &lt;&lt; @item.id<br>   redirect_to : items_path<br>end</pre><p>I should also add the notice to the index!</p><p>Now I refresh and lose all data on the webpage that was just showing me my results. This is why we need a session. We add a session to our code block. Session is extremely large and holds a huge amount of data, so session is a key-value pair. Inside the cookies, there can only be stored stings. In the beginning, the session’s value is nil. You can’t push it in nil. But you can push it in an empty array.</p><p>We want to be able to create something that determines that this key or cart exists and if it does, I want the cart back. If it doesn’t, I want to create a new cart. Who should have access to the cart, only the item controller? How can we create methods or object that every single controller can possibly have access to? Application controller. I want a method that is going to hold my cart. I want to name it cart. Inside this cart, I want to see</p><pre>def cart <br>   if session[:cart] == nil<br>      session[:cart] = [] <br>   else<br>      session[:cart]<br>   end<br>end</pre><p>Alternatively, refactoring:</p><pre>def cart<br>   session[:cart] ||= []<br>end</pre><p>||= means or equals</p><p>If it’s nil, then create an array, otherwise, assign it to the existing array.</p><p>Now I want to add something to this cart.</p><pre>def add_to_cart(item_id)<br>   cart &lt;&lt; item<br>end</pre><p>Since I have access to the application controller, because my cart controller inherits from it, I can simply invoke that add_to_card function in it.</p><p>I still need to display the cart into the view</p><pre>def show_the_cart<br>   @cart_items = Item.find(cart)<br>end</pre><p>We put everything about sessions (methods, etc) in the ApplicationController, and not in the other controllers. But other controllers can use those sessions methods.</p><p>A few more steps — still need to show what is where, and my cart’s entries persist. I hit refresh and I see my cart and the items in it.</p><p>Session and flash. One lasts for one request and another one persists (session).</p><p>Session and passing the params in the button were the two things that are the key points in this blog.</p><p>We have access to the session hash that I can use to persist data from request to request. And then we built out a feature to boost confidence. If I don’t know how to build a feature, at least I know how to start, and it’s with the routes. If the route is good, it points to the controller action: which controller action I want to point out to and why. All of the data is encrypted in cookies. Cookies are domain-specific. If I switch to the incognito window, I get all new cookies.</p><p>So, what’s the difference between cookies and sessions? It’s about <strong>where/how </strong>they are stored. Both are used to store information. Cookies are only stored on the client-side, and sessions get stored on both the client and a server. Session locks data in the locked box and the server controls that box, no one can change that. If they try, the server will throw that out and generate a new cookie.</p><p>Flash only persists for one request-response cycle. <a href="https://www.tutorialspoint.com/What-is-the-difference-between-session-and-cookies">https://www.tutorialspoint.com/What-is-the-difference-between-session-and-cookies</a></p><p>The content of that box maintains the format of that box. If my data type is an integer, it will be stored as an integer.</p><pre>my_pass = BCrypt::Password.create(“abc123”)<br>my_pass.class =&gt; BCrypt::Password<br>my_pass.salt =&gt; “jfhfgfhjddssshs”<br>my_pass.checksum =&gt; “heggddgsgayausu”</pre><p>Our database can only store strings. It cannot store BCrypt Passwords.</p><p>stringy == the value of the password hash. It’s not a string though. It does not equal to the string of the same combination of letters. To turn stringy into a string, we do:</p><p>BCrypt::Password.new(stringy)</p><p>Migration tip: if I have to change my schema on a collaborative project, I should change it in the master. Then, when I go to my branch and pull it (git pull origin master), I will get the latest migration. But! My schema will remain old. I would still need to db:rollback and remigrate it.</p><p>That’s it for the tricks on cookies and sessions. I hope it was helpful!</p><p>Happy coding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ddfc1b81e55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Plan for solving a challenge in Rails]]></title>
            <link>https://medium.com/@serenabright/plan-for-solving-a-challenge-in-rails-acdea160537e?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/acdea160537e</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Wed, 07 Aug 2019 22:23:01 GMT</pubDate>
            <atom:updated>2019-08-13T23:31:19.719Z</atom:updated>
            <content:encoded><![CDATA[<p>Basic setup for the app:</p><p>1. read the instructions all the way through till the last word. You might be surprised the relationships are not what they seem at first</p><p>2. draw the relationship out on a paper or whiteboard</p><p>3. run in the terminal, whatever is needed:</p><p>a. rails g model &amp; rails g controller, or</p><p>b. rails g resources</p><p>4. rollback all schema</p><p>5. add any missing attributes to the tables, or, better, run migrations to add those</p><p>6. add any missing relationships to classes (has_one/has_many/belongs_to)</p><pre>rails g migration add_category_id_to_expenses category_id:integer<br>rake db:migrate</pre><p>7. run migration(s) adding foreign keys to the join molel (if many-to-many)</p><p>8. run all migrations so they are reflected in the schema</p><p>9. check the routes: usually, it’s best to set them up as resources: model-name</p><p>10. check the schema again</p><p>11. seed</p><p>12. test in the console (Dog.all, Dog.count)</p><p>An overall method for every single deliverable is:<br>1. read it <br>2. break it down into steps<br>3. what is the user’s experience? — go to views<br>4. what my controller needs to do to enable #3? — controller actions<br>5. where does it redirect? — routes<br>6. test it <br>7. put a check smiley to your list of deliverables and move on to the next</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acdea160537e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t drink enough water? Try this.]]></title>
            <link>https://medium.com/@serenabright/dont-drink-enough-water-try-this-b068b4345694?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b068b4345694</guid>
            <category><![CDATA[importance-drinking-water]]></category>
            <category><![CDATA[drink-water]]></category>
            <category><![CDATA[health]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Thu, 01 Aug 2019 02:51:50 GMT</pubDate>
            <atom:updated>2019-08-01T02:55:56.952Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve noticed that drinking from a traditional plastic bottle is much easier than from a proper glass or a sustainable water bottle. Why?</p><p>Oh! I know why. The narrow mouth of a bottle! Tried chugging water from a glass? It requires extra energy to make sure the water is not flowing on your face.</p><p>The traditional plastic bottle would never have a wide mouth! These companies would lose money because people would carry that bottle in the bag all day taking guilty random sips.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F4667089&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fwine-schumer-drunk-gif-4667089&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2Faa3dbd9876d81aeab3ad37e5389e5b72%2Fraw&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c3fd4b95c23cf178370edf2ef583d51/href">https://medium.com/media/1c3fd4b95c23cf178370edf2ef583d51/href</a></iframe><p>Now, tilt the narrow-mouthed bottle and 16 oz could be in your system in less than a minute. I am not a health practitioner, but I sense that this is not a healthy way to drink water. Refill a few more times and you can reward yourself for hitting your goals!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F4425331&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fwill-and-grace-karen-walker-megan-mullally-drink-drinking-gif-4425331&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2F26b93e09ca1d9742a12fb11fc6f33f1c%2Fraw&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/56af0ebe81dc76772a201a367169d19d/href">https://medium.com/media/56af0ebe81dc76772a201a367169d19d/href</a></iframe><p>Yet, I’ll take that over dehydration, that has become a traditional state of being for me. Now I am carrying a glass bottle from mineral water with a narrow mouth, of course, and refill it, to keep it sustainable, and show our ocean some love.</p><p>Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b068b4345694" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wed security and authentication]]></title>
            <link>https://medium.com/@serenabright/wed-security-and-authentication-7e803410588e?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e803410588e</guid>
            <category><![CDATA[rails]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Thu, 01 Aug 2019 00:46:41 GMT</pubDate>
            <atom:updated>2020-01-05T00:10:08.276Z</atom:updated>
            <content:encoded><![CDATA[<h3>Web security and authentication</h3><h3>What is <a href="https://www.merriam-webster.com/dictionary/gobbledygook">Gobbledygook</a>?</h3><p>The most common way to login is through a username and a password. While most of us still use the same password for everything in life, the password manager is arguably the most secure way to manage your passwords. As a password manager user, I may not know any of my passwords, so, there are some tradeoffs to it. However, it saves me from the dangers of the “forget password” option, where an organization might betray my trust by sending my password to me via email. Else, I might be asked to provide more private information, such as the name of my kindergarten teacher, or my first niece, etc. Who knows what the future of data privacy looks like?</p><p>As a web developer, what I can do to protect the data privacy of my clients and their users, is to make sure that the passwords don’t leak. This is why the password is converted into a hash. Instead of saving the actual password value, the cookie stores the hash&#39;s value presented as the gobbledygook (such as “hdhdghasopdijamdqw/ffhdhjsis.sgs/gsax”. Unfortunately, this gobbledygook equals to the password that the user has assigned, so, if it the gobbledygook is stolen, it’s bad.</p><p>To counteract that, a technique of “salting” adds some security by attaching random symbols to the password, so that the gobbledygook is created each time the random symbols are called.</p><p>How to create a login/logout and password elements in Rails? Follow the steps below:</p><ol><li>Install <em>gem bcrypt</em> by running the install command, or by uncommenting <em>gem bcrypt in </em>your Gemfile and running <em>bundle install.</em></li><li>If you don’t already have a User (or such) class, create one. If you do, add:</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2bef3138fac0b3ff87374551c5ce7d9a/href">https://medium.com/media/2bef3138fac0b3ff87374551c5ce7d9a/href</a></iframe><p>3. Run rails db:migrate</p><p>4. In your User model, add the necessary validations, such as:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0eb52e29d029c7a752d2e1531440d3a9/href">https://medium.com/media/0eb52e29d029c7a752d2e1531440d3a9/href</a></iframe><p>5. In your Controllers, add a file called sessions_controller.rb (or login_controller.rb if you prefer) <em>Rails g controller Sessions new</em> and add something like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d01b3fe50ea341d7f1d092171fa3cd43/href">https://medium.com/media/d01b3fe50ea341d7f1d092171fa3cd43/href</a></iframe><p>6. Add helper methods to the Application Controller like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5b5bafa3db278f7918a7bf1c8ad22d1/href">https://medium.com/media/e5b5bafa3db278f7918a7bf1c8ad22d1/href</a></iframe><p>7. Don’t forget about your routes — add the actions and paths!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e37442eae1e546b21d1632dc52406573/href">https://medium.com/media/e37442eae1e546b21d1632dc52406573/href</a></iframe><p>8. Create a sessions folder and a file in it new.html.erb in your views folder.</p><p>9. Create the welcome path and add login and registration actions to one page. (to be added)</p><p>More to be added, but you should be good to go!</p><pre>Have fun!</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e803410588e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Validation]]></title>
            <link>https://medium.com/@serenabright/validation-bd71e1f3dc90?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd71e1f3dc90</guid>
            <category><![CDATA[codelikeagirl]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[validation]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Sun, 28 Jul 2019 19:26:41 GMT</pubDate>
            <atom:updated>2019-07-29T19:36:52.719Z</atom:updated>
            <content:encoded><![CDATA[<p>The importance of validation spreads beyond security. Those who work with data pray for cleaner data every day. This is why I got excited about ActiveRecord’s validations. I can set up my models in a way so that the data can only get through in a format that I require before it even touches the database. This limits the possibility to end up with bad data, which can cause problems later even if our code is technically bug-free. The data analysts/scientists will be less frustrated and can focus on their python magic faster.</p><pre>What is a validation?<br>Is the information that is going to your database valid? clean?</pre><p>Let’s play with code.</p><p>I go to my console to create a new model quest (Quest.new). By default I auto-populated (nil, nil, nil…nil for all parameters). I instantiate q1 as an instance variable in the console. It is instantiated, but not saved.</p><p>I do q1.save and get error messages, that are hard to read. To view them properly, I do:</p><pre><em>q1.errors</em> to see the errors I got.</pre><pre>even better .....   <br><em>q1.errors.full_messages </em>to see the array of messages that I got.</pre><p>Apparently, because this instance belongs to a join class and required the foreign keys to exist. When I instantiated it, it didn’t give me any errors, but when I started saving it to the database, that’s when I got the errors. <em>q1.valid?</em> I get true or false. Same but inverse method: <em>q1.invalid?</em></p><p>In Rails, <em>belongs_to</em> gives you those validations.</p><p>Let’s say I also want to validate the name. A quest needs to be created with a name. Right now if I create a quest, assign a unicorn, but don’t put the name, it will still get created but will produce a bad user experience. This is why we set up to validate that.</p><pre>class Quest &lt; ApplicationRecord<br>   validates :name, presence: true<br>   belongs_to :leprechaun<br>   belongs_to :unicorn<br>end</pre><p>Then, I do:</p><pre>rails c&gt; q1 = Quest.create() </pre><p>This was an example of validation. This feature helps us write code more efficiently and catches us before we go in the wrong way too far. It also improves user experience, and, again, produces cleaner data.</p><p>You can validate the length and other things in separate lines, and you can also have validations (regular and custom) in one line.</p><pre>def validation_method<br>   if self.name[0].downcase == “y”<br>   self.errors.add(:name, “cannot begin with Y”)<br>end</pre><p>In the example below, I have created validations to ensure that:</p><p>For model Author, all authors have a name, no two authors have the same name, and an author phone numbers are exactly ten digits.</p><p>For model Post, all posts have a title, post content is at least 250 characters long, post summary is a maximum of 250 characters; and that post category is either Fiction or Non-Fiction This step requires an inclusion validator, (for more info, go to <a href="http://guides.rubyonrails.org/active_record_validations.html">Rails guide</a> ).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a31c0458c9f5a98fecd107bf5eac336/href">https://medium.com/media/3a31c0458c9f5a98fecd107bf5eac336/href</a></iframe><p>How can validation improve user experience? Isn’t it more annoying trying to get through the system when it throws you errors? By helping users fix typos or other problems in their form submissions!</p><p>Now, improving one aspect of user experience, we have to make sure that the user isn’t faced with another one if we don’t set up proper paths, according to the errors that the code might be seeing.</p><ul><li>If the entry is invalid, it won’t be redirected to the show page. The entry is not saved to the database, so the user is getting the 404 error.</li><li>If we redirect it to the correct path, we start a new page load, which will lose all of the feedback from the validations.</li></ul><p>Full-page loads are tricky. When a user submits a form, a full-page load turns on, as if they have entered a completely new URL. The browser throws all of the variables (except for cookies) out and nothing gets through to thecreate action. Same for Rails, which only keeps the session hash.</p><p>Remember, if you are working on the update page, in the case of error, redirect them to :edit!!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa9571ade41a50aa7a7ee8cbb1d3e97e/href">https://medium.com/media/aa9571ade41a50aa7a7ee8cbb1d3e97e/href</a></iframe><p>Let’s make sure that the user is not getting upset from losing their entries if they are redirected to edit page, with form_tag and form_for.</p><p>Have fun and happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd71e1f3dc90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Can’t sleep while in a coding bootcamp?]]></title>
            <link>https://medium.com/@serenabright/cant-sleep-while-in-a-coding-bootcamp-bb67a8de1efc?source=rss-63d294d696a3------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb67a8de1efc</guid>
            <category><![CDATA[sleep]]></category>
            <category><![CDATA[insomnia]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[bootcamp]]></category>
            <dc:creator><![CDATA[Serena Bright]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 15:35:40 GMT</pubDate>
            <atom:updated>2019-08-07T22:28:45.259Z</atom:updated>
            <content:encoded><![CDATA[<h3>Can’t sleep while in a coding bootcamp? Try this.</h3><p>The target audience of this article is the community of coders going through an intense bootcamp. I am currently studying Web Development at Flatiron School Access Labs, and more often than not, I hear of the struggles to have a good quality refreshing sleep.</p><p>Each day we come home exhausted after learning a whole lot of new features of programming— there are always more labs released than we have the time to complete. Late at night, when the efficiency of work is diminishing, the brain is foggy, and body hurts from sitting all day, it’s time to rest.</p><p>Good luck falling asleep! And beware of having dreams where your unfinished code chasing you till dawn.</p><p>Here is what works for me.</p><p>Despite my strong desire to think of anything else but code after a long day, watching a coding tutorial on youtube works wonders.</p><p>Most of the time, I am happily asleep in less than 15 minutes.</p><p>The technique:</p><p>Watch the tutorial with your head on the pillow. Laying on one side works best for me. Follow the video, while feeling productive and learning new stuff by doing so little! No time is wasted on entertainment, and nothing is exciting your nervous system… just the soothing voice of an instructor talking about code. My favorite moment is dozing off feeling annoyed at the instructor who is not letting me sleep in peace. That’s when I know the time has come. I close my laptop, shift the eye mask down and surrender.</p><p>Sleep is a mysterious entity. As a user, I am responsible for maintaining a proper relationship with it, treating it with the respect it deserves. Like a cat, it doesn’t like to be forced, especially if I have neglected it. So, I shouldn’t expect it to provide me with benefits, unless I create the environment it requires to perform its magic… whatever that means.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb67a8de1efc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>