<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bruno Gelb</title>
    <description>The latest articles on DEV Community by Bruno Gelb (@bruno_gelb).</description>
    <link>https://dev.to/bruno_gelb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F465339%2F5cebf85b-8e35-42f2-aedb-f61527009659.png</url>
      <title>DEV Community: Bruno Gelb</title>
      <link>https://dev.to/bruno_gelb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bruno_gelb"/>
    <language>en</language>
    <item>
      <title>7 things to do in 15 minutes before your remote job interview</title>
      <dc:creator>Bruno Gelb</dc:creator>
      <pubDate>Thu, 28 Oct 2021 14:55:44 +0000</pubDate>
      <link>https://dev.to/bruno_gelb/7-things-to-do-in-15-minutes-before-your-remote-job-interview-607</link>
      <guid>https://dev.to/bruno_gelb/7-things-to-do-in-15-minutes-before-your-remote-job-interview-607</guid>
      <description>&lt;p&gt;I often see people come unprepared in one small way or another to the Zoom / Google Meet job interviews, and that could stand in a way between them and the job opportunity of their desires. So perhaps a checklist could be of help here. Here's mine, in the order of priority:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1] visit a loo&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pretty self-descriptive action point. Take your medicine preemptively if you're not in a good health.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2] soundcheck your equipment: mic, headphones, webcam&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the application for the upcoming call (Zoom / Google Meet / Skype / ..) and thoroughly check if your hardware is working correctly there. After that check, don't even breathe on your setup: no cable replugging, no operational system reboots, no nothing.&lt;/p&gt;

&lt;p&gt;This action point is important enough to even ask for a reschedule if you're discovered technical issues. Don't be afraid to do that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3] prepare a bottle of (still) water or a glass of tea&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Preferably avoid anything that looks like beer or wine (&lt;a href="https://en.wikipedia.org/wiki/Kvass"&gt;kvass&lt;/a&gt;, vine juice) or has unobvious packaging. Don't drink alcohol (even if you're tempted to use it as a stress relief tool w/o consequences since you're remote) as you'll definitely need a clear head and a distinctive speech! Sparkling soda is suboptimal due to possible burping.&lt;/p&gt;

&lt;p&gt;If you take some medication on a regular basis (cough medicine, antacids, ..), check your stash to be promptly available to you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4] find a notepad and a pencil&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Taking notes on a keyboard (especially on a mechanical one, but on a regular one as well) annoys most of the people: they assume you're not listening / you're distracting them. Pencil notes on the other hand are the whole different thing: they're nice and handy and you'd be able to do so much more with the paper (for instance, sketch during a brain teaser). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5] remove cats and people from the room&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--93c_5FXW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4h3svdov7oe6usm1jvzd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--93c_5FXW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4h3svdov7oe6usm1jvzd.jpg" alt="tzeentch" width="880" height="660"&gt;&lt;/a&gt;&lt;br&gt;
Tzeentch is trying to score some scratches from me as I type these strokes. But he's not welcome in the room when it's the interview time and neither do significant others and flatmates.&lt;/p&gt;

&lt;p&gt;If what you have is only one room, try to warn the people to be quiet for a while and ask them for a favor of watching the pets. (Make some lasagna afterwards as a gratitude!)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6] have all necessary information and tools ready on your pc&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open &amp;amp; pin cv and a job opening description ready in the browser. Get your checklist of questions to the firm / project ready. If we're talking a programming interview, keep a console with &lt;a href="https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop"&gt;repl&lt;/a&gt; ready.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7] notify the interviewer that you're ready&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Join the meeting and throw a brief email / text to the person you've spoken to. Generally that's not a requirement, but it's always nice to be as transparent and proactive as possible — as Harvey Specter said, first impressions last.&lt;/p&gt;

&lt;p&gt;Good luck!&lt;/p&gt;

</description>
      <category>interview</category>
      <category>remote</category>
      <category>zoom</category>
    </item>
    <item>
      <title>What have I learned in a month of JavaSript development as a Python developer</title>
      <dc:creator>Bruno Gelb</dc:creator>
      <pubDate>Mon, 04 Oct 2021 20:58:18 +0000</pubDate>
      <link>https://dev.to/bruno_gelb/what-have-i-learned-in-a-month-of-javasript-development-as-a-python-developer-a2e</link>
      <guid>https://dev.to/bruno_gelb/what-have-i-learned-in-a-month-of-javasript-development-as-a-python-developer-a2e</guid>
      <description>&lt;h3&gt;
  
  
  table of contents
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;intro&lt;/li&gt;
&lt;li&gt;js&lt;/li&gt;
&lt;li&gt;html&lt;/li&gt;
&lt;li&gt;css&lt;/li&gt;
&lt;li&gt;special thx to&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  intro
&lt;/h3&gt;

&lt;p&gt;For the last few years I was a python-terraform-ansible-gcp engineer. Regardless, my latest quest was to build a PoC (proof of concept) — and that's including UIUX part.&lt;/p&gt;

&lt;p&gt;Considering I was super rusty with JS / HTML / CSS (last time I've touched these Pluto was still a planet and that's sayin') this was a promising challenge from the start, but I've never anticipated how much pain I'll actually find..&lt;/p&gt;

&lt;p&gt;So I want to share some outcome thoughts with you ladies and gentlemen just to feel sane again. Oh and also to be of some help to backend developers / JS apprentices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;disclaimer:&lt;/strong&gt; These lessons-learned are not something that should be used per se for decisions in commercial projects! I'm not a professional frontend developer!&lt;/p&gt;

&lt;h3&gt;
  
  
  js
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;as a rule of thumb always aim for the native &amp;amp; modern solution. Basically yeah, this is true for most languages, however JS is the place where the profits of that are super noticeable, almost palpable. Most of the time popular JS-related questions at stackoverflow usually contain 3 types of solutions: jquery, es6/es7 and the old js. You need the es6/es7 one. You'll easily spot that one since it'd be the most laconic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;const&lt;/code&gt; -&amp;gt; &lt;code&gt;let&lt;/code&gt; -&amp;gt; &lt;code&gt;var&lt;/code&gt; (for variables and functions declaration). Which means: &lt;code&gt;const&lt;/code&gt; is the best choice, the second best thing is &lt;code&gt;let&lt;/code&gt;, making &lt;code&gt;var&lt;/code&gt; the worst.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals"&gt;template literals&lt;/a&gt; are &lt;em&gt;literally&lt;/em&gt; awesome, use them everywhere to format your strings (instead of string concatenation):&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Bruno&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Hello &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, sum of 2 and 3 is &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Hello Bruno, sum of 2 and 3 is 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;frameworks (react.js, vue.js) are actually hard. Even the ones that are in fact human-faced. You'd have to learn state, components, initialization, bundling, .. BEFORE anything will work for you. I have exceeded the time limit I was comfortable with to put on that and therefore had to drop vue.js.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;w/o framework you don't have a way to render your templates at the browser side. Which actually leads to ugly js code. I don't think I have a proper solution for that. I just left it as an ugly js code building html pieces. It works.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;beware of &lt;a href="https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/"&gt;red-blue functions&lt;/a&gt; and async code. The thing is, other languages with red-blue functions (like Python) generally allow you live in a sync world by default and (whenever you ready) you are ok to start doing some async work.&lt;br&gt;
This is not the case with JS. It's async by default, and (though there are decent reasons for that) it damages your learning curve badly. The code seems to be working properly but with the first user you'll start to get mandelbugs, lots of them — because your flow of execution is unpredictable, and that's because you have a terrible mess of a sync and an async code due to the inexplicit syntax.&lt;br&gt;
I'm confused what advice to give here, but what helped me was to carefully check where are actually async code and what pieces / in which order call it. At the end I've started to use &lt;a href="https://javascript.info/promise-chaining"&gt;chained promises&lt;/a&gt; for the async and it worked like a charm.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;please consider allocating some men-hours / women-hours in order to build &amp;amp; bundle your project. In my case in a temptation to cut corners during a small project I've decided to go w/o it and was punished multiple times. I couldn't use Sentry, Typescript, some of the linters, many libraries and widgets — because in modern world everyone simply assumes you're building &amp;amp; bundling your js, so they won't provide you with &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; way to plug-in.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;typescript is an awesome way to solve &lt;em&gt;a lot&lt;/em&gt;, but not &lt;em&gt;most of the&lt;/em&gt; js pitfalls. Reach for it early, it's totally worth it&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;while I've mentioned typescript, objects comparison / checking for null|undefined|empty string are indeed a huge pain. (Yeah turns out it wasn't just a silly pub joke Python programmers tell each other.) Don't even try to guess it. stackoverflow / mozilla docs are your only friends on this damned land&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;definitely setup an auto-formatter (in js the go-to weapon is &lt;a href="https://prettier.io/"&gt;prettier&lt;/a&gt;, and the best thing is that you could use it even without CI/CD simply &lt;a href="https://prettier.io/docs/en/precommit.html#option-3-pre-commithttpsgithubcompre-commitpre-commit"&gt;via pre-commit hook&lt;/a&gt;) and preferably also a linter (I've tried eslint, and it gave me nothing useful but a lot of false positives. Maybe the default configuration was off, no idea).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the other main danger of the js: the language silently swallows any errors and issues that'd happen during execution flow. Yes, that's exactly as bad as it sounds, because due to that fundamental design flaw you never actually know what happened and when. (Again, I know it was intentional, still it's terrible in terms of developer experience.)&lt;br&gt;
I've had some success fighting this by introducing extensive logging everywhere across my code, it looks kinda like this:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;today&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;time&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;today&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getHours&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;today&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getMinutes&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;today&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getSeconds&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;js_module&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`[&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] [&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;js_module&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] [DEBUG] &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;handleMyEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; handler invoked`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// logic&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;again, ain't pretty but it works well. The &lt;code&gt;import.meta.url&lt;/code&gt; is the chef's kiss I like: it shows you which js file actually throwed the log message.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;avoid &lt;code&gt;window.onload&lt;/code&gt; / &lt;code&gt;document.onload&lt;/code&gt; statements: they will silently override each other if you're using them in more than one file. Prefer constructions like this instead:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// your logic&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;load&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;avoid working with &lt;code&gt;localStorage&lt;/code&gt; directly. It seems friendly and handy, but that's deceptive: native js localstorage can only do strings, and (for example) it will gladly and silently accept empty array from you, but it will return empty string back on that key. Use 3rd party wrappers instead (I've chosen &lt;a href="https://github.com/tsironis/lockr"&gt;lockr&lt;/a&gt; and I'm pretty happy with it) or methods of your framework (that one is preferable if you have a framework)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;beware of caching: opposed to the backend world where nothing is cached untill you configure it to do so, in the frontend world EVERYTHING is cached by default. And that's not only static server, it's also cdn, local server, browser and so on. You'd have to spent a bit of time till you'll learn each layer and how to work with them. I'd emphasize on one though: caching of static files on redeploys. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;beware of &lt;a href="https://blog.sapegin.me/all/avoid-mutation/"&gt;mutation&lt;/a&gt;. Luckily I havn't cached one of those issues but it looks scary enough to be aware of.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;don't you ever fall into the temptation of implementing your filters like I did.&lt;br&gt;
What I did was: at each user click query all checkboxes, put all the gathered states into &lt;code&gt;localStorage&lt;/code&gt;, then just throw a &lt;code&gt;window.location.reload();&lt;/code&gt; and on each page load use &lt;code&gt;localStorage&lt;/code&gt; value to render controls. &lt;br&gt;
Turns out (surprise!) not only this logic is super bad for the page performance / user experience, but it's also unreliable as hell (data flow between localStorage and controls is unpredictable) and leads to the ocean of non-debuggable bugs.&lt;br&gt;
Instead use &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent"&gt;CustomEvents&lt;/a&gt;, separate listeners and dispatchers by js modules properly ― this specifically is how I rewrote it and it worked like a charm ever since. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  html
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;definetely start by throwing in additional meta-tag in your base template:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this'll allow users to somewhat decently access your site from mobile&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;aim really hard to NOT use &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tag for everything. There are &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; and many others. This is the important concept called &lt;a href="https://dev.to/kenbellows/stop-using-so-many-divs-an-intro-to-semantic-html-3i9i"&gt;"semantic html"&lt;/a&gt;, it's easy and it greatly helps both to read the code and to access the site (&lt;a href="https://www.a11yproject.com/"&gt;a11y&lt;/a&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;whether possible try to link your js files as modules, not as scripts. That way you'd be able to reuse code from them:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"{% static "&lt;/span&gt;&lt;span class="na"&gt;js&lt;/span&gt;&lt;span class="err"&gt;/&lt;/span&gt;&lt;span class="na"&gt;sidebar.js&lt;/span&gt;&lt;span class="err"&gt;"&lt;/span&gt; &lt;span class="err"&gt;%}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  css
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;always use classes, never ids. That's much more reliable and maintainable (for instance, it covers the case with multiple elements that carry the same purpose). Then you could access it with a selector like this:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.toggle_button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// for a class toggle_button&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;if you're assigning more than one css class to an element via literal, don't forget you have to do it in a separate class statement:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button_yellow button_toggle"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/button&amp;gt;&lt;/span&gt; // correct

&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button_yellow"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button_toggle"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/button&amp;gt;&lt;/span&gt; // wrong
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;otherwise one of the two &lt;code&gt;class=""&lt;/code&gt; instructions will silently override the other.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;assign different classes with meaningful names to elements with different purposes, don't cut corners on naming in css&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I've had moderate success by using either &lt;code&gt;display: flex;&lt;/code&gt; or &lt;code&gt;display: inline-block;&lt;/code&gt; on css rules in order to make page blocks behave, but besides that css is still some sort of weird witchcraft and deserves it's own article.&lt;br&gt;
However &lt;a href="https://wizardzines.com/zines/css/"&gt;this small educational material&lt;/a&gt; by &lt;a href="https://twitter.com/b0rk"&gt;Julia Evans&lt;/a&gt; is the best thing I could only think of on the subject.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  special thx to
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt; &lt;a href="https://twitter.com/twanttobealighi"&gt;@twanttobealighi&lt;/a&gt; for css / js / html help 💛&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
