<?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 Andreas Müller on Medium]]></title>
        <description><![CDATA[Stories by Andreas Müller on Medium]]></description>
        <link>https://medium.com/@devmount?source=rss-c4d570089846------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Oxvk8V1ARq9bKm2T1Oc_XA.png</url>
            <title>Stories by Andreas Müller on Medium</title>
            <link>https://medium.com/@devmount?source=rss-c4d570089846------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 22:47:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@devmount/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[Building a Static Site Generator in 3 steps]]></title>
            <link>https://devmount.medium.com/building-a-static-site-generator-in-3-steps-06d93c3c03a4?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/06d93c3c03a4</guid>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Thu, 02 May 2024 12:25:19 GMT</pubDate>
            <atom:updated>2024-05-02T12:25:19.161Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A pulse transforming a template file into a productive file" src="https://cdn-images-1.medium.com/max/1024/1*TodDAkZx2foOpeXFv7SrhQ.png" /></figure><p>Maybe you know this situation: You are not so happy anymore with your personal website, the look and feel no longer represents you well enough and the time has come for a relaunch. I’ve been at this point recently and asked myself:</p><h3>What do I actually really need?</h3><p>I’ve been through a bunch for CMSes, always using my own website as playground for new technologies. That isn’t a bad or uncommon approach for a web dev, but I wanted to reduce complexity and maintenance effort this time. And then I had this most brilliant, completely new, unheard before, genius idea:</p><p><em>What if I’d just write vanilla HTML?!</em> (ba dum, tss!)</p><p>My head was spinning. That’d mean tiny loading times, no server side rendering or precompiling and best of all: No dependencies hence no build step! I was happy like a kid the day before Christmas. I felt like I had just made the invention of the century.</p><p>But then came the disillusionment: What about computed data? Or data retrieved per API? I usually showed some GitHub and DEV post stats on my website. Doing it with JavaScript would result in additional request on page load again. And I most certainly wouldn’t want to change my age manually every year (okay, that one wouldn’t be too bad if I forgot 😅). My brain was frantically searching for a way out of this to maintain its latest achievements. It finally had to realize, that at least one single layer of data retrieval and insertion was needed. But would that be possible without any dependencies?</p><p>It turned out, that I basically wanted a tiny <em>Static Site Generator</em> and I could have chosen one of the already existing great solutions out there. But sometimes, you just want to stay dependency free, keep things simple and and at the same time up-to-date and running long-term without having to worry about them.</p><p>I broke it down to 3 steps:</p><ol><li><strong>Create the markup</strong>: Do the actual webdesign work. Write HTML and CSS with all the content I want.</li><li><strong>Retrieve and process the data</strong>: Write a script that calls all APIs, does all data manipulation I need and inserts it into my content.</li><li><strong>Automate it</strong>: Call the script from 2. automatically to keep the content up-to-date</li></ol><p>Let’s visualize that:</p><figure><img alt="Schema of a static site generator" src="https://cdn-images-1.medium.com/max/1024/1*-GUcBIfnze9rRbo2K9q6fw.png" /><figcaption>Schema of a static site generator</figcaption></figure><p>Still interested? Then let’s get our hands dirty.</p><h3>1. Creating the markup</h3><pre># create the template file<br>touch template.html</pre><p>Ahh, feels good to write good ol’ plain HTML again. I’m sure every IDE has a shortcut for a basic HTML structure. For VS Code, just create an empty HTML file, type ! and hit TAB.</p><p>This one might be a bit more work than clicking “Install” on the next popular WordPress theme. But personally I enjoy writing HTML and CSS and building small websites from scratch like this, giving it a personal touch. I even decided not to use JavaScript but that was more of a personal challenge and totally not necessary.</p><p>If you don’t want to start from scratch, there are a lot of good vanilla HTML templates out there, e.g. [HTML5up](<a href="https://html5up.net/">https://html5up.net/</a>). For now, let’s use this example:</p><pre>&lt;! - template.html →<br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot;&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>  &lt;title&gt;My Website&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br> &lt;header&gt;<br>   I&#39;m a 36 y/o software engineer.<br> &lt;/header&gt;<br>   &lt;main&gt;<br>    &lt;p&gt;I love Open Source.&lt;/p&gt;<br>    &lt;p&gt;I created 123 PRs on GitHub.&lt;/p&gt;<br>  &lt;/main&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>2. Retrieving and Processing the data</h3><pre># create the script file<br>touch build.sh</pre><p>Now it gets interesting. To retrieve and manipulate data I decided to simply use the Bash. It is available on nearly every Linux distro and has a powerful language which should be sufficient to retrieve data and put it into our HTML file. So for our example, a possible build script could look like this:</p><pre># build.sh<br>GH_API_URL=&#39;https://api.github.com/graphql&#39;<br>GITHUB_TOKEN=&#39;abc_AB12CD34…&#39;<br># call the GitHub API via curl<br>QUERY=&#39;{ viewer { pullRequests { totalCount } } }&#39;<br>RESULT=$(curl -s -i -H &#39;Content-Type: application/json&#39; -H &quot;Authorization: bearer $GITHUB_TOKEN&quot; -X POST -d &quot;{\&quot;query\&quot;: \&quot;query $QUERY\&quot;}&quot; $GH_API_URL | tail -n 1)<br># get the data we want<br>let AGE=(`date +%s`-`date +%s -d 1987–06–05`)/31536000<br>PR_COUNT=$(echo $RESULT | sed -r &#39;s|.*&quot;totalCount&quot;:([0–9]*).*|\1|g&#39;)</pre><p>What’s happening here? We’re calling the <a href="https://docs.github.com/en/graphql">GitHub GraphQL API</a> by using curl and storing the json response in $RESULT. Note that you’ll need an access token, which you can generate in <a href="https://github.com/settings/tokens">your GitHub settings</a>. Since we get JSON with only one totalCount key, we can extract the number that follows that key with sed and a little regex. Also you can use let to assign a calculation directly to a variable, here an age calculated from a given date.</p><p>The last thing that’s missing now, is to insert the data into our template. I decided to just use common template variable notation {{...}} (of course you can choose whatever you like) and modified the template.html like this:</p><pre>&lt;! - template.html →<br>…<br> &lt;header&gt;<br>   I&#39;m a {{age}} y/o software engineer.<br> &lt;/header&gt;<br> &lt;main&gt;<br>   &lt;p&gt;I love Open Source.&lt;/p&gt;<br>   &lt;p&gt;I created {{pr_count}} PRs on GitHub.&lt;/p&gt;<br> &lt;/main&gt;<br>…</pre><p>To replace them, we let the script copy our template and just use sed with some replacement regex again:</p><pre># build.sh<br>…<br>cp template.html index.html<br>sed -i -e &quot;s|{{age}}|$AGE|g;s|{{pr_count}}|$PR_COUNT|g&quot; index.html</pre><p>Et voilà! We now have a ready-to-be-served index.html containg a computed age and API retrieved pull request count.</p><h3>3. Configuration and automation</h3><p>Let’s now improve our bash script and make it actually configurable. You might have noticed that e.g. the GitHub token and the birth date both were just hard-coded into the script. A much better approach especially for sensitive data would be, to hold all config in a separate file. I decided to use a simple .env file, but you can use whatever suits your case:</p><pre># create a config file<br>touch .env</pre><pre># .env<br>BIRTH_DATE=1987–06–05<br>GITHUB_TOKEN=ghp_ABCDEFGHIK123456789</pre><p>To load this configuration into the bash script, you can simply source it. That way, all config variables automatically become bash variables:</p><pre># build.sh<br>source .env<br>…<br>let AGE=(`date +%s`-`date +%s -d $BIRTH_DATE`)/31536000<br>…</pre><p>Now that we have an HTML template and a configurable Bash script that generates a servable index.html, we can finally execute that script — how and as often* as we like. You can run it manually, but you might as well automate the execution e.g. with a cron job or using GitHub actions. This flexibility is a huge advantage if you e.g. have to move your website to another server.</p><p>* Well, not limitless since there are limitations to the number of API calls per time. Just keep the repetition reasonably, e.g. I decided to call it once every 10 minutes.</p><h3>Wrapping it up</h3><p>So what we did here was creating a very basic and simple static site generator. Let’s have a last look at the pros and cons of this approach in diff style:</p><pre>+ Lightning fast, no blockers/requests on or after page load<br>+ Easy to maintain, no npm/composer update etc.<br>+ Flexible and (almost) tech and location independent<br>- Might be hard for some people to create/find a HTML template<br>- Not exactly beginner-friendly, requires knowledge of command line and handling raw data<br>- Might become less maintainable with a lot of pages</pre><p>After diving into this, I can say it’s still the best choice for my use case (single page website for a dev loving command line). If you want to have a look at my shiny new generated website, feel free:</p><p><a href="https://devmount.com/">https://devmount.com</a></p><p>And of course it’s open source! Would be an honor if you use it as a template for your next little project:</p><p><a href="https://github.com/devmount/devmount.com">GitHub - devmount/devmount.com: Developer portfolio website. Small, old-fashioned, but beautiful and lightning fast!</a></p><p>You have something to add, need some explanation or found a critical aspect I didn’t think of? Please let me know in the comments.</p><p>For convenience, here are the complete example files, if you’d like to fiddle around a bit with it:</p><pre>&lt;!-- template.html --&gt;<br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot;&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>  &lt;title&gt;My Website&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;header&gt;<br>    I&#39;m a {{age}} y/o software engineer.<br>  &lt;/header&gt;<br>  &lt;main&gt;<br>    &lt;p&gt;I love Open Source.&lt;/p&gt;<br>    &lt;p&gt;I created {{pr_count}} PRs on GitHub.&lt;/p&gt;<br>  &lt;/main&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><pre># .env<br>BIRTH_DATE=1987–06–05<br>GITHUB_TOKEN=ghp_ABCDEFGHIK123456789</pre><pre># build.sh<br>source .env<br>GH_API_URL=&#39;https://api.github.com/graphql&#39;<br><br># call the GitHub API via curl<br>QUERY=&#39;{ viewer { pullRequests { totalCount } } }&#39;<br>RESULT=$(curl -s -i -H &#39;Content-Type: application/json&#39; -H &quot;Authorization: bearer $GITHUB_TOKEN&quot; -X POST -d &quot;{\&quot;query\&quot;: \&quot;query $QUERY\&quot;}&quot; $GH_API_URL | tail -n 1)<br><br># get the data we want<br>let AGE=(`date +%s`-`date +%s -d $BIRTH_DATE`)/31536000<br>PR_COUNT=$(echo $RESULT | sed -r &#39;s|.*&quot;totalCount&quot;:([0–9]*).*|\1|g&#39;)<br><br># generate website and replace template variables<br>cp template.html index.html<br>sed -i -e &quot;s|{{age}}|$AGE|g;s|{{pr_count}}|$PR_COUNT|g&quot; index.html</pre><p><em>Originally Published: 2nd of May 2024 on </em><a href="https://dev.to/devmount/building-a-static-site-generator-in-3-steps-72e"><em>dev.to</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=06d93c3c03a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Array Methods Explained with Emojis]]></title>
            <link>https://devmount.medium.com/javascript-array-methods-explained-with-emojis-f1f237f7e19d?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1f237f7e19d</guid>
            <category><![CDATA[emoji]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[beginner]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Thu, 25 Feb 2021 13:14:49 GMT</pubDate>
            <atom:updated>2021-02-25T13:14:49.079Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7A8EZAtiUUfJfCZMbTsgg.png" /></figure><p>JavaScript has a lot of useful Array operations. If you are just as confused as me about which one to take and what they all do, let’s visualize these operations using emojis to better remember and apply them where they fit best ✅ And who knows, maybe they are capable of doing even more than we expect…</p><p><em>All examples in this article actually work, so feel free to try them in your browsers console</em> 🤓</p><h3>1. Array.push()</h3><p>Adds one or more elements to the end of an array. Or grows a farm.</p><pre>let livestock = [&quot;🐷&quot;, &quot;🐮&quot;, &quot;🐔&quot;];<br>livestock.push(&quot;🐴&quot;, &quot;🐮&quot;);<br>// console.log(livestock);<br>// [&quot;🐷&quot;, &quot;🐮&quot;, &quot;🐔&quot;, &quot;🐴&quot;, &quot;🐮&quot;]</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/push"><em>MDN</em></a></p><h3>2. Array.from()</h3><p>Creates a new array from an array-like or iterable object. Or separates some wild animals.</p><pre>const wild  = &quot;🐻🐯🦁&quot;;<br>const tamed = Array.from(wild);<br>// console.log(tamed);<br>// [&quot;🐻&quot;, &quot;🐯&quot;, &quot;🦁&quot;]</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/from"><em>MDN</em></a></p><h3>3. Array.concat()</h3><p>Merges two or more arrays into a single new one. Or brings different worlds together.</p><pre>const dogs = [&quot;🐶&quot;, &quot;🐶&quot;];<br>const cats = [&quot;🐱&quot;, &quot;🐱&quot;, &quot;🐱&quot;];<br>const pets = dogs.concat(cats);<br>// console.log(pets);<br>// [&quot;🐶&quot;, &quot;🐶&quot;, &quot;🐱&quot;, &quot;🐱&quot;, &quot;🐱&quot;]</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/concat"><em>MDN</em></a></p><h3>4. Array.every()</h3><p>Checks if all elements of an array pass the test. Or detects intruders.</p><pre>const visitors   = [&quot;🧑&quot;, &quot;👽&quot;, &quot;🧑&quot;, &quot;🧑&quot;, &quot;🤖&quot;];<br>const isHuman    = e =&gt; e === &quot;🧑&quot;;<br>const onlyHumans = visitors.every(isHuman);<br>// console.log(onlyHumans);<br>// false</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/every"><em>MDN</em></a></p><h3>5. Array.fill()</h3><p>Replaces the elements of an array from start to end index with a given value. Or grows some trees.</p><pre>let seeds = [&quot;🌱&quot;, &quot;🌱&quot;, &quot;🌱&quot;, &quot;🌱&quot;, &quot;🌱&quot;];<br>seeds.fill(&quot;🌳&quot;, 1, 4);<br>// console.log(seeds);<br>// [&quot;🌱&quot;, &quot;🌳&quot;, &quot;🌳&quot;, &quot;🌳&quot;, &quot;🌱&quot;]</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/fill"><em>MDN</em></a></p><h3>6. Array.filter()</h3><p>Creates a new array containing all elements passing the test. Or predicts your relationship status.</p><pre>const guests  = [&quot;👩👨&quot;, &quot;👩👩&quot;, &quot;👨&quot;, &quot;👩&quot;, &quot;👨👨&quot;];<br>const singles = guests.filter(g =&gt; g.length/2 === 1); // *<br>// console.log(singles);<br>// [&quot;👨&quot;, &quot;👩&quot;]</pre><p><em>* You might wonder, why the string length is divided by two here. The reason is that emojis actually are represented by a pair of code points, also known as a surrogate pair.<br>Try </em><em>&quot;👩&quot;.length in your console and see for yourself. More information in </em><a href="https://thekevinscott.com/emojis-in-javascript/"><em>this article</em></a><em>.</em></p><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter"><em>MDN</em></a></p><h3>7. Array.flat()</h3><p>Creates a new array containing all elements from all sub-arrays up to a given depth. Or cracks any safe.</p><pre>const savings = [&quot;💵&quot;, [&quot;💵&quot;, &quot;💵&quot;], [&quot;💵&quot;, &quot;💵&quot;], [[[&quot;💰&quot;]]]];<br>const loot    = savings.flat(3)<br>// console.log(loot);<br>// [&quot;💵&quot;, &quot;💵&quot;, &quot;💵&quot;, &quot;💵&quot;, &quot;💵&quot;, &quot;💰&quot;];</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/flat"><em>MDN</em></a></p><h3>8. Array.includes()</h3><p>Checks if an array contains a specific element. Or finds the secret sweet tooth.</p><pre>const food   = [&quot;🥦&quot;, &quot;🥬&quot;, &quot;🍅&quot;, &quot;🥒&quot;, &quot;🍩&quot;, &quot;🥕&quot;];<br>const caught = food.includes(&quot;🍩&quot;);<br>// console.log(caught);<br>// true</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/includes"><em>MDN</em></a></p><h3>9. Array.join()</h3><p>Concatenates all array elements to one single string, using an optional separator. Or builds local area networks.</p><pre>const devices = [&quot;💻&quot;, &quot;🖥️&quot;, &quot;🖥️&quot;, &quot;💻&quot;, &quot;🖨️&quot;];<br>const network = devices.join(&quot;〰️&quot;);<br>// console.log(network);<br>// &quot;💻〰️🖥️〰️🖥️〰️💻〰️🖨️&quot;</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/join"><em>MDN</em></a></p><h3>10. Array.map()</h3><p>Calls a function on each array element and returns the result as new array. Or feeds all hungry monkeys.</p><pre>const hungryMonkeys = [&quot;🐒&quot;, &quot;🦍&quot;, &quot;🦧&quot;];<br>const feededMonkeys = hungryMonkeys.map(m =&gt; m + &quot;🍌&quot;);<br>// console.log(feededMonkeys);<br>// [&quot;🐒🍌&quot;, &quot;🦍🍌&quot;, &quot;🦧🍌&quot;]</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map"><em>MDN</em></a></p><h3>11. Array.reverse()</h3><p>Reverses the order of elements in an array. Or decides the outcome of a race.</p><pre>let   rabbitWins   = [&quot;🐇&quot;, &quot;🦔&quot;];<br>const hedgehogWins = rabbitWins.reverse();<br>// console.log(hedgehogWins);<br>// [&quot;🦔&quot;, &quot;🐇&quot;]</pre><p><em>Note that this method is destructive, it modifies the original array. So after line 2 of this example </em><em>rabbitWins and </em><em>hedgehogWins both have the value</em> [&quot;🦔&quot;, &quot;🐇&quot;]</p><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse"><em>MDN</em></a></p><h3>12. Array.slice()</h3><p>Creates a new array from copying a portion of an array defined by start and end index. Or cheats in an exam.</p><pre>const solutionsOfClassmates = [&quot;📃&quot;, &quot;📑&quot;, &quot;📄&quot;, &quot;📝&quot;];<br>const myOwnSolutionReally   = solutionsOfClassmates.slice(2, 3);<br>// console.log(myOwnSolutionReally);<br>// [&quot;📄&quot;]</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/slice"><em>MDN</em></a></p><h3>13. Array.some()</h3><p>Tests if at least one element of an array passes the test. Or finds if some participants of your meeting forgot to mute their mic.</p><pre>const participants = [&quot;🔇&quot;, &quot;🔇&quot;, &quot;🔊&quot;, &quot;🔇&quot;, &quot;🔊&quot;];<br>const isLoud       = p =&gt; p === &quot;🔊&quot;;<br>const troubles     = participants.some(isLoud);<br>// console.log(troubles);<br>// true</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/some"><em>MDN</em></a></p><h3>14. Array.sort()</h3><p>Sorts all elements of an array. Or organizes your bookshelf again.</p><pre>let books = [&quot;📕&quot;, &quot;📗&quot;, &quot;📕&quot;, &quot;📒&quot;, &quot;📗&quot;, &quot;📒&quot;];<br>books.sort();<br>// console.log(books);<br>// [&quot;📒&quot;, &quot;📒&quot;, &quot;📕&quot;, &quot;📕&quot;, &quot;📗&quot;, &quot;📗&quot;]</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort"><em>MDN</em></a></p><h3>15. Array.splice()</h3><p>Removes, replaces or adds elements to an array. Or changes the weather.</p><pre>let weather = [&quot;☁️&quot;, &quot;🌧️&quot;, &quot;☁️&quot;];<br>weather.splice(1, 2, &quot;☀️&quot;);<br>// console.log(weather);<br>// [&quot;☁️&quot;, &quot;☀️&quot;]</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice"><em>MDN</em></a></p><h3>16. Array.unshift()</h3><p>Adds one or more elements to the beginning of an array. Or couples a loco.</p><pre>let train = [&quot;🚃&quot;, &quot;🚃&quot;, &quot;🚃&quot;, &quot;🚃&quot;];<br>train.unshift(&quot;🚂&quot;);<br>// console.log(train);<br>// [&quot;🚂&quot;, &quot;🚃&quot;, &quot;🚃&quot;, &quot;🚃&quot;, &quot;🚃&quot;]</pre><p><em>Documentation on </em><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift"><em>MDN</em></a></p><h3>Wrap it up</h3><p>We saw that we have quite a lot of possibilities for array processing and manipulation in JavaScript. See MDN for an overview of all <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#instance_methods">Array instance methods</a>. You want to add another nice example how to explain a JavaScript method or just want to show us your favorite emoji? Please comment below 💬⬇</p><p><em>Originally published: 25th February 2021 on </em><a href="https://dev.to/devmount/javascript-array-methods-explained-with-emojis-2amn"><em>dev.to</em></a><br><em>Title image: </em><a href="https://codepen.io/devmount/pen/oNxGpgQ"><em>https://codepen.io/devmount/pen/oNxGpgQ</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1f237f7e19d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PHP 8 features I wish also existed in JavaScript]]></title>
            <link>https://devmount.medium.com/php-8-features-i-wish-also-existed-in-javascript-a4037230a1f0?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4037230a1f0</guid>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Mon, 08 Feb 2021 12:58:17 GMT</pubDate>
            <atom:updated>2021-02-08T12:58:17.277Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8s29Mzv-AhNY7MPi42TXeQ.png" /></figure><p>I know there is still a lot of hatred for PHP out there, but in my opinion with version 7 at the latest (which is already over 5 years old!), PHP evolved to a great language that is fun and even type-safe to use. Next to <a href="https://php.watch/articles/jit-in-depth">Just-In-Time compilation</a>, which may give a big performance boost to PHP applications, version 8 brings <a href="https://www.php.net/releases/8.0/en.php">a lot of useful features</a>.</p><p>I want to present three of them I really wish I could use in JavaScript as well. I hope that comes in handy especially for those, who didn’t take a look at PHP 8 yet. Let’s go!</p><h3>#1 Named arguments</h3><p>Let’s assume, you have a function foo with 6 parameters a to f having different default values and now you want to call that function passing the argument false for the last parameter only.</p><p>PHP 8:</p><pre>foo(f: false);</pre><p>JavaScript:</p><pre>foo(&#39;test&#39;, 42, true, &#39;bar&#39;, 5.5, false);</pre><p>In JavaScript passing arguments to a function is solely based on the parameter position, unfortunately. I know that named arguments can be simulated by using objects and destructuring, but a native feature would be much more convenient here.</p><p>See <a href="https://wiki.php.net/rfc/named_params">RFC: Named Arguments</a></p><h3>#2 Match expression</h3><p>The new match expression of PHP is very similar to the switch statement, except it is an expression and can be used to directly assign values to a variable or return values. This comes in very handy, if you have more than two possible values for assignment.</p><p>PHP 8:</p><pre>$fontWeight = match ($weight) {<br>  100 =&gt; &quot;Super Thin&quot;,<br>  300 =&gt; &quot;Thin&quot;,<br>  400 =&gt; &quot;Normal&quot;,<br>  600 =&gt; &quot;Bold&quot;,<br>  900 =&gt; &quot;Heavy&quot;<br>};</pre><p>JavaScript:</p><pre>const fontWeight = &#39;&#39;;<br>switch (weight) {<br>  case 100:<br>    fontWeight = &quot;Super Thin&quot;;<br>    break;<br>  case 300:<br>    fontWeight = &quot;Thin&quot;;<br>    break;<br>  case 400:<br>    fontWeight = &quot;Normal&quot;;<br>    break;<br>  case 600:<br>    fontWeight = &quot;Bold&quot;;<br>    break;<br>  case 900:<br>    fontWeight = &quot;Heavy&quot;;<br>    break;<br>}</pre><p>The match expression may be simulated by a JavaScript object, but that would require an additional variable (thus more reserved memory) and will fail for cases, where the checked values aren&#39;t allowed to be used as object keys.</p><p>See <a href="https://www.php.net/manual/en/control-structures.match.php">Docs: </a><a href="https://www.php.net/manual/en/control-structures.match.php">match</a></p><h3>#3 Optional Chaining</h3><p>Chaining only if the needed property exists is a very elegant way to query objects. In PHP you can do this now with the nullsafe operator.</p><p>PHP 8:</p><pre>$country = $session?-&gt;user?-&gt;getAddress()?-&gt;country;</pre><p>JavaScript:</p><pre>const country =<br>  session &amp;&amp; session.user &amp;&amp; session.user.getAddress() &amp;&amp; session.user.getAddress()[&#39;country&#39;]<br>  ? session.user.getAddress()[&#39;country&#39;]<br>  : null;</pre><p>In JavaScript you still have to check step by step, if the corresponding property exists. There is a corresponding <a href="https://github.com/tc39/proposal-optional-chaining">TC39 proposal</a> which is in stage 4 by now and I’m really looking forward to this being part of the ECMAScript Specs.</p><p>See <a href="https://wiki.php.net/rfc/nullsafe_operator">RFC: Nullsafe Operator</a></p><h3>Wrap it up</h3><p>So we saw a small selection of the new PHP 8 features that would also be a great addition to JavaScript. Maybe you have other PHP features in mind that are missing in JavaScript or you know a better JavaScript counterpart to the above problems than me? Great! Let’s discuss it in the comments.</p><p><em>Originally published: 8th of February 2021 on </em><a href="https://dev.to/devmount/php-8-features-i-wish-also-existed-in-javascript-1a5"><em>dev.to</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4037230a1f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ThirdStat—Beautifully Visualized Email Account Stats]]></title>
            <link>https://devmount.medium.com/thirdstat-beautifully-visualized-email-account-stats-bac54dcfc03b?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/bac54dcfc03b</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[hacktoberfest]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[thunderbird]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Tue, 29 Sep 2020 14:35:46 GMT</pubDate>
            <atom:updated>2020-10-02T15:15:27.908Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KilkEJx7Er-bAtDZvD7z8w.png" /></figure><h3>ThirdStats — Beautifully Visualized Email Account Stats</h3><p>In <a href="https://dev.to/devmount/how-to-get-email-stats-from-thunderbird-4265">the first post of this series</a> I told you the background story why I built a tool that’s able to show some email analytics in the Mozilla Thunderbird email client. After using this tool for a year now, I’ve determined three major issues:</p><p>❌ It depends on the mail storage engine<br>❌ The stats creation process is a little too complex<br>❌ The stats page cannot be accessed directly from Thunderbird</p><h3>What I did</h3><p>To address all of these issues, I decided to create a native Thunderbird add-on with the same functionality. Well, I never built a Thunderbird add-on before, so I took a look into the Thunderbird documentation. It turned out, that thanks to <a href="https://thunderbird-webextensions.readthedocs.io/en/latest/index.html">Thunderbirds WebExtension APIs</a>, I was able to reuse nearly all of my Vue.js code — nice! I spent a weekend of porting my code and creating <strong>ThirdStats</strong>:</p><p><a href="https://github.com/devmount/third-stats">devmount/third-stats</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*9Ynq21mKkQAENXtS.png" /><figcaption>A screenshot showing ThirdStats on the Thunderbird default dark theme on Windows</figcaption></figure><h3>What you can do</h3><p>This is actually the first Thunderbird 78+ add-on providing visual statistics of email accounts (at least I wasn’t able to find something similar in the repository)! So if you are interested in contributing to the large community of Thunderbird users — you are very welcome to do so! I’ve prepared the GitHub repository so it’s ripe and ready for harvest in this year’s <a href="https://hacktoberfest.digitalocean.com/">Hacktoberfest</a>.</p><h3>Add translations</h3><p>If you’re new to contributing to OSS and you want to get to know the process of creating Pull Requests first, you can just add a translation of the add-on in your native language. <strong>This is as simple as adding a single JSON file.</strong> I explained everything in the <a href="https://github.com/devmount/third-stats/blob/master/.github/CONTRIBUTING.md">Contribution Guidelines</a> and prepared <a href="https://github.com/devmount/third-stats/issues?q=is%3Aopen+is%3Aissue+no%3Aassignee+translation">some example issues</a>.</p><h3>Improve the UI</h3><p>If you’re already familiar with Vue.js app development and you have some experience in building user interfaces, you can help improving ThirdStats UI. I’ve prepared some example issues for this topic too (e.g. <a href="https://github.com/devmount/third-stats/issues/8">#8</a>, <a href="https://github.com/devmount/third-stats/issues/9">#9</a>, <a href="https://github.com/devmount/third-stats/issues/10">#10</a>). Please discuss your ideas or possible changes in the corresponding issue first before investing a lot of time for a pull request that won’t get merged for some reason.</p><h3>Add charts</h3><p>And for those of you who are looking for the real challenge, I prepared some feature requests (<a href="https://github.com/devmount/third-stats/issues/11">#11</a>, <a href="https://github.com/devmount/third-stats/issues/12">#12</a>) to implement additional charts and analytics to make this add-on even more complete. What numbers are you interested in about your mail account?</p><p>Again: Please discuss your ideas in a corresponding issue <strong>first</strong> before investing a lot of time for a pull request that won’t get merged for some reason.</p><h3>Wrap it up</h3><p>So I made my first steps contributing to the (in my opinion) best open source email client out there by creating an add-on to expand its functionality. Do you use Thunderbird? Would you use this add-on? What is missing in your opinion? Let’s discuss here in the comments or <a href="https://github.com/devmount/third-stats/issues/new/choose">directly on GitHub</a>!</p><p><em>Originally published: 29th of September 2020 on </em><a href="https://dev.to/devmount/thirdstats-beautifully-visualized-email-account-stats-eaf"><em>dev.to</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bac54dcfc03b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automatic Deployment via good ol’ FTP]]></title>
            <link>https://devmount.medium.com/automatic-deployment-via-good-ol-ftp-9eccc7fcfff1?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/9eccc7fcfff1</guid>
            <category><![CDATA[ftp]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[dev-community]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Thu, 03 Sep 2020 09:08:48 GMT</pubDate>
            <atom:updated>2020-09-03T09:08:48.342Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vHI9x_uElp09lRMLqqZd6A.png" /></figure><h4>Since their release, GitHub actions are on my long-term todo list for increasing automation of my workflows. Thanks to <a href="https://dev.to/devteam/announcing-the-github-actions-hackathon-on-dev-3ljn">DEVs GitHub Actions Hackathon</a>, I’m finally tackling this topic.</h4><p>I’m not really sure if it’s a thing to be ashamed of today, but I’m still pushing build files of most of my personal open source projects manually via good ol’ FTP to my server. Maybe I just don’t wanted to give up too much control over the files that I push to production. Or after doing web development for more than 15 years now, I was just too lazy to change something 😅</p><p>However, I found an awesome GitHub action to publish files automatically via FTP to my server on build.</p><h3>My Workflow</h3><p>It’s the <a href="https://github.com/SamKirkland/FTP-Deploy-Action">FTP-Deploy-Action</a> by Sam Kirkland which utilizes <a href="https://github.com/git-ftp/git-ftp">Git-ftp</a>. I’m mostly creating Vue.js applications with the Vue CLI — so my normal workflow always looked like this:</p><ol><li>➕ Make code changes (e.g. fixing an important security issue)</li><li>🔨 Test code changes</li><li>✅ Commit these changes to the repository</li><li>🔁 Create new build files optimized for production using vue-cli-service build</li><li>❌ Delete old build files from production server</li><li>⏫ Upload new build files to production server</li></ol><p>Especially the last two points always bothered me, because most of the time I was pushing some smaller changes that only affected a few files and I still deleted and reuploaded the whole application. And this is, where Git-ftp really pays off: It can upload only those files, that changed since the last upload! This is extremely useful, especially for projects with a lot of files. A few of my PHP projects e.g. use Git Submodules and uploading the whole project on each build would take an incredible amount of time. So my new workflow now looks like this:</p><ol><li>➕ Make code changes (e.g. fixing an important security issue)</li><li>🔨 Test code changes</li><li>✅ Commit these changes to the repository</li><li>🔁 Create new build files optimized for production using vue-cli-service build</li><li>Lean back and let the GitHub FTP-Deploy-Action do the rest</li></ol><h3>Configuration</h3><p>So, how can you set up this FTP-Deploy-Action? You simply have to create a configuration file called ftp-deploy.yaml under your-repo/.github/workflows/. This is what my configuration looks like:</p><pre>on:<br>  push:<br>    paths:<br>      - &#39;dist/*&#39;<br>name: FTP Deploy<br>jobs:<br>  FTP-Deploy-Action:<br>    name: FTP-Deploy-Action<br>    runs-on: ubuntu-latest<br>    steps:<br>    - uses: actions/checkout@v2.1.0<br>      with:<br>        fetch-depth: 2<br>    - name: FTP-Deploy-Action<br>      uses: SamKirkland/FTP-Deploy-Action@master<br>      with:<br>        ftp-server: ${{ secrets.ftp_server }}<br>        ftp-username: ${{ secrets.ftp_username }}<br>        ftp-password: ${{ secrets.ftp_password }}<br>        local-dir: dist/</pre><p>I’m going to explain every part in the following for you to understand, how this works 💡</p><p><strong>Lines 1–4 </strong><strong>on: push: paths:</strong><br>Only start this action, when changes where pushed to the `dist/` directory (this is the default build folder for Vue CLI)<br><strong>Line 5 </strong><strong>name:</strong><br>The name of your GitHub action which is shown in the repositories action tab on GitHub.<br><strong>Lines 6—15 </strong><strong>jobs: FTP-Deploy-Action: ...</strong><br>This is the default configuration for this action, accourding to its documentation.<br><strong>Line 16 </strong><strong>with:</strong><br>This section allows for further required or optional configuration of the action. <br><strong>Lines 17—19 </strong><strong>ftp-server: | ftp-username: | ftp-password:</strong><br>Obviously GitHub needs to know your FTP access data like server url, username and password. Even more obviously, you don&#39;t want to store these data in this configuration file rather than as encrypted secrets.<br><strong>Line 20 </strong><strong>local-dir:</strong><br>This makes sure, that not the whole repository, but only (in my case) the dist/ directory gets uploaded, where my build files live.</p><p><strong>Bonus</strong>: If you want to explicitly exclude some files from being uploaded, you can create a .git-ftp-ignore file in the root of your repository, which works the same way as a .gitignore file.</p><h3>Additional Resources / Info</h3><ul><li><a href="https://github.com/SamKirkland/FTP-Deploy-Action">SamKirkland/FTP-Deploy-Action</a></li><li><a href="https://github.com/git-ftp/git-ftp">git-ftp/git-ftp</a></li></ul><h3>Wrap it up</h3><p>So we saw that it’s fairly simple to let GitHub deploy you build files automatically via FTP. You just need to create one configuration file and set a few repository secrets.</p><p>Let me know, if you also deploy via FTP and this is useful for your own workflows.</p><p><em>Published: 3rd September 2020 on </em><a href="https://dev.to/devmount/automatic-deployment-via-good-ol-ftp-3044"><em>dev.to</em></a><br><em>Title image: </em><a href="https://codepen.io/devmount/full/qBZPpEM"><em>https://codepen.io/devmount/full/qBZPpEM</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9eccc7fcfff1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 Awesome Pythonic One-Liners Explained]]></title>
            <link>https://devmount.medium.com/10-awesome-pythonic-one-liners-explained-7466cf2fdb55?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/7466cf2fdb55</guid>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[one-line]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Wed, 29 Jul 2020 11:40:30 GMT</pubDate>
            <atom:updated>2020-07-29T11:40:30.354Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D998Mh5doWKeQHvhSeH6hw.png" /></figure><p>Since I wrote my first lines of code in Python, I was fascinated by its simplicity, excellent readability and its popular one-liners in particular. In the following, I want to present and explain some of these one-liners — maybe there are a few you didn’t already know and are useful for your next Python project.</p><h3>1. Swap two variables</h3><pre># a = 1; b = 2<br>a, b = b, a<br># print(a,b) &gt;&gt; 2 1</pre><p>Let’s start with a classic: swapping the values of variables by simply swapping positions on assignment — the most intuitive way in my opinion. No need to use a temporary variable. It even works with more than two variables.</p><h3>2. Multiple variable assignment</h3><pre>a, b, *c = [1,2,3,4,5]<br># print(a,b,c) &gt;&gt; 1 2 [3, 4, 5]</pre><p>Swapping variables is actually a special case of Pythons ability to assign multiple variables at once. Here you can use it to assign <a href="https://docs.python.org/3/tutorial/datastructures.html">list</a> elements to the given variables, which is also called <em>unpacking</em>. The * will do packing the remaining values again, which results in a sublist for c. It even works for every other position of * (e.g. the beginning or middle part of the list).</p><h3>3. Sum over every second element of a list</h3><pre># a = [1,2,3,4,5,6]<br>s = sum(a[1::2])<br># print(s) &gt;&gt; 12</pre><p>No need for a special reduce function here, <a href="https://docs.python.org/3/library/functions.html#sum">sum</a> just adds the items of every given iterable. The <a href="https://docs.python.org/3/whatsnew/2.3.html#extended-slices">extended slicing syntax</a> [::] is used here to return every second element. You can read it as <em>[start : stop : step]</em>, so [1::2] translates to <em>start with the element of index 1 (second element), don&#39;t stop until the list ends (no argument given for second parameter) and always take 2 steps</em>.</p><h3>4. Delete multiple elements</h3><pre># a = [1,2,3,4,5]<br>del a[::2]<br># print(a) &gt;&gt; [2, 4]</pre><p>The extended slicing syntax can also be used to delete multiple list elements at once.</p><h3>5. Read file into array of lines</h3><pre>c = [line.strip() for line in open(&#39;file.txt&#39;)]<br># print(c) &gt;&gt; [&#39;test1&#39;, &#39;test2&#39;, &#39;test3&#39;, &#39;test4&#39;]</pre><p>With Pythons inline <a href="https://docs.python.org/3/tutorial/controlflow.html#for-statements">for loop</a> you can easily read a file into an array of lines. The <a href="https://docs.python.org/3/library/stdtypes.html#str.strip">strip()</a> is needed to remove the trailing line breaks. If you want to keep them or they don&#39;t matter to you, you can use an even shorter one-liner:</p><pre>c = list(open(&#39;file.txt&#39;))<br># print(c) &gt;&gt; [&#39;test1\n&#39;, &#39;test2\n&#39;, &#39;test3\n&#39;, &#39;test4\n&#39;]</pre><p>It’s really that simple to read a file in Python. Side note: you can also use the <a href="https://docs.python.org/3/library/io.html#io.IOBase.readlines">readlines()</a> method if you like.</p><h3>6. Write string to file</h3><pre>with open(&#39;file.txt&#39;, &#39;a&#39;) as f: f.write(&#39;hello world&#39;)<br># print(list(open(&#39;file.txt&#39;))) &gt;&gt; [&#39;test1\n&#39;, &#39;test2\n&#39;, &#39;test3\n&#39;, &#39;test4\n&#39;, &#39;hello world&#39;]</pre><p>With the help of the with statement, you can directly write content to a file. Make sure to use the correct <a href="https://docs.python.org/3/library/io.html#raw-file-i-o">mode</a> to open the file (here &#39;a&#39; for <strong>a</strong>ppending content).</p><h3>7. List creation</h3><pre>l = [(&#39;Hi &#39;​ + x) ​for​ x ​in​ [​&#39;Alice&#39;​, ​&#39;Bob&#39;​, ​&#39;Pete&#39;​]]<br># print(l) &gt;&gt; [&#39;Hi Alice&#39;, &#39;Hi Bob&#39;, &#39;Hi Pete&#39;]</pre><p>Lists can be dynamically created from other lists with the inline for loop. You can directly modify the values, like string concatenation in this example.</p><h3>8. List mapping</h3><pre>l = list(map(int, [&#39;1&#39;, &#39;2&#39;, &#39;3&#39;]))<br># print(l) &gt;&gt; [1, 2, 3]</pre><p>You can also use Pythons map() function to cast every list element to another type.</p><h3>9. Set creation</h3><pre>squares = { x**2 for x in range(6) if x &lt; 4 }<br># print(squares) &gt;&gt; {0, 1, 4, 9}</pre><p>It’s similar with <a href="https://docs.python.org/3/tutorial/datastructures.html#sets">sets</a>. In addition to the inline for loop, you can even directly append a condition!</p><h3>10. Palindrome check</h3><pre># phrase = &#39;deleveled&#39;<br>isPalindrome = phrase == phrase[::-1]<br># print(isPalindrome) &gt;&gt; true</pre><p>A palindrome is a series of characters that read the same both forwards and backwards. Normally you would need some looping and conditions to check, if a given string is a palindrome. In Python, you just compare the string with its reverse string. Instead of using the slicing operator [::-1], you can also use the reverse() function to reverse the string.</p><h3>Bonus: The Zen of Python</h3><pre>import this</pre><p>Well, this one needs no explanation. Just try it yourself by simply entering it in your Python shell 😊🎉</p><h3>Wrap it up</h3><p>We’ve seen some (admittedly simple) examples of Python one-liners, that are powerful and well readable at the same time. Maybe you know another helpful one-liner? Share it with us in the comments!</p><p><em>Published: 29th July 2020 on </em><a href="https://dev.to/devmount/10-awesome-pythonic-one-liners-explained-3doc"><em>dev.to</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7466cf2fdb55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some Emmet Magic Frontend Devs should know]]></title>
            <link>https://devmount.medium.com/some-emmet-magic-frontend-devs-should-know-291ec86ab39e?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/291ec86ab39e</guid>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[markup]]></category>
            <category><![CDATA[emmet]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Mon, 20 Jul 2020 13:36:39 GMT</pubDate>
            <atom:updated>2020-07-20T13:36:39.755Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QrnxIEMg-GBYMYbnVCujLQ.png" /></figure><h4>I would like to share some examples of useful Emmet commands that heavily speed up my markup creation — and maybe yours too.</h4><p>If you haven’t heard of Emmet before, see this <a href="https://dev.to/lalawuhan/emmet-love-4be5">awesome introduction to Emmet</a> by <a href="https://dev.to/thabisegoe">Thabi</a>. Emmet is integrated in most code editors by default, so maybe you’re using it right now without knowing it’s Emmet under the hood 😅. In VS Code e.g. you just have to type the Emmet abbreviation and hit TAB to create the markup.</p><h3>Document creation</h3><pre>doc</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*xdMCJIRhnJMefqbl.gif" /></figure><p>No need to write the whole doctype yourself. Each HTML file can be kickstarted by simply typing doc and hit TAB.</p><h3>Table creation</h3><pre>table&gt;#row$*3&gt;[colspan=2]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*zOY0g-R-R3i6PiHy.gif" /></figure><p>Emmet inserts implicit tag names here (such as tr and td) and you can simply multiply elements and apply the current iteration number to e.g. the elements id with the $ sign.</p><h3>Form creation</h3><pre>form:post&gt;(select&gt;opt[value=$]{#$$}*4)+btn:s</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*DLR5KEKHdBQN_2SK.gif" /></figure><p>There are also a lot of aliases, that massively reduces the number of characters you have to type, e.g. btn:s instead of button[type=submit]. Also you can force leading Zeros with multiple $ signs.</p><h3>Generic content</h3><pre>ul.generic&gt;lorem6.item*5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*3mUODAPWxCNdRT1c.gif" /></figure><p>In case you just create HTML layout demos, the lorem abbreviation comes in very handy, followed by the number of words the sentence should consist of.</p><h3>Bonus: Abbreviation Wrap in VS Code</h3><p>If you’re changing existing markup rather than creating it from scratch (which is probably almost always the case), you can make use of VS Code’s command <em>Emmet: Wrap with Abbreviation</em>. Here you can select some content and wrap it with the desired tags by using Emmet Syntax:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/0*OTqLBlznvf5GcBdC.gif" /></figure><p>Plus: Setting a keyboard shortcut for this feature saves a lot of time! On my Windows machine, I configured CTRL+ALT+E</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*V8ZOVqrpROICewFj.png" /></figure><h3>Wrap it up</h3><p>We’ve seen, that there are a lot of abbreviations that speed up the process of creating markup. This is especially useful, when you’re creating a lot of markup by hand.</p><p>Check the <a href="https://docs.emmet.io/cheat-sheet/">Emmet Cheat Sheet</a> if you want to learn more. Happy coding!</p><p><em>Published: 20th July 2020 on </em><a href="https://dev.to/devmount/some-emmet-magic-frontend-devs-should-know-2p2o"><em>dev.to</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=291ec86ab39e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You Can Quit! …with the help of Vue and Dexie]]></title>
            <link>https://devmount.medium.com/you-can-quit-2574f7159125?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/2574f7159125</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[web-app-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[dexie]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Mon, 27 Apr 2020 13:22:39 GMT</pubDate>
            <atom:updated>2020-04-27T13:22:39.611Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OBYM-1X7Jpx6gVER9GWxng.png" /></figure><h3>You Can Quit! …with the help of Vue and Dexie</h3><p>I humbly assume that every single one of us has a bad habit we want to get rid of. At least I have those habits 😅. Be it committing untested code, coding without proper documentation, just copying-and-pasting code or not even programming or computer related things like spending too less time with family or friends, blaming others for any faults instead of taking responsibility or eating too many candies 🍭🤷🏻‍♂️.</p><p>Back in July 2018 I came to a point where I really got frustrated about my inability to listen to my wife. I mean <strong>real listening</strong>. Listening without instantly forgetting what she said in the next minutes. Listening while giving her full attention. Though it’s difficult being interrupted when you’re really into something like programming, I could at least properly communicate that now is not a good time to talk instead of pretending to listen and not knowing what she said as soon as she was leaving the room. This often resulted in discussions like “I thought we talked about that” or “I asked you to do that and you didn’t”. I didn’t liked that and knew, I had to do something about it.</p><p>Like a good programmer I first analyzed the problem. The problem was, that it just happened — <strong>it became one of my habits</strong> and habits are typically difficult to break, because it’s too easy to do things as always and I’m not aware of it being a bad thing in that situation. So my problem was summarized by this one question: <strong>How to get that awareness to actually improve myself?</strong> My programmer mind instantly knew the answer: Build a tool!</p><p>That is how <a href="https://github.com/devmount/you-can-quit">you-can-quit</a> was born. A tool that aims to help the user not doing something anymore on a daily basis, by tracking the progress, provide encouraging notifications, funny achievements and the possibility for the user to recognize patterns.</p><h3>How it looks</h3><p>I host this app at <a href="https://youcanqu.it/">youcanqu.it</a>. Just drop by and play around, test or use it as you like. I decided to do the layout and styling myself and not use a CSS Framework. The following are the main sections of the app.</p><h3>Month view and actual input area</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/0*LgDzc9V1GUfaUDjp.png" /></figure><p>The month view shows the current or selected month. When hovering over a day in the past, some buttons to set the state of that day appear. You can use arrow keys to navigate between different months.</p><h3>Stats</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*7qY790PbI3ZZIW7_.png" /></figure><p>Currently the stats are just showing the current streak (number of successful days in a row until today), the longest streak and the total number of successful days.</p><h3>Achievements</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*EvVgSjAOCKmq6nhq.png" /></figure><p>I thought it would be much more fun and a lot more effective to reach various small goals on the way. So I created 18 achievements where most of them can be rewarded multiple times. The white bar at the bottom of each achievement indicates its progress. More achievements are planned, as well as a <em>score-of-success</em>, that’s calculated based on streaks and weighted achievements score.</p><h3>Year view</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*dBi6gymtBOGoS1Fw.png" /></figure><p>Here you have the possibility to find possible patterns over a longer time interval. Maybe you are more prone to failure on Mondays or a certain season in the year. You can navigate between years with STRG + arrow keys.</p><h3>Administration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*eha636oRzH09Qb91.png" /></figure><p>You can export, import or delete your data here.</p><h3>How it works</h3><p>It’s as simple as setting the past day(s) successful or failed, depending on whether you have reached your goal on that day or not. To do that, just move the cursor over one of the past days in the monthly overview and click the left or right button that appear (You can also set that day back to undecided, if you want). You can do that e.g. everyday in the morning for the past day. With every successful day, you will see your stats and achievements increase.</p><p>Under the hood, it’s a <a href="https://vuejs.org/">Vue.js</a> <a href="https://en.wikipedia.org/wiki/Single-page_application">SPA</a> using <a href="https://dexie.org/">Dexie.js</a> to store the data via your browsers <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">Indexed Database API</a>. That means no data is leaving your machine or synchronized with a server. Privacy ✅!</p><p>If you want to know more details, check out <a href="https://github.com/devmount/you-can-quit">the project repository</a>.</p><p>You are very welcome to support this Github project by staring it ⭐, creating issues 🐛 or pull request 🏗. Maybe you have ideas for additional achievements or you want to translate this tool into your own language? See <a href="https://github.com/devmount/you-can-quit/blob/master/.github/CONTRIBUTING.md">these guidelines</a> if you’d like to contribute 💚</p><h3>Final words</h3><p>I really hope this project is as useful for some of you as it is for myself. I’m still in the process of improving my communication skills, but it helped me to literally see my progress and success. I always love to build something while knowing, that people are actually using it and it really helps them! That’s what Open Source is about, isn’t it?</p><p>Don’t hesitate to share your story of a bad habit in the comments. I’m sure we can all help each other to become a little bit better every day!</p><p>DEV-community-🤗! Keep it up, you are awesome.</p><p><em>Published: 27th April 2020 on </em><a href="https://dev.to/devmount/you-can-quit-with-the-help-of-vue-and-dexie-221i"><em>dev.to</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2574f7159125" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[4 PHP Tricks to Boost Script Performance]]></title>
            <link>https://devmount.medium.com/4-php-tricks-to-boost-script-performance-d2e73b84fca6?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2e73b84fca6</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Tue, 14 Apr 2020 12:37:09 GMT</pubDate>
            <atom:updated>2021-11-01T09:56:32.887Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sh9U2EjsStas7RaI4HO9Dw.png" /></figure><h4>Normally I write code by using the conventional, obvious PHP functions to solve corresponding problems. But for some of these problems I came across alternative solutions that especially increase performance.</h4><p>In this article I want to present some of these alternatives. This is useful, if you’re searching for possibilities to decrease execution time even more in production. Let’s see, which PHP methods might be replaced by a more performant approach and if there is any cost or trade-off.</p><p>ℹ <em>All these methods were tested with PHP 7.4 on a local web server</em></p><h3>1. Removing duplicates</h3><p>You have a large array with duplicates and want to remove them to only have an array with unique values only.</p><h3>🐌 Conventional</h3><pre>array_unique($array);</pre><h3>⚡ Alternative</h3><pre>array_keys(array_flip($array));</pre><h3>⏲ Performance</h3><p>I created an array with more than 4 million elements having more than 3 million duplicates. Here is the top result:</p><p>method: array_unique <br>execution time: 787.31 ms</p><p>method: array_keys array_flip <br>execution time: <strong>434.03 ms</strong></p><p>The alternative approach is <strong>1.8x</strong> (44.87%) faster in this measurement. On average, it was ~1.5x (30%) faster. Trade-off: This is only applicable for simple, one-dimensional arrays since array_flip replaces keys by values.</p><h3>2. Get random array element</h3><p>You have a large array and want to pick a random value from it.</p><h3>🐌 Conventional</h3><pre>array_rand($array);</pre><h3>⚡ Alternative</h3><pre>$array[mt_rand(0, count($array) - 1)];</pre><h3>⏲ Performance</h3><p>I created an array with 5 million elements. Here is the top result:</p><p>method: array_rand <br>execution time: 25.99 μs</p><p>method: mt_rand <br>execution time: <strong>0.95 μs</strong></p><p>The alternative approach is <strong>27.3x</strong> (96.33%) faster in this measurement. On average, it was ~8x (87%) faster. This result is particularly surprising, as mt_rand is the implementation of the Mersenne Twister Random Number Generator and since PHP 7.1, the internal randomization algorithm <a href="https://www.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.rand-srand-aliases">has been changed</a> to use exactly that same algorithm.</p><h3>3. Test for alphanumeric characters</h3><p>You have a string and want to test, if it only contains alphanumeric characters.</p><h3>🐌 Conventional</h3><pre>preg_match(&#39;/[a-zA-Z0-9]+/&#39;, $string);</pre><h3>⚡ Alternative</h3><pre>ctype_alnum($string);</pre><h3>⏲ Performance</h3><p>I created an array with more than 100k alphanumeric and non-alphanumeric strings. Here is the top result:</p><p>method: preg_match <br>execution time: 15.39 ms</p><p>method: ctype_alnum <br>execution time: <strong>2.06 ms</strong></p><p>The alternative approach is <strong>7.5x</strong> (86.59%) faster in this measurement. On average, it was ~4x (76%) faster.</p><p>The same can be applied to ctype_alpha() (check for alphabetic characters) and ctype_digit() (check for numeric characters).</p><h3>4. Replace substrings</h3><p>You have a string and want to replace a part of it by another substring.</p><h3>🐌 Conventional</h3><pre>str_replace(&#39;a&#39;, &#39;b&#39;, $string);</pre><h3>⚡ Alternative</h3><pre>strtr($string, &#39;a&#39;, &#39;b&#39;);</pre><h3>⏲ Performance</h3><p>I created an array with 5 million random strings. Here is the top result:</p><p>method: str_replace <br>execution time: 676.59 ms</p><p>method: strtr <br>execution time: <strong>305.59 ms</strong></p><p>The alternative approach is <strong>2.2x</strong> (54.83%) faster in this measurement. On average, it was ~2x (51%) faster.</p><h3>Additional performance improvements</h3><p>Here are some additional points I integrated into my coding convention that I found to improve perfomance slightly (if applicable):</p><ul><li>Prefer JSON over XML</li><li>Declare variables before, not in every iteration of the loop</li><li>Avoid function calls in the loop header (in for ($i=0; $i&lt;count($array); $i) the count() gets called in every iteration)</li><li>Unset memory consuming variables</li><li>Prefer switch statement over multiple if statements</li><li>Prefer require/include over require_once/include_once (ensure proper opcode caching)</li></ul><p>Some final words: I know the discussion about premature optimization. And I agree that performance in production is depending on bottlenecks like database queries which should be focused on when dealing with performance. But I think, if there are alternatives that are faster and e.g. in case of regex easier to handle and maintain, why not using them?</p><h3>Wrap it up</h3><p>We’ve seen, that even with the current PHP 7.4 (which is already a lot faster than previous PHP versions) there are possibilities to boost script performance with alternative approaches even more. If you want to verify the figures presented in this article yourself, I created <a href="https://github.com/devmount/faster-php">a repository with all tests</a>.</p><p>I used <a href="https://github.com/bvanhoekelen/performance">this great tool</a> by Bart van Hoekelen to measure execution time.</p><p>Please don’t hesitate to comment here or <a href="https://github.com/devmount/faster-php/issues/new">create an issue</a>/PR at the repo above if you know additional ways to improve performance of certain PHP functions.</p><p><em>Originally published: 14th April 2020 on </em><a href="https://dev.to/devmount/4-php-tricks-to-boost-script-performance-ol1"><em>DEV.to</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2e73b84fca6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A CheatSheet of 128 CheatSheets for Developers]]></title>
            <link>https://devmount.medium.com/a-cheatsheet-of-128-cheatsheets-for-developers-ff706a171931?source=rss-c4d570089846------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff706a171931</guid>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Andreas Müller]]></dc:creator>
            <pubDate>Tue, 25 Feb 2020 15:09:32 GMT</pubDate>
            <atom:updated>2020-02-25T15:09:32.163Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HF0ppBgAM7ztpAG4kGFJwQ.png" /></figure><h4>I compiled a list of the (in my opinion) best Cheatsheets and tutorials for some of the top languages, frameworks and tools out there. I considered clarity, interactivity and simplicity for beginners. Lets go!</h4><h3>General</h3><h4>Awesome</h4><p>001 <a href="https://github.com/topics/awesome">https://github.com/topics/awesome</a><br>002 <a href="https://github.com/detailyang/awesome-cheatsheet">https://github.com/detailyang/awesome-cheatsheet</a></p><h4>Tech interview</h4><p>003 <a href="https://yangshun.github.io/tech-interview-handbook/cheatsheet/">https://yangshun.github.io/tech-interview-handbook/cheatsheet/</a><br>004 <a href="https://github.com/TSiege/Tech-Interview-Cheat-Sheet">https://github.com/TSiege/Tech-Interview-Cheat-Sheet</a><br>005 <a href="https://dev.to/elliot/my-google-technical-interview-cheat-sheet-1lbd">https://dev.to/elliot/my-google-technical-interview-cheat-sheet-1lbd</a></p><h4>Complexity</h4><p>006 <a href="https://www.bigocheatsheet.com/">https://www.bigocheatsheet.com/</a><br>007 <a href="http://cooervo.github.io/Algorithms-DataStructures-BigONotation/">http://cooervo.github.io/Algorithms-DataStructures-BigONotation/</a></p><h4>SEO</h4><p>008 <a href="https://dev.to/pagely/seo-cheat-sheet-for-devs-5h1g">https://dev.to/pagely/seo-cheat-sheet-for-devs-5h1g</a></p><h3>Programming, Scripting and Query Languages</h3><h4>C</h4><p>009 <a href="https://developerinsider.co/c-programming-language-cheat-sheet/">https://developerinsider.co/c-programming-language-cheat-sheet/</a></p><h4>C++</h4><p>010 <a href="https://www.educba.com/c-programming-language-basics/">https://www.educba.com/c-programming-language-basics/</a></p><h4>Go</h4><p>011 <a href="https://github.com/a8m/golang-cheat-sheet">https://github.com/a8m/golang-cheat-sheet</a><br>012 <a href="https://devhints.io/go">https://devhints.io/go</a><br>013 <a href="https://dev.to/codehakase/how-i-learned-go-programming">https://dev.to/codehakase/how-i-learned-go-programming</a></p><h4>GraphQL</h4><p>014 <a href="https://devhints.io/graphql">https://devhints.io/graphql</a><br>015 <a href="https://raw.githubusercontent.com/sogko/graphql-shorthand-notation-cheat-sheet/master/graphql-shorthand-notation-cheat-sheet.png">https://raw.githubusercontent.com/sogko/graphql-shorthand-notation-cheat-sheet/master/graphql-shorthand-notation-cheat-sheet.png</a><br>016 <a href="https://dev.to/methodcoder/graphql-crash-course-in-10-pics-3b04">https://dev.to/methodcoder/graphql-crash-course-in-10-pics-3b04</a></p><h4>Java</h4><p>017 <a href="https://overapi.com/java">https://overapi.com/java</a><br>018 <a href="https://cheatography.com/son9912/cheat-sheets/java-oop-concept/">https://cheatography.com/son9912/cheat-sheets/java-oop-concept/</a><br>019 <a href="https://www.educba.com/category/software-development/software-development-tutorials/java-tutorial/">https://www.educba.com/category/software-development/software-development-tutorials/java-tutorial/</a><br>020 <a href="https://dev.to/monknomo/java-8-stream-cheatsheet--oad">https://dev.to/monknomo/java-8-stream-cheatsheet--oad</a></p><h4>JavaScript, ES2015+</h4><p>021 <a href="http://www.developer-cheatsheets.com/es6">http://www.developer-cheatsheets.com/es6</a><br>022 <a href="https://htmlcheatsheet.com/js/">https://htmlcheatsheet.com/js/</a><br>023 <a href="https://devhints.io/es6">https://devhints.io/es6</a><br>024 <a href="https://overapi.com/javascript">https://overapi.com/javascript</a><br>025 <a href="https://dev.to/samanthaming/javascript-module-cheatsheet-5b4o">https://dev.to/samanthaming/javascript-module-cheatsheet-5b4o</a><br>026 <a href="https://dev.to/samanthaming/es6-arrow-functions-cheatsheet-1cn">https://dev.to/samanthaming/es6-arrow-functions-cheatsheet-1cn</a></p><h4>PHP</h4><p>027 <a href="https://overapi.com/php">https://overapi.com/php</a><br>028 <a href="https://phpcheatsheets.com/">https://phpcheatsheets.com/</a><br>029 <a href="https://dev.to/biros/awesome-php-resources-on-dev----3a18">https://dev.to/biros/awesome-php-resources-on-dev----3a18</a></p><h4>Python</h4><p>030 <a href="https://devhints.io/python">https://devhints.io/python</a><br>031 <a href="https://overapi.com/python">https://overapi.com/python</a><br>032 <a href="https://www.pythoncheatsheet.org/">https://www.pythoncheatsheet.org</a><br>033 <a href="https://dev.to/codingsafari/python-cheat-sheet-for-javascripters-2c4m">https://dev.to/codingsafari/python-cheat-sheet-for-javascripters-2c4m</a></p><h4>Regex</h4><p>034 <a href="https://www.debuggex.com/cheatsheet/regex/javascript">https://www.debuggex.com/cheatsheet/regex/javascript</a><br>035 <a href="https://devhints.io/regexp">https://devhints.io/regexp</a><br>036 <a href="https://overapi.com/regex">https://overapi.com/regex</a><br>037 <a href="https://dev.to/emmabostian/regex-cheat-sheet-2j2a">https://dev.to/emmabostian/regex-cheat-sheet-2j2a</a><br>038 <a href="https://dev.to/catherinecodes/a-regex-cheatsheet-for-all-those-regex-haters-and-lovers--2cj1">https://dev.to/catherinecodes/a-regex-cheatsheet-for-all-those-regex-haters-and-lovers--2cj1</a></p><h4>Ruby</h4><p>039 <a href="https://overapi.com/ruby">https://overapi.com/ruby</a><br>040 <a href="https://dev.to/teekay/idiomatic-ruby-writing-beautiful-code-56ef">https://dev.to/teekay/idiomatic-ruby-writing-beautiful-code-56ef</a><br>041 <a href="https://dev.to/philnash/top-10-errors-from-1000-ruby-on-rails-projects-and-how-to-avoid-them-24m">https://dev.to/philnash/top-10-errors-from-1000-ruby-on-rails-projects-and-how-to-avoid-them-24m</a></p><h4>SQL, MySQL</h4><p>042 <a href="https://devhints.io/mysql">https://devhints.io/mysql</a><br>043 <a href="https://overapi.com/mysql">https://overapi.com/mysql</a></p><h4>TypeScript</h4><p>044 <a href="https://learnxinyminutes.com/docs/typescript/">https://learnxinyminutes.com/docs/typescript/</a><br>045 <a href="https://devhints.io/typescript">https://devhints.io/typescript</a></p><h3>Frameworks, libraries and their extensions</h3><h4>Angular</h4><p>046 <a href="https://angular.io/guide/cheatsheet">https://angular.io/guide/cheatsheet</a><br>047 <a href="https://dev.to/lysofdev/an-angular-testing-cheatsheet-5hj2">https://dev.to/lysofdev/an-angular-testing-cheatsheet-5hj2</a></p><h4>jQuery</h4><p>048 <a href="https://oscarotero.com/jquery/">https://oscarotero.com/jquery/</a><br>049 <a href="https://overapi.com/jquery">https://overapi.com/jquery</a></p><h4>React</h4><p>050 <a href="http://www.developer-cheatsheets.com/react">http://www.developer-cheatsheets.com/react</a><br>051 <a href="https://devhints.io/react">https://devhints.io/react</a><br>052 <a href="https://dev.to/codeartistryio/the-react-cheatsheet-for-2020-real-world-examples-4hgg">https://dev.to/codeartistryio/the-react-cheatsheet-for-2020-real-world-examples-4hgg</a></p><h4>Redux</h4><p>053 <a href="http://www.developer-cheatsheets.com/redux">http://www.developer-cheatsheets.com/redux</a><br>054 <a href="https://devhints.io/redux">https://devhints.io/redux</a><br>055 <a href="https://github.com/linkmesrl/react-journey-2016/blob/master/resources/egghead-redux-cheat-sheet-3-2-1.pdf">https://github.com/linkmesrl/react-journey-2016/blob/master/resources/egghead-redux-cheat-sheet-3-2-1.pdf</a></p><h4>Vue.js</h4><p>056 <a href="https://marozed.ma/vue-cheatsheet/">https://marozed.ma/vue-cheatsheet/</a><br>057 <a href="https://devhints.io/vue">https://devhints.io/vue</a><br>058 <a href="https://dev.to/adnanbabakan/vue-cheat-sheet-1-194a">https://dev.to/adnanbabakan/vue-cheat-sheet-1-194a</a><br>059 <a href="https://dev.to/adnanbabakan/vue-cheat-sheet-2-5aj8">https://dev.to/adnanbabakan/vue-cheat-sheet-2-5aj8</a><br>060 <a href="https://dev.to/adnanbabakan/vue-cheat-sheet-3-advanced-4khj">https://dev.to/adnanbabakan/vue-cheat-sheet-3-advanced-4khj</a><br>061 <a href="https://dev.to/devmount/how-to-kickstart-a-vuejs-project-2mj5">https://dev.to/devmount/how-to-kickstart-a-vuejs-project-2mj5</a></p><h4>Vuex</h4><p>062 <a href="https://vuejs-tips.github.io/vuex-cheatsheet/">https://vuejs-tips.github.io/vuex-cheatsheet/</a><br>063 <a href="https://dev.to/napoleon039/when-why-and-how-to-use-vuex-9fl">https://dev.to/napoleon039/when-why-and-how-to-use-vuex-9fl</a></p><h3>Editors, IDEs and other tools</h3><h4>Atom</h4><p>064 <a href="https://devhints.io/atom">https://devhints.io/atom</a></p><h4>Bash</h4><p>065 <a href="https://devhints.io/bash">https://devhints.io/bash</a><br>066 <a href="http://johnstowers.co.nz/pages/bash-cheat-sheet.html">http://johnstowers.co.nz/pages/bash-cheat-sheet.html</a><br>067 <a href="https://dev.to/devmount/9-evil-bash-commands-explained-4k5e">https://dev.to/devmount/9-evil-bash-commands-explained-4k5e</a></p><h4>Docker</h4><p>068 <a href="https://devhints.io/docker">https://devhints.io/docker</a><br>069 <a href="https://dev.to/emarsys/the-missing-docker-cheatsheet-4dbg">https://dev.to/emarsys/the-missing-docker-cheatsheet-4dbg</a></p><h4>Git</h4><p>070 <a href="http://www.ndpsoftware.com/git-cheatsheet.html">http://www.ndpsoftware.com/git-cheatsheet.html</a><br>071 <a href="https://overapi.com/git">https://overapi.com/git</a><br>072 <a href="https://dev.to/maxpou/git-cheat-sheet-advanced-3a17">https://dev.to/maxpou/git-cheat-sheet-advanced-3a17</a><br>073 <a href="https://dev.to/duomly/git-cheatsheet-for-beginners-5apl">https://dev.to/duomly/git-cheatsheet-for-beginners-5apl</a><br>074 <a href="https://dev.to/antjanus/my-personal-git-tricks-cheatsheet-23j1">https://dev.to/antjanus/my-personal-git-tricks-cheatsheet-23j1</a><br>075 <a href="https://dev.to/hengnee/yet-another-git-cheatsheet-4gjk">https://dev.to/hengnee/yet-another-git-cheatsheet-4gjk</a><br>076 <a href="https://dev.to/devmount/how-to-correct-git-commit-messages-402d">https://dev.to/devmount/how-to-correct-git-commit-messages-402d</a><br>077 <a href="https://dev.to/devmount/signed-git-commits-in-vs-code-36do">https://dev.to/devmount/signed-git-commits-in-vs-code-36do</a></p><h4>Node.js</h4><p>078 <a href="https://devhints.io/nodejs">https://devhints.io/nodejs</a><br>079 <a href="https://overapi.com/nodejs">https://overapi.com/nodejs</a><br>080 <a href="https://dev.to/santypk4/bulletproof-node-js-project-architecture-4epf">https://dev.to/santypk4/bulletproof-node-js-project-architecture-4epf</a><br>081 <a href="https://dev.to/jorge_rockr/everything-you-need-to-know-about-node-js-lnc">https://dev.to/jorge_rockr/everything-you-need-to-know-about-node-js-lnc</a></p><h4>Sublime Text</h4><p>082 <a href="https://devhints.io/sublime-text">https://devhints.io/sublime-text</a><br>083 <a href="https://shortcuts.design/toolspage-sublimetext.html">https://shortcuts.design/toolspage-sublimetext.html</a></p><h4>Vim</h4><p>084 <a href="https://vim.rtorr.com/">https://vim.rtorr.com/</a><br>085 <a href="https://devhints.io/vim">https://devhints.io/vim</a><br>086 <a href="https://sheet.shiar.nl/vi">https://sheet.shiar.nl/vi</a></p><h4>Visual Studio Code</h4><p>087 <a href="https://devhints.io/vscode">https://devhints.io/vscode</a><br>088 <a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf">https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf</a><br>089 <a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf">https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf</a><br>090 <a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf">https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf</a><br>091 <a href="https://dev.to/devmount/23-lesser-known-vs-code-shortcuts-as-gif-80">https://dev.to/devmount/23-lesser-known-vs-code-shortcuts-as-gif-80</a></p><h3>Markup and Styling</h3><h4>CSS, CSS3, Flexbox</h4><p>092 <a href="https://htmlcheatsheet.com/css/">https://htmlcheatsheet.com/css/</a><br>093 <a href="https://devhints.io/css">https://devhints.io/css</a><br>094 <a href="http://overapi.com/css">http://overapi.com/css</a><br>095 <a href="https://yoksel.github.io/flex-cheatsheet/">https://yoksel.github.io/flex-cheatsheet/</a><br>096 <a href="https://dev.to/proticm/css-variables-cheat-sheet-32id">https://dev.to/proticm/css-variables-cheat-sheet-32id</a><br>097 <a href="https://dev.to/iggredible/css-selectors-cheatsheet-24bh">https://dev.to/iggredible/css-selectors-cheatsheet-24bh</a><br>098 <a href="https://dev.to/devmount/learn-css-animation-by-creating-pure-css-loaders-3lm6">https://dev.to/devmount/learn-css-animation-by-creating-pure-css-loaders-3lm6</a><br>099 <a href="https://dev.to/devmount/8-games-to-learn-css-the-fun-way-4e0f">https://dev.to/devmount/8-games-to-learn-css-the-fun-way-4e0f</a></p><h4>Emmet</h4><p>100 <a href="https://docs.emmet.io/cheat-sheet/">https://docs.emmet.io/cheat-sheet/</a><br>101 <a href="https://devhints.io/emmet">https://devhints.io/emmet</a><br>102 <a href="https://dev.to/lalawuhan/emmet-love-4be5">https://dev.to/lalawuhan/emmet-love-4be5</a></p><h4>HTML, HTML5</h4><p>103 <a href="https://htmlcheatsheet.com/">https://htmlcheatsheet.com/</a><br>104 <a href="https://devhints.io/html">https://devhints.io/html</a><br>105 <a href="http://overapi.com/html">http://overapi.com/html</a></p><h4>JSON</h4><p>106 <a href="https://cheatography.com/mackan90096/cheat-sheets/json/">https://cheatography.com/mackan90096/cheat-sheets/json/</a></p><h4>LaTeX</h4><p>107 <a href="https://wch.github.io/latexsheet/">https://wch.github.io/latexsheet/</a><br>108 <a href="https://dev.to/nickymarino/lets-use-latex">https://dev.to/nickymarino/lets-use-latex</a></p><h4>Markdown</h4><p>109 <a href="https://www.markdownguide.org/cheat-sheet">https://www.markdownguide.org/cheat-sheet</a><br>110 <a href="https://devhints.io/markdown">https://devhints.io/markdown</a><br>111 <a href="https://dev.to/rattanakchea/markdown-cheatsheet-for-developers-2bjj">https://dev.to/rattanakchea/markdown-cheatsheet-for-developers-2bjj</a></p><h4>Pug</h4><p>112 <a href="https://devhints.io/pug">https://devhints.io/pug</a></p><h4>SASS, SCSS</h4><p>113 <a href="https://sass-cheatsheet.brunoscopelliti.com/">https://sass-cheatsheet.brunoscopelliti.com/</a><br>114 <a href="https://devhints.io/sass">https://devhints.io/sass</a><br>115 <a href="https://dev.to/finallynero/scss-cheatsheet-7g6">https://dev.to/finallynero/scss-cheatsheet-7g6</a></p><h4>Stylus</h4><p>116 <a href="https://devhints.io/stylus">https://devhints.io/stylus</a></p><h4>Xpath</h4><p>117 <a href="https://devhints.io/xpath">https://devhints.io/xpath</a></p><h4>Yaml</h4><p>118 <a href="https://lzone.de//cheat-sheet/YAML">https://lzone.de//cheat-sheet/YAML</a><br>119 <a href="https://devhints.io/yaml">https://devhints.io/yaml</a></p><h3>Platforms, web apps and code management</h3><h4>Github</h4><p>120 <a href="https://github.com/tiimgreen/github-cheat-sheet">https://github.com/tiimgreen/github-cheat-sheet</a><br>121 <a href="https://github.github.com/training-kit/downloads/github-git-cheat-sheet/">https://github.github.com/training-kit/downloads/github-git-cheat-sheet/</a></p><h4>Gitlab</h4><p>122 <a href="https://docs.gitlab.com/ee/user/markdown.html">https://docs.gitlab.com/ee/user/markdown.html</a></p><h4>Jupyter Notebook</h4><p>123 <a href="https://s3.amazonaws.com/assets.datacamp.com/blog_assets/Jupyter_Notebook_Cheat_Sheet.pdf">https://s3.amazonaws.com/assets.datacamp.com/blog_assets/Jupyter_Notebook_Cheat_Sheet.pdf</a></p><h4>NPM</h4><p>124 <a href="https://devhints.io/npm">https://devhints.io/npm</a><br>125 <a href="https://guide.freecodecamp.org/developer-tools/npm-cheatsheet/">https://guide.freecodecamp.org/developer-tools/npm-cheatsheet/</a><br>126 <a href="https://dev.to/therealdanvega/creating-your-first-npm-package-2ehf">https://dev.to/therealdanvega/creating-your-first-npm-package-2ehf</a></p><h4>Yarn</h4><p>127 <a href="https://devhints.io/yarn">https://devhints.io/yarn</a><br>128 <a href="https://infinite.red/files/yarn.pdf">https://infinite.red/files/yarn.pdf</a></p><h3>Wrap it up</h3><p>Having a lot of basic information at one glance is often very useful for me, because I tend to forget the most basic things regularly 😅. As I already wrote in <a href="https://dev.to/devmount/23-lesser-known-vs-code-shortcuts-as-gif-80">one of my earlier posts</a>, I created a repository on GitHub, where I maintain this list above and collect commands I tend to forget — check it out if you want:</p><p><a href="https://github.com/devmount/CheatSheets">https://github.com/devmount/CheatSheets</a></p><p>I hope there are one or two useful links for you regarding the technologies you use. If you know other awesome cheat sheets, please comment them below and don’t hesitate to <a href="https://github.com/devmount/CheatSheets/pulls">make a PR</a> to make this list more complete.</p><p><em>Originally published: 25th February 2020 on </em><a href="https://dev.to/devmount/a-cheatsheet-of-128-cheatsheets-for-developers-f4m"><em>dev.to</em></a><em><br>Cover Image: </em><a href="https://codepen.io/devmount/full/ZEGLaKR"><em>https://codepen.io/devmount/full/ZEGLaKR</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff706a171931" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>