<?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 Alexandr Lavrentyev on Medium]]></title>
        <description><![CDATA[Stories by Alexandr Lavrentyev on Medium]]></description>
        <link>https://medium.com/@al3xsus?source=rss-e3610a540705------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Alexandr Lavrentyev on Medium</title>
            <link>https://medium.com/@al3xsus?source=rss-e3610a540705------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 18:08:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@al3xsus/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[How To Create a Web Application For Brain Training with React. Part I.]]></title>
            <link>https://levelup.gitconnected.com/web-application-for-a-brain-training-23dc567f0315?source=rss-e3610a540705------2</link>
            <guid isPermaLink="false">https://medium.com/p/23dc567f0315</guid>
            <category><![CDATA[brain-training]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[semantic-ui-react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Alexandr Lavrentyev]]></dc:creator>
            <pubDate>Fri, 11 Mar 2022 17:57:37 GMT</pubDate>
            <atom:updated>2025-07-21T18:06:17.242Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>I started to work on this a long time ago. It was intended for my mother, but she didn’t use it much, she passed away due to COVID-19 last year. But I still hope that my work could be helpful for many people.</blockquote><p>Let’s start by citing UN documents:</p><blockquote>According to data from <a href="https://population.un.org/wpp/">World Population Prospects: the 2019 Revision</a>, by 2050, one in six people in the world will be over age 65 (16%), up from one in 11 in 2019 (9%). By 2050, one in four persons living in Europe and Northern America could be aged 65 or over. In 2018, for the first time in history, persons aged 65 or above outnumbered children under five years of age globally. The number of persons aged 80 years or over is projected to triple, from 143 million in 2019 to 426 million in 2050.</blockquote><p>What does that mean for us? We must be prepared to live longer, work harder (since there would be less available manpower, so the state is gonna squeeze every penny from workers to let the economy stay afloat), and witness people with mental decline more frequently. Unfortunately, the last one awaits all of us, but we still can do many, to at least stop it from progressing — healthy eating, regular exercise, and brain training. And brain training could be made in the form of a game. Game web application! That’s why we’ve come here, innit?</p><p>Let’s go step by step and implement just one exercise. For now.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FlxN6uqrkziktujpAnH%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FlxN6uqrkziktujpAnH%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FlxN6uqrkziktujpAnH%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/99eeacf63eb03ebc6459fb9481261785/href">https://medium.com/media/99eeacf63eb03ebc6459fb9481261785/href</a></iframe><h3>Game of Words and Colors</h3><p>Look at the picture below.</p><figure><a href="https://www.insider.com/game-shows-words-in-different-colors-stroop-effect-it-2019-7"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NYpWI300uJdxe45WhE4YmA.jpeg" /></a><figcaption>Click to go to the source</figcaption></figure><p>Now try to read and pronounce the <strong>COLOR</strong> of the word, not the word itself. And try to do it fast. Not so easy a task, huh? What you’ve seen here is called the <a href="https://en.wikipedia.org/wiki/Stroop_effect">Stroop effect</a>. It is mostly used in various tests and psychological research, but according to various internet sources, it could also keep your mind sharp and slow down the effects of Alzheimer’s disease. Anyway, let’s create a game out of it!</p><p>So, let’s get down to business — how do we do it? By adding four key points to the main idea:</p><ol><li>Random</li><li>Configurability</li><li>Challenge</li><li>Interactive</li></ol><p>So, it’s gonna be a playable, customizable table with random words and colors, where you need to pronounce the color of the selected word, which changes over time. All others are bells and whistles. Time for code!</p><p>I’ll write this project in React with TypeScript and the Semantic UI React CSS framework. You’re free to use any tool, language, and framework, of course.</p><p>First of all, creating the project</p><pre>npx create-react-app brain-train --template typescript</pre><p>With your permission, I’m not gonna describe every used package, since it’s gonna transform already boring text into something unreadable. You can always check the list of necessary packages at <strong>package.json</strong> in the repository. The same could be said about every module — <a href="https://github.com/al3xsus/brain-train">you can see the whole code on GitHub</a>.</p><p>This is my palette:</p><pre>const Palette = [<br>    {<br>        &#39;name&#39;: &#39;red&#39;,<br>        &#39;code&#39;: &#39;#ff0000&#39;<br>    },<br>    {<br>        &#39;name&#39;: &#39;yellow&#39;,<br>        &#39;code&#39;: &#39;#FFFF00&#39;<br>    },<br>    {<br>        &#39;name&#39;: &#39;green&#39;,<br>        &#39;code&#39;: &#39;#00ff00&#39;<br>    },<br>    {<br>        &#39;name&#39;: &#39;blue&#39;,<br>        &#39;code&#39;: &#39;#0000FF&#39;<br>    },<br>    {<br>        &#39;name&#39;: &#39;black&#39;,<br>        &#39;code&#39;: &quot;#000000&quot;<br>    }<br>]</pre><figure><img alt="Palette modal" src="https://cdn-images-1.medium.com/max/911/1*-sT0F5P6BUN1DdZasz1EYQ.png" /><figcaption>Palette modal</figcaption></figure><p>I built everything using hooks, so this is my “state”:</p><pre>const [rowNum, setRowNum] = React.<em>useState</em>(4)<br>const [colNum, setColNum] = React.<em>useState</em>(4)<br>const [speed, setSpeed] = React.<em>useState</em>(0.5)<br>const [tableData, setTableData] = React.<em>useState</em>&lt;any&gt;(null)<br>const [direction, setDirection] = React.<em>useState</em>(&quot;start-to-end&quot;)<br>const [activeCell, setActiveCell] = React.<em>useState</em>&lt;null | number&gt;(null)<br>const [gameStatus, setGameStatus] = React.<em>useState</em>(false)</pre><p><em>rowNum and colNum are rows and columns for the table, speed is the game speed, tableData is for randomly generated table data, the direction is for game direction, activeCell is for the currently active cell, and gameStatus is for play/stop. I’ve tried to keep it obvious because the </em><a href="https://en.wikipedia.org/wiki/KISS_principle"><em>KISS principle</em></a><em> is a must-have thing.</em></p><p>This is how I generate random data for a table:</p><pre>const prepareData = () =&gt; {<br>    let data: [number, number][][] = []<br>    let word = 0<br>    let color = 0<br>    for (let i = 0; i &lt; rowNum; i++) {<br>        let row: [number, number][] = []<br>        for (let k = 0; k &lt; colNum; k++) {<br>            word = Math.floor(Math.random() * Palette.length)<br>            color = Math.floor(Math.random() * Palette.length)<br>            row.push([word, color])<br>        }<br>        data.push(row)<br>    }<br>    return data<br>}</pre><p><em>It’s a multidimensional array, which consists of rows and columns, and every </em><strong><em>cell</em></strong><em> inside consists of two numbers — one for the color name, the other for the color code</em></p><p>This is how I generate and populate the table:</p><pre>const generateTable = () =&gt; {<br>    if (tableData) {<br>        return tableData.map((row: [number, number][], rowIndex: number) =&gt; &lt;Table.Row key={`tr-key-${rowIndex}`}&gt;<br>            {row.map((cell: [number, number], index: number) =&gt; {<br>                return &lt;Table.Cell key={`td-key-${rowIndex}-${index}`}&gt;<br>                    &lt;svg viewBox=&quot;0 0 100 20&quot; style={{<br>                        width: &quot;100%&quot;,<br>                        padding: &quot;1vh 1vw&quot;,<br>                        fill: Palette[cell[1]].code<br>                    }}&gt;<br>                        &lt;text<br>                            x=&quot;0&quot;<br>                            y=&quot;15&quot;<br>                            id={`text-${rowIndex}-${index}`}<br>                        &gt;<br>                            {t(`colors.${Palette[cell[0]].name}`).toUpperCase()}<br>                        &lt;/text&gt;<br>                    &lt;/svg&gt;<br>                &lt;/Table.Cell&gt;<br>            })}<br>        &lt;/Table.Row&gt;)<br>    }<br>    return null<br>}<br>...<br>&lt;Table basic={&quot;very&quot;} size={&quot;large&quot;} celled={true}&gt;<br>    &lt;Table.Body&gt;<br>        {generateTable()}<br>    &lt;/Table.Body&gt;<br>&lt;/Table&gt;</pre><p><em>We’re just populating cells inside of columns and rows with Palette[y].name SVG text painted in Palette[x].code. Why SVG? Because it’s one of the simplest ways to </em><a href="https://css-tricks.com/fitting-text-to-a-container/"><em>fit text into the container</em></a><em>.</em></p><p>And this is the heart of that game:</p><pre>React.<em>useEffect</em>(() =&gt; {<br>    let interval: (any) = null<br>    if (gameStatus) {<br>        if (activeCell === null) {<br>            interval = <em>setInterval</em>(() =&gt; {<br>                if (direction === &quot;start-to-end&quot;) {<br>                    setActiveCell(0)<br>                    underlineSVG(0, true)<br>                } else {<br>                    setActiveCell((rowNum * colNum) - 1)<br>                    underlineSVG((rowNum * colNum) - 1, true)<br>                }<br>            }, speed * 1000)<br>        } else {<br>            const cleanUp = () =&gt; {<br>                setActiveCell(null)<br>                setGameStatus(false)<br>                underlineSVG(activeCell, false)<br>            }<br>            if (direction === &quot;start-to-end&quot;) {<br>                if (activeCell &lt; (rowNum * colNum) - 1) {<br>                    interval = <em>setInterval</em>(() =&gt; {<br>                        setActiveCell(activeCell + 1)<br>                        underlineSVG(activeCell + 1, true)<br>                        underlineSVG(activeCell, false)<br>                    }, speed * 1000)<br>                } else {<br>                    cleanUp()<br>                }<br>            } else {<br>                if (activeCell &gt;= 0) {<br>                    interval = <em>setInterval</em>(() =&gt; {<br>                        setActiveCell(activeCell - 1)<br>                        underlineSVG(activeCell - 1, true)<br>                        underlineSVG(activeCell, false)<br>                    }, speed * 1000)<br>                } else {<br>                    cleanUp()<br>                }<br>            }<br>        }<br>    } else if (!gameStatus &amp;&amp; activeCell !== null) {<br>        <em>clearInterval</em>(interval);<br>    }<br>    return () =&gt; <em>clearInterval</em>(interval);<br>}, [gameStatus, activeCell]);</pre><p><em>It’s a timer inside a useEffect hook. If the game is active, we’re setting a new activeCell in the table, highlighting it, and removing the highlight from the previous one, going according to the direction and at a set speed.</em></p><p>And this is how I manipulate SVG:</p><pre>const underlineSVG = (address: number, highlight: boolean) =&gt; {<br>    let [row, col] = [0, 0]<br>    if (address !== 0) {<br>        row = Math.floor(address / colNum)<br>        col = address - (row * colNum)<br>    }<br>    let elem: null | HTMLElement = document.getElementById(`text-${row}-${col}`)<br>    if (elem) {<br>        if (highlight) {<br>            elem.setAttribute(&quot;style&quot;, &quot;text-decoration: underline&quot;)<br>        } else {<br>            elem.setAttribute(&quot;style&quot;, &quot;&quot;)<br>        }<br>    }<br>}</pre><p><em>We’re converting a one-dimensional number into a multidimensional array address and then highlighting or removing highlights from the text. This whole method is way faster than if we were to set a conditional style in dynamically created cells. Or, at least, I think so.</em></p><p>So, here is what it looks like:</p><figure><img alt="Multicolored words table in english" src="https://cdn-images-1.medium.com/max/1024/1*8LLvfnyT29AlmYUZkQh-rg.png" /><figcaption>Multicolored words table in English</figcaption></figure><figure><img alt="Multicolored words table in Russian" src="https://cdn-images-1.medium.com/max/1024/1*gLDCHgxcr_YYpaC4GTOzog.png" /><figcaption>Multicolored words table in Russian</figcaption></figure><p>There is much more in my app — simple routing, informational modals, translation, etc. The full code can be found <a href="https://github.com/al3xsus/brain-train">here</a>. And the working example is <a href="https://al3xsus.github.io/brain-train/">here</a>.</p><p>This is not a finished product yet, I’ll gonna refactor it a bit and add new games and exercises in the future. Stay with me if you wanna see it!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FYjfAfZyzEoOZi%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FYjfAfZyzEoOZi%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FYjfAfZyzEoOZi%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="192" frameborder="0" scrolling="no"><a href="https://medium.com/media/38cd5ca4c8373c1ce0487c2a1e35be68/href">https://medium.com/media/38cd5ca4c8373c1ce0487c2a1e35be68/href</a></iframe><p><strong>Well, thanks for reading! Please, share your opinion in the comments, and follow me for more. And don’t be afraid to ask questions.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23dc567f0315" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/web-application-for-a-brain-training-23dc567f0315">How To Create a Web Application For Brain Training with React. Part I.</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Another Great Reset]]></title>
            <link>https://medium.com/the-shadow/another-great-reset-369f9e04a067?source=rss-e3610a540705------2</link>
            <guid isPermaLink="false">https://medium.com/p/369f9e04a067</guid>
            <category><![CDATA[great-reset]]></category>
            <category><![CDATA[urban-planning]]></category>
            <category><![CDATA[green-economy]]></category>
            <category><![CDATA[blue-economy]]></category>
            <category><![CDATA[future]]></category>
            <dc:creator><![CDATA[Alexandr Lavrentyev]]></dc:creator>
            <pubDate>Sat, 10 Apr 2021 17:21:45 GMT</pubDate>
            <atom:updated>2022-05-13T16:11:29.381Z</atom:updated>
            <content:encoded><![CDATA[<p>Okay, you probably heard about that <a href="https://www.weforum.org/great-reset/">Great Reset story</a>, or, at least, have seen some memes about it (or about Klaus Schwab&#39;s appearance).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/0*Oo18Z5Ofiq6oj4x0.jpg" /></figure><p>And if you’re a kind of politically active person with a good memory, you would’ve remembered one more <a href="https://www.weforum.org/agenda/2016/11/how-life-could-change-2030/">WEF-related story</a>, which left a big legacy on the internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A8MxCaBQ77vrS5qa.jpg" /></figure><p>Well, okay. Since it’s quite a hot theme, I would like to propose my own Great Reset plan — well, uh, because I can. And because in my opinion, the WEF agenda don’t actually answer the problems. Yes, a greener way of life, smarter growth, and other pretty buzzwords are full of good intentions, but it’s not addressing the root of the problem and it’s not really “greatly” “reset” anything.</p><p>So, what real “Great Reset” should be about? What are real actions and proposals?</p><p>My approach is based on one huge idea — we must return to the big water (big navigable rivers, big navigable lakes, seas, and oceans). Why? Here are few reasons:</p><ul><li>First of all, it’s a source of vital liquid for agriculture, industry, and everyday life. Yes, to get drinking water from seawater, you need desalinization plant(s) — but it’s surmountable challenges, unlike, you know, getting enough water for hundreds of people right in the middle of the desert;</li><li>Shipping routes and waterways are <a href="https://en.wikipedia.org/wiki/Freight_transport#Modes_of_shipment">essential</a> for passengers and cargo;</li><li>Leisure, recreational and tourism possibilities are quite huge — from simple fishing to submarine safari;</li><li><a href="https://en.wikipedia.org/wiki/Aquaculture">Aquaculture</a> can provide enough food to the growing population of cities and the outside world.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F0LlIzXg4cgc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D0LlIzXg4cgc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F0LlIzXg4cgc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/06823af1a2bc5a4e22da15481a140676/href">https://medium.com/media/06823af1a2bc5a4e22da15481a140676/href</a></iframe><p>Let&#39;s talk more precisely.</p><p>We must re-think the <strong>location</strong> of our homes. Cities without access to the big water should be abandoned. For example, it was quite common in the Soviet era to build cities <a href="https://en.wikipedia.org/wiki/Ekibastuz">right in the middle of the steppe</a>— just for serving the giant coal mine and no less giant power station (and today you don’t need a whole city for that, I believe). Cities like those can’t be sustainable no matter the cost. Of course, military bases, mines, and a few other specific categories of inhabited locations with rotational\shift work character would stay — but again, we must not let such places <a href="https://en.wiktionary.org/wiki/monocity">grow too much</a>. Locations, that are no more inhabited after the exodus, should be turned into forests, parks, reserves, wildlife sanctuaries, maybe even hunting grounds or giant grasslands or pastures. Or it can be transformed into natives&#39; lands.</p><h3>Greece Ελλάς Греция on Twitter: &quot;#Aitoliko is a small, densely populated island that is located in the middle of a calm lagoon in Western Greece, connected to the mainland by two 30-meter-long stone arch bridges of the 19th century. pic.twitter.com/luYBpmfet0 / Twitter&quot;</h3><p>Aitoliko is a small, densely populated island that is located in the middle of a calm lagoon in Western Greece, connected to the mainland by two 30-meter-long stone arch bridges of the 19th century. pic.twitter.com/luYBpmfet0</p><p>So, people should migrate to cities, which can become sustainable, and thus must <strong>grow bigger, stronger, and higher</strong>. The big city must become a megapolis, a megapolis must grow into a megalopolis, and a few megalopolises, located nearby must unite as megaregion. And if there are no cities, but the location meets our requirements — new cities should arise from shores, islands, and even right on the water surface. Let’s made up a general rule — the city should exist as a stripe along the body of water (multiple stripes, if the city has multiple bodies of water nearby). It’s a bit different for island or ocean\sea habitats, naturally.</p><h3>The Seasteading Institute on Twitter: &quot;&quot;Maldives Floating City is the first development of a new era in which Maldivians return to the water with resilient eco-friendly floating projects.&quot;https://t.co/NGWkGeOPEs pic.twitter.com/n0j7rVdkfI / Twitter&quot;</h3><p>&quot;Maldives Floating City is the first development of a new era in which Maldivians return to the water with resilient eco-friendly floating projects.&quot;https://t.co/NGWkGeOPEs pic.twitter.com/n0j7rVdkfI</p><p><strong>Economical and cultural ties</strong> should prevail over unnatural borders. Some cities are better as city-states. Some cities are better to unite with neighborhoods. And some states are way too artificial and cannot unite such different cities and people together so they’re better to break up. For example, this is a <a href="https://www.visualcapitalist.com/ranked-the-megaregions-driving-the-global-economy/">big map</a> of the world’s megaregions. If you look at that map you’ll find out, that, for example, there are megaregions in the USA for whom ties with Canadian megaregions are way more vital, than ties with the USA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*qpVUQPCNAdNi-sJE.png" /><figcaption><a href="https://www.researchgate.net/figure/Map-and-general-characteristics-of-the-11-US-Megaregions-Note-that-most-populated_fig2_289488386">Megaregions of the USA</a></figcaption></figure><p><strong>New architecture</strong>. Arcologies and mega-towers. Buildings should be constructed using as many local materials (especially recycled\reused), as possible. We must be not afraid to build new forms, pretty, cost-effective, and sustainable. There is nothing wrong with “commie blocks”, as long as they’re made from proper materials, good looking, and correctly maintained. We shouldn’t forbid the possibility of having a nice very own house, no. On the contrary, we must ensure that life in high-rise apartment buildings is as good as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qgqt3WUhNnJy4c6m.jpg" /><figcaption>A common use of urban garden rooftops is one of the most obvious steps</figcaption></figure><p><strong>New workplaces</strong>, <a href="https://en.wikipedia.org/wiki/Green_economy">green economy</a>, and <a href="https://en.wikipedia.org/wiki/Blue_economy">blue economy</a>. It’s quite straightforward — cities of the new era would require new or upgraded old connections: airports, railroads, and of course, ports. Moving the population closer to the coast would create a better situation for logistics and an increased density of population means new opportunities for business. And both the green and blue economies can offer whole new sectors of jobs, research, and possibilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*iObcgLVlsfDdKEW2.jpg" /><figcaption><a href="https://energyindustryreview.com/analysis/why-blue-economy-is-so-important/">Examples</a> of blue economy jobs</figcaption></figure><p><strong>New food</strong>. We must enlarge our range of daily consumable plants and sea products. Fewer monocultures, more biodiversity.</p><blockquote>“Seventy-five per cent of the global food supply comes from only 12 plant and five animal species. Just three (rice, maize and wheat) make up nearly 60 per cent of calories from plants in the entire human diet”, the <a href="https://www.wwf.org.uk/sites/default/files/2019-02/Knorr_Future_50_Report_FINAL_Online.pdf">report</a> states.</blockquote><blockquote>Other important products among the 12 include palm, fruit, oil, potatoes, soybeans, sugar beets, sugar cane, and tomatoes.</blockquote><blockquote>The diversity on the plate and on farm lands globally has reduced as only these 12 crops are focused on in terms of cultivation. The cost of this has reflected on both, human health and environment. Since 1900, a staggering 75 per cent of the genetic plant diversity in agriculture has been lost, says the <a href="https://www.wwf.org.uk/sites/default/files/2019-02/Knorr_Future_50_Report_FINAL_Online.pdf">report</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*LpA8NZW8A-tP3YgW.jpg" /><figcaption><a href="https://inhabitat.com/un-says-climate-change-is-threatening-global-food-diversity-and-could-cause-crop-extinctions/">More</a> about food diversity threatened by climate change</figcaption></figure><p><strong>More recycling, reusing and reducing</strong>. Plastic is an amazing product, and we should use it only in very special use-cases. Bio-degradable waste can be used in bio-reactors to generate methane for gas-fired power stations and fertilizers for agriculture. Many other types of waste can be either reused or recycled. Conscious consumption should become the norm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vJqGeKKiCfe2OVFr.jpg" /><figcaption><a href="https://sites.psu.edu/aspsy/2020/02/06/is-reusing-the-new-recycling/">More R</a></figcaption></figure><p><strong>New ways of manufacturing</strong>. In many cases, for example, it’s better, cheaper, and more sustainable not to import cars from overseas, but to build them locally in a small factory, using as many local materials (especially recycled\reused), as possible. Modern CNC, 3D printers, and many other smart tools and machines can produce almost everything, almost everywhere.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FZ_Qyor9Yc-s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZ_Qyor9Yc-s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FZ_Qyor9Yc-s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/31aa02a60f0ae4179ac6927e76f021b9/href">https://medium.com/media/31aa02a60f0ae4179ac6927e76f021b9/href</a></iframe><p>Sounds cool! But there are always pros and cons. And here are our flaws:</p><ol><li>For many countries, that change of habitats may result in war — a civil one or plain old battle with neighbors. Artificial borders, created by imperialists after WW1 and WW2 are already causing unrest in many parts of the world. And despite the fact that new borders could be seen as more fair, logical, and pragmatical, not all people (and especially, governments) would be ready for that.</li><li>International bureaucratic obstacles. One of the most bright examples — the creation of independent states on artificial islands is pretty much <a href="https://en.wikipedia.org/wiki/United_Nations_Convention_on_the_Law_of_the_Sea">prohibited</a> by the UN. That’s just ridiculous!</li><li>Ecology. More people at the shore, more ships nearby, and bigger catches of fish and seafood. Yes, there would be plenty of fish and seafood farms, and there would be artificial reefs for the biodiversity, but still, the impact is pretty much inevitable.</li><li>Technological problems. One of the most obvious — <a href="https://www.bucciinsurance.com/2017/08/10/3-ways-living-near-ocean-can-affect-car/">the closer you live to the shore</a>, the more likely your car is to have saltwater sprayed on it each day. This consistent salt wash can lead to more rapid rust formations. There are also problems with <a href="https://www.servicemasternow.com/mold-and-my-beach-house-gulf-shores-alabama/">buildings</a>.</li><li>Climate change and <a href="https://www.climate.gov/news-features/understanding-climate/climate-change-global-sea-level">sea-level rise</a>. Yesterday shore — shallow water tomorrow. Usually, it could be solved just by building your city a bit higher foundation and using various sea\ocean protection, like <a href="https://en.wikipedia.org/wiki/Seawall">seawalls</a>.</li><li>Some places, which could be sustainable cities, are already over-populated. It could be solved by relocating people into new districts and\or building more high-rise housing.</li><li>Tsunami and rogue waves danger. It’s a serious danger for the sea and ocean coasts. We can reduce it using various sea\ocean protection, like <a href="https://en.wikipedia.org/wiki/Seawall">seawalls</a> and <a href="https://en.wikipedia.org/wiki/Breakwater_(structure)">breakwaters</a>.</li></ol><p><strong>Well, thanks for reading! Please, share your opinion in the comments and follow me for more. And don’t be afraid to ask questions, if something is not clear.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=369f9e04a067" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-shadow/another-great-reset-369f9e04a067">Another Great Reset</a> was originally published in <a href="https://medium.com/the-shadow">The Shadow</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a signature-generating app with React]]></title>
            <link>https://levelup.gitconnected.com/how-to-create-a-signature-generating-app-with-react-ffeb2f2201cc?source=rss-e3610a540705------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffeb2f2201cc</guid>
            <category><![CDATA[email-signatures]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[material-ui]]></category>
            <dc:creator><![CDATA[Alexandr Lavrentyev]]></dc:creator>
            <pubDate>Mon, 29 Mar 2021 15:05:59 GMT</pubDate>
            <atom:updated>2022-05-13T16:02:46.949Z</atom:updated>
            <content:encoded><![CDATA[<p>Remember when business cards were a big thing? And when I say big, I mean — <strong>BIG. </strong>Even movies sometimes had a whole scene concentrated on a business card only.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FJq1T4jCKm9039q2lEV%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Famerican-psycho-Jq1T4jCKm9039q2lEV&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2FJq1T4jCKm9039q2lEV%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="206" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4e21d05415ef06e70ecd1ba2674471d/href">https://medium.com/media/e4e21d05415ef06e70ecd1ba2674471d/href</a></iframe><p>No, I don’t mean it’s not a thing anymore. Rather, I suppose you can safely say that it loses a bit of the charm in the new era. Of course, it’s not the same everywhere — at least in Japan, they’re still serious about <a href="https://en.wikipedia.org/wiki/Business_card#Japan">meishi</a>. Sometimes, however, business cards became something different and a very unique thing — when they’re trying to get away from <a href="https://www.boredpanda.com/creative-business-card-designs">boring pieces of paper</a>.</p><p>And here is the most interesting point. What could be used as an electronic business card today? The most straightforward answer is — email signature! It’s a very simple yet effective way to receive additional or even primary data about the sender. For example, it could be a company name, position, skype, telephone number, et cetera.</p><p>Why would you even need the email signature? To tell it super-shortly — to increase your business value. You can easily impress people with it in the same way you could impress them with a business card. You, your brand, and your company can become more well-recognizable with an interesting email signature. Finally, a distinctive email signature can help you with growing trust by letting people know who exactly maintains email correspondence with them and it could be a kind of auxiliary security feature. And don’t forget about saving trees!</p><p>How could you create an email signature as a person and as a company? There are 3 ways to do it:<br>1. Create it right in the Gmail settings section, using provided visual redactor — far away from being called user-friendly. Also a very time-consuming process.<br>2. Utilizing some HTML-signature template, created by someone else. Not bad, but where and how would you store that template?<br>3. Create a web application for that case!</p><p>So, now we’re going to build a signature-generating app (a kind of internal site for some fictional company), using React and Material UI (I choose it just for faster development, you can use a different framework or don’t use a framework at all and work directly with СSS). It would be capable to generate two types of signatures, based on provided information — with and without a photo. Other info would include full name, position, telephone, skype, and social networks links.</p><p>Let’s create a project with the create-react-app tool. I would also like to use typescript and yarn package manager. Of course, you can use npm and plain javascript. Go to your designated projects directory and type npx create-react-app signature-generator — template typescript — use-yarn. You do have <a href="https://nodejs.org/en/">node</a> (in this project I used v12.14.1) installed, right?</p><p>Navigate into the signature-generator directory. You can safely remove the logo.svg file and remove all content in the files App.tsx, App.css and index.css. The next step is the installation of Material-UI core—type yarn add @material-ui/core. We must also use Roboto font — go into public folder and add &lt;link rel=&quot;stylesheet&quot; href=&quot;https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&amp;display=swap&quot; /&gt; to index.html (put it into the &lt;head&gt; tag). And the last thing is Material-UI icons — type yarn add @material-ui/icons. Finally, preparation is over, it’s time to code.</p><p>First of all, let’s create our state interface and initialState:</p><pre>export interface PhotoSignatureProps {<br>    fullName: string;<br>    position: string;<br>    skype: string;<br>    phone: string;<br>    photo: string;<br>}<br><br>interface State extends PhotoSignatureProps {<br>    withPhoto: boolean;<br>    copied: boolean;<br>}<br><br>const initialState: State = {<br>    fullName: &quot;&quot;,<br>    position: &quot;&quot;,<br>    skype: &quot;&quot;,<br>    phone: &quot;&quot;,<br>    photo: &quot;&quot;,<br>    withPhoto: false,<br>    copied: false,<br>};</pre><p>and hooks for that:</p><pre>const [state, setState] = React.<em>useState</em>&lt;State&gt;(initialState);<br><br>const handleChange = (event: React.ChangeEvent&lt;HTMLInputElement&gt;) =&gt; {<br>  if (event.target.name === &quot;withPhoto&quot;) {<br>    setState((prevState) =&gt; ({<br>      ...prevState,<br>      [event.target.name]: event.target.checked,<br>    }));<br>  } else {<br>    setState((prevState) =&gt; ({<br>      ...prevState,<br>      [event.target.name]: event.target.value,<br>    }));<br>  }<br>};</pre><p>As you can see, for the sake of simplicity, the photo is actually the URL of some image, withPhoto is a flag of photo existence, and copied is a flag for visual approval of copy operation. The other fields are pretty straightforward.</p><p>Then it is time for form with input fields:</p><pre>&lt;form className={classes.root} noValidate autoComplete=&quot;off&quot;&gt;<br>    &lt;TextField<br>        fullWidth={true}<br>        required<br>        label=&quot;Full Name&quot;<br>        value={state.fullName}<br>        name={&quot;fullName&quot;}<br>        onChange={handleChange}<br>        autoFocus={true}<br>    /&gt;<br>    &lt;TextField<br>        fullWidth={true}<br>        required<br>        label=&quot;Position&quot;<br>        value={state.position}<br>        name={&quot;position&quot;}<br>        onChange={handleChange}<br>    /&gt;<br>    &lt;TextField<br>        fullWidth={true}<br>        required<br>        label=&quot;Skype&quot;<br>        value={state.skype}<br>        name={&quot;skype&quot;}<br>        onChange={handleChange}<br>    /&gt;<br>    &lt;TextField<br>        fullWidth={true}<br>        required<br>        label=&quot;Telephone&quot;<br>        value={state.phone}<br>        name={&quot;phone&quot;}<br>        onChange={handleChange}<br>    /&gt;<br>    ...<br>&lt;/form&gt;</pre><p>Let’s choose a logo. I used <a href="https://pixabay.com/illustrations/vintage-sign-nautical-ship-compass-1064142/">this one</a> and place it into assets folder. I’ve also added social network links and logos — for <a href="https://www.flaticon.com/free-icon/twitter_2111688?term=twitter&amp;page=1&amp;position=49&amp;page=1&amp;position=49&amp;related_id=2111688&amp;origin=search">Twitter</a>, <a href="https://www.flaticon.com/free-icon/linkedin_145807?term=linkedin&amp;page=1&amp;position=3&amp;page=1&amp;position=3&amp;related_id=145807&amp;origin=style">LinkedIn</a>, <a href="https://www.flaticon.com/free-icon/facebook_145802?term=facebook&amp;page=1&amp;position=2&amp;page=1&amp;position=2&amp;related_id=145802&amp;origin=search">Facebook</a>, and <a href="https://www.flaticon.com/free-icon/behance_733538?term=behance&amp;page=1&amp;position=26&amp;page=1&amp;position=26&amp;related_id=733538&amp;origin=search">Behance</a>.</p><pre>Few hints:<br>If you&#39;re using static images (like in this project):<br>  a) no SVGs - gmail proxy block it and gmail generally don&#39;t support it;<br>  b) no base64 - gmail don&#39;t support it and don&#39;t forget about global limit of 10000 symbols for web-based clients and 12000 for desktop ones (and base64 are usualy really long)<br>  c) don&#39;t forget to disable react-scripts\webpack function of converting small images to base64 utilizing environment variable <strong>IMAGE_INLINE_SIZE_LIMIT</strong><br>  d) don&#39;t forget to write <em>homepage</em> in <strong>package.json</strong> or use <strong>PUBLIC_URL </strong>environment variable</pre><p>Finally, it’s time for a signature template. <a href="https://www.wisestamp.com/gmail-email-signature/">Here</a> are useful <a href="https://emailsignaturerescue.com/blog/the-ultimate-guide-to-creating-awesome-gmail-signatures">tips</a> for that.</p><pre>Hint:<br>Forget about complex fancy <strong>div</strong>s. Mr. <strong>table</strong> is our best friend here.</pre><p>To make it simpler, we would have a logo or photo on the left side, then a long vertical line and 5 rows with full name, position, skype, telephone, and social networks links (my links are just home URLs of them), something like that:</p><pre>&lt;table cellPadding={0} cellSpacing={0} className={&quot;signature&quot;}&gt;<br>    &lt;tbody&gt;<br>    &lt;tr&gt;<br>        &lt;td rowSpan={5}&gt;<br>            &lt;img<br>                className={&quot;main-image&quot;}<br>                src={props.photo === &quot;no-photo&quot; ? Logo : props.photo}<br>                alt={&quot;&quot;}<br>            /&gt;<br>        &lt;/td&gt;<br>        &lt;td rowSpan={5}&gt;<br>            &lt;div<br>                className={&quot;vertical-line&quot;}<br>            /&gt;<br>        &lt;/td&gt;<br>        &lt;td&gt;{props.fullName}&lt;/td&gt;<br>    &lt;/tr&gt;<br>    &lt;tr&gt;<br>        &lt;td colSpan={3}&gt;{props.position}&lt;/td&gt;<br>    &lt;/tr&gt;<br>    &lt;tr&gt;<br>        &lt;td colSpan={3}&gt;Telephone: {props.phone}&lt;/td&gt;<br>    &lt;/tr&gt;<br>    &lt;tr&gt;<br>        &lt;td colSpan={3}&gt;Skype: {props.skype}&lt;/td&gt;<br>    &lt;/tr&gt;<br>    &lt;tr&gt;<br>        &lt;td colSpan={3}&gt;<br>            &lt;div className={&quot;social-logos-frame&quot;}&gt;<br>                &lt;a href={&quot;https://twitter.com/&quot;}&gt;<br>                    &lt;img src={TwitterLogo} alt={&quot;&quot;}/&gt;<br>                &lt;/a&gt;<br>                &lt;a href={&quot;https://www.linkedin.com/&quot;}&gt;<br>                    &lt;img src={LinkedInLogo} alt={&quot;&quot;}/&gt;<br>                &lt;/a&gt;<br>                &lt;a href={&quot;https://www.facebook.com/&quot;}&gt;<br>                    &lt;img src={FacebookLogo} alt={&quot;&quot;}/&gt;<br>                &lt;/a&gt;<br>                &lt;a href={&quot;https://www.behance.net/&quot;}&gt;<br>                    &lt;img src={BehanceLogo} alt={&quot;&quot;}/&gt;<br>                &lt;/a&gt;<br>            &lt;/div&gt;<br>        &lt;/td&gt;<br>    &lt;/tr&gt;<br>    &lt;/tbody&gt;<br>&lt;/table&gt;</pre><p>And don’t forget to add some CSS so it would look better!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FyYSSBtDgbbRzq%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ffrustrated-annoyed-programming-yYSSBtDgbbRzq&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2FyYSSBtDgbbRzq%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/b89b6e21c90229450e0d38e671a28b08/href">https://medium.com/media/b89b6e21c90229450e0d38e671a28b08/href</a></iframe><pre>Hints:<br>1. Not all fonts are supported by gmail. Do your <a href="https://www.omnisend.com/blog/email-safe-fonts-vs-custom-fonts/#:~:text=The%20most%20popular%20safe%20fonts,easy%2Dto%2Dread%20typefaces.">research</a> before.<br>2. All hyperlinks would be displayed in <a href="https://www.w3schools.com/html/html_links.asp">default</a> way. Try to use an image as a link.</pre><p>Last, but not least — put things in order in public folder, README.md and package.json. Serious guys have their own favicons and all descriptions, isn’t it? And you’re done! This is the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8uQU2GRRisx0mvcVuY9q2Q.png" /></figure><p>And the signatures — with company logo and with photo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*zau-JzyTd_Fll_hJSF52Mw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*ZYdR8b_Yfy5iOXeKNgFpEA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FeKNrUbDJuFuaQ1A37p%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fpeacocktv-christian-bale-american-psycho-patrick-bateman-eKNrUbDJuFuaQ1A37p&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2FeKNrUbDJuFuaQ1A37p%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/4fcfc75a095a1f6cfaa330c91fbcd3da/href">https://medium.com/media/4fcfc75a095a1f6cfaa330c91fbcd3da/href</a></iframe><p>The full code can be found <a href="https://github.com/al3xsus/email-signature-generator">here</a>. And the working example is <a href="https://al3xsus.github.io/email-signature-generator/">here</a>.</p><p><strong>Thoughts</strong>:<br>1. Email signature isn’t really simple but it’s far away from being a very complicated thing.<br>2. This project is still pretty much the skeleton of the completed product. You can (and probably should) offer users different templates in various designs, give them the freedom to add more stuff, handle photos as files, and many more.<br>3. React is a very easy, useful, and powerful instrument. Just like always.</p><p><strong>Well, thanks for reading! Please, share your opinion in the comments and follow me for more. And don’t be afraid to ask questions, if something is not clear.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffeb2f2201cc" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/how-to-create-a-signature-generating-app-with-react-ffeb2f2201cc">How to create a signature-generating app with React</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>