<?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: andrewu</title>
    <description>The latest articles on DEV Community by andrewu (@andrewu).</description>
    <link>https://dev.to/andrewu</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%2F260695%2F9729f093-ba21-48d5-a278-e7c2edcb8ec1.jpg</url>
      <title>DEV Community: andrewu</title>
      <link>https://dev.to/andrewu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/andrewu"/>
    <language>en</language>
    <item>
      <title>Why Code Reviews Are Crucial For Newbies: My Story</title>
      <dc:creator>andrewu</dc:creator>
      <pubDate>Thu, 14 May 2020 20:39:05 +0000</pubDate>
      <link>https://dev.to/andrewu/why-code-reviews-are-crucial-for-newbies-my-story-2pfj</link>
      <guid>https://dev.to/andrewu/why-code-reviews-are-crucial-for-newbies-my-story-2pfj</guid>
      <description>&lt;p&gt;Coding is a lonely endeavor, especially if you're just starting out. It's hard to write code, it's even harder to seek feedback. I remember my first project in Node.js — for two months straight I looked exactly like the guy on this GIF. Only my code didn't run that smoothly. It was interrupted by constant YouTube tutorials and blog posts with 5 upvotes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PKc-p8G7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9gogawd2b5601xg2cu88.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PKc-p8G7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9gogawd2b5601xg2cu88.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I knew some basic front-end, but I needed to figure out how to set up a server, host databases on MLab and write an app, which will update visuals based on the gathered data. It was a mess.&lt;/p&gt;

&lt;p&gt;After several weeks of self loathing and distress, I've finally made it. That code look clunky, but it worked. Since it was a quick school project, I never found out what are the ways to improve it. I needed someone to review my code and give me feedback, but I was alone.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HD_PJ8Vm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8hrm4y5y1z660pln99hk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HD_PJ8Vm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8hrm4y5y1z660pln99hk.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if you google, there are tons of advice out there on getting a code review: &lt;br&gt;
🤔 &lt;code&gt;Posting your GitHub repo to Code Review Stack Exchange&lt;/code&gt;&lt;br&gt;
🤔 &lt;code&gt;Exploring subreddits like /r/critiquemycode or /r/codereview&lt;/code&gt;&lt;br&gt;
🤔 &lt;code&gt;Joining a friendly Discord Server and looking for help there&lt;/code&gt;&lt;br&gt;
🤔 &lt;code&gt;Doing pair programming while working on the same project with a friend&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Yet, it's really hard to approach someone for help and share your code if you know that your project performs like this tractor. That's why in the very beginning I've just kept silent and made crappy projects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B3xtN75e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2ldazaaknnd97j8erryu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B3xtN75e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2ldazaaknnd97j8erryu.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well, that's okay to make mistakes, but without any code review your memorize those bad patterns and it's hard to change them in future. This thought kind of stuck in my head for years, but I didn't find a solution myself. Instead I asked one of the senior students for help and received some advice on using sockets – the concept I knew nothing about, so it led to even more googling and more tutorials.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5qlZ7eV7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wf9zz72lwbqzzvmjp2xf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5qlZ7eV7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wf9zz72lwbqzzvmjp2xf.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Several years later I joined Practicum and we set up the following process for students so they can receive feedback from day one. We researched some of our pain points and wanted to address them in this concept:&lt;/p&gt;

&lt;p&gt;🚀 Students send their repos for a code review after each project &lt;br&gt;
🚀 Their GitHub account gets connected to Practicum, so after updating code students just click on a button and send their work to a reviewer immediately&lt;br&gt;
🚀 After project is reviewed line by line, a professional developer leaves comments for each student&lt;br&gt;
🚀 Students get 4 iterations of code review per project&lt;br&gt;
🚀 If students feel stuck they can ask a tutor for help or study material before sending their work for another review&lt;/p&gt;

&lt;p&gt;Looking back I'd imagine that such process would help me a lot when I was just starting out. I would avoid some frustration and didn't spend so much time watching YouTube tutorials.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What was the first time you got a code review? How would this change your learning patterns if you received it earlier?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For those who made it to the end of my rant, Practicum is &lt;a href="https://www.producthunt.com/posts/practicum-by-yandex"&gt;live on ProductHunt&lt;/a&gt; today, so feel free to stop by for more info about us and a get promo code to dive into Web Development 🙌&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Question to CTOs: Do you hire Junior Web Devs?</title>
      <dc:creator>andrewu</dc:creator>
      <pubDate>Thu, 27 Feb 2020 14:37:22 +0000</pubDate>
      <link>https://dev.to/andrewu/question-to-ctos-do-you-hire-junior-web-devs-2o9k</link>
      <guid>https://dev.to/andrewu/question-to-ctos-do-you-hire-junior-web-devs-2o9k</guid>
      <description>&lt;p&gt;Is it a thing to hire Junior Devs or most companies are looking for Mid-level folks?&lt;/p&gt;

&lt;p&gt;If you do hire Junior Devs: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What skills are you looking for?&lt;/li&gt;
&lt;li&gt;What is a no go in candidate's CV?&lt;/li&gt;
&lt;li&gt;Does your company provide training for juniors?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Super excited to hear your thoughts on that!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>career</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Make Your Own Password Generator: Step-by-Step guide 🤖</title>
      <dc:creator>andrewu</dc:creator>
      <pubDate>Wed, 04 Dec 2019 18:35:10 +0000</pubDate>
      <link>https://dev.to/andrewu/make-your-own-password-generator-step-by-step-guide-3fdc</link>
      <guid>https://dev.to/andrewu/make-your-own-password-generator-step-by-step-guide-3fdc</guid>
      <description>&lt;p&gt;Let’s say you want unique passwords for every website you use. But you don’t want to memorize all of them. Yeah, you should use a password manager. Yet, it’s always fun to build your own and learn the basics of how these things work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fsmdhr2yh83myiriduxy9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fsmdhr2yh83myiriduxy9.gif" alt="Alt Text"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;That’s where my password generator comes in.&lt;/p&gt;

&lt;h3&gt;
  
  
  Here are the specs:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;It takes in the address of a website&lt;/li&gt;
&lt;li&gt;And a couple of secret words from you&lt;/li&gt;
&lt;li&gt;Then mashes these things together and runs it all through a predictable encryption algorithm&lt;/li&gt;
&lt;li&gt;The result is a unique combination of characters and numbers that you use as a password&lt;/li&gt;
&lt;li&gt;For every address, the password will be unique, but it won’t be random.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Every time you generate a password for a specific address, you’ll get the same password. That way, if you forget your password, you can re-generate it, and it will fit. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A word of warning&lt;/strong&gt;. This algorithm is not cryptographically secure. If someone knows your secret word from step 2, they will be able to recreate your password. So it would be unwise to use these passwords in mission-critical and sensitive areas. But it’s still worth trying to develop.&lt;/p&gt;

&lt;h3&gt;
  
  
  MD5 Hashing
&lt;/h3&gt;

&lt;p&gt;At the heart of our algorithm will be the MD5 hashing engine (you see it in step 3). Hashing is an algorithm that turns text into a string of 32 characters, a kind of a digital fingerprint.&lt;/p&gt;

&lt;p&gt;For example, if you encode google.com, you’ll always get the hash &lt;code&gt;1d5920f4b44b27a802bd77c4f0536f5a&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And if your string is &lt;a href="https://google.com" rel="noopener noreferrer"&gt;https://google.com&lt;/a&gt;, your hash is always &lt;code&gt;99999ebcfdb78df077ad2727fd00969f&lt;/code&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Here is what’s important to know
&lt;/h3&gt;

&lt;p&gt;The hash (or the digital fingerprint) cannot be reverse engineered to reveal the original string (at least, not easily and not directly).&lt;/p&gt;

&lt;p&gt;Encoding the same string with MD5 will always create the same hash.&lt;/p&gt;

&lt;p&gt;So if you have a collection of possible source texts and a target hash that you want to decrypt, you can just make hashes from the source texts and compare it to the target hash. That’s a common way to crack leaked password databases. &lt;/p&gt;

&lt;p&gt;The algorithm is widely known and well-studied.&lt;/p&gt;

&lt;p&gt;No cryptography is unbreakable. MD5 hashing is not 100% secure. Nothing in life really is.&lt;/p&gt;

&lt;p&gt;One of the common methods to make MD5 more secure is adding salt. Salt is some secret word or character that is added to your encrypted string and that nobody knows about. With salt, reverse-matching pre-hashed passwords becomes much harder.&lt;/p&gt;

&lt;h3&gt;
  
  
  Here is an example
&lt;/h3&gt;

&lt;p&gt;Say, you wanted to hash the string ‘mail.google.com’. This string would always give you the hash &lt;code&gt;be5cab0695415d9363d18ad1345c73eb&lt;/code&gt;. A hacker intercepts this password without knowing where this password came from and what it means. But he wants to find out. He makes a table of possible strings, hashes them and matches the resulting hashes against your hash:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F0shv9yc8ppw6153rq4b7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F0shv9yc8ppw6153rq4b7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But what if your original string was ‘mail.google.comJacko’, where would ‘Jacko’ be the salt? In that case, your hash will be &lt;code&gt;397ea03e8e23b5b0127dffc6db629eab&lt;/code&gt;, and unless the hacker somehow guessed your salt, he’d be unable to reverse-match this hash.&lt;/p&gt;

&lt;p&gt;So it all comes down to the hacker’s knowing what your salt is and where you put it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The interface
&lt;/h3&gt;

&lt;p&gt;I’ll start with some basic interface. Create a text document in Notepad, paste this and save as HTML. If you have little understanding of what’s going on, read the comments inside:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
&amp;lt;!-- service area --&amp;gt;
&amp;lt;head&amp;gt;
 &amp;lt;title&amp;gt;Password generator&amp;lt;/title&amp;gt;
 &amp;lt;meta charset="utf-8"&amp;gt; 
 &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt; 
 &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;
 &amp;lt;!-- next line loads the MD5 hashing function --&amp;gt;
 &amp;lt;script src="https://thecode.media/wp-content/uploads/2019/05/js-md5.js"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;style type="text/css"&amp;gt;
/*Adding some basic design*/
body{ text-align: center; margin: 10; 
    font-family: Verdana, Arial, sans-serif; 
    font-size: 16px;}
input{ display: inline-block; margin: 20px auto; 
    border: 2px solid #eee; padding: 10px 20px; 
    font-family:Verdana, Arial, sans-serif; 
    font-size: 16px;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
 &amp;lt;!-- Our page will be here --&amp;gt;
&amp;lt;div class="container"  "margin: auto;"&amp;gt;
 &amp;lt;h2 class="todo__caption"&amp;gt;Password generator&amp;lt;/h2&amp;gt;
 &amp;lt;br&amp;gt;
 &amp;lt;!-- Interface begins --&amp;gt;
 &amp;lt;input type="text" id="site_url" size="50" placeholder="Where do you need this password? Paste the address"&amp;gt;
 &amp;lt;br&amp;gt;
 &amp;lt;input type="text" id="keyword" size="50" placeholder="Some key word here"&amp;gt;
 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;
 &amp;lt;!-- Main button --&amp;gt;
 &amp;lt;button style="font-size: 100%; padding:5px 10px 10px 10px" onclick="generate()"&amp;gt;Generate password&amp;lt;/button&amp;gt;
 &amp;lt;p&amp;gt;Your password is:&amp;lt;/p&amp;gt;
 &amp;lt;div id = "pass_text" style="font-weight: bold"&amp;gt;&amp;lt;/div&amp;gt;  
&amp;lt;/div&amp;gt;
 &amp;lt;script&amp;gt;
 &amp;lt;!-- Your main script --&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you save this text as a .html file and open it in Chrome or other browser, you’ll get something like this. It looks nice, but it won’t work just yet:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8ggxc82psqmlaqzck9iq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8ggxc82psqmlaqzck9iq.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, I’ll write a script that will run in browser and make sure all the encryption magic happens. Follow the steps:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 0: Housekeeping
&lt;/h3&gt;

&lt;p&gt;I want to keep our code clean, so I’ll start with declaring some variables and setting up a function that will later be triggered by a button. This code won’t do anything yet, but I need it for proper running of the actually useful code. All this goes inside the  block at the end of the previous document:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// setting up variables&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;site&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;salt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// The function to run all the useful code&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
&lt;span class="c1"&gt;// Some useful code&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 1. Take the address from the site
&lt;/h3&gt;

&lt;p&gt;I am writing in Javascript, which runs in the browser and has direct access to everything that’s going on in your web page. On the page, I have some input fields. Reading from these fields is a matter of one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;site&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;site_url&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the site_url thing? That’s the ID of the input field. This command real like this: ‘Find whatever object on the page that has an ID ‘site_url’, look at its value, and pass whatever is in there into the variable called ‘site’, which I declared earlier.&lt;/p&gt;

&lt;p&gt;This line goes under the comment ‘Some useful code’.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2. Take the secret word
&lt;/h3&gt;

&lt;p&gt;Same way, I read the secret word:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;salt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;keyword&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This line goes under the previous line.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3. Mash them together
&lt;/h3&gt;

&lt;p&gt;Now I need to combine what is in ‘site’ and in ‘salt’. I can also add a little extra something for more saltiness. In Javascript, connecting two bits of text is done by simply adding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;site&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;salt&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Practicum Rules&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our ‘text’ variable will now have a combination of what is written in two input blocks on the page, and the secret word ‘Practicum Rules’. It’s not really protecting our algorithm since it’s hard-coded into the page and therefore, can be read by whoever looks into the source code of this generator. But it’s fun nevertheless.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4. Encrypt them
&lt;/h3&gt;

&lt;p&gt;I loaded the MD5 script earlier, so now all I have to do is use it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;md5&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This line reads: take the function called md5 and give it whatever is in the ‘text’ variable. What it spits out, put it into the ‘password’ variable. &lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5. Output password
&lt;/h3&gt;

&lt;p&gt;With JavaScript, outputting into the page is easy:&lt;br&gt;
&lt;/p&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="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pass_text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means: in the document, find an element with id ‘pass_text’, and put into its inner HTML whatever is in variable ‘password’. And I know I just put the encoded password there, so I’ll see the encoded result on the page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running the code
&lt;/h3&gt;

&lt;p&gt;Now I need to make sure that all the useful code goes inside the function called ‘generate’, and I have this function mapped to our button on the page. Which I have, look at the bold part:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;font-size: 100%; padding:5px 10px 10px 10px&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;onclick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;generate()&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Generate&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Here is the final code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
&amp;lt;!-- service area --&amp;gt;
&amp;lt;head&amp;gt;
 &amp;lt;title&amp;gt;Password generator&amp;lt;/title&amp;gt;
 &amp;lt;meta charset="utf-8"&amp;gt; 
 &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt; 
 &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;
 &amp;lt;!-- next line loads the MD5 hashing function --&amp;gt;
 &amp;lt;script src="https://thecode.media/wp-content/uploads/2019/05/js-md5.js"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;style type="text/css"&amp;gt;
/*This will be some basic design*/
body{ text-align: center; margin: 10; font-family: Verdana, Arial, sans-serif; font-size: 16px;}
input{ display: inline-block; 
    margin: 20px auto; border: 2px solid #eee; 
    padding: 10px 20px; 
    font-family:Verdana, Arial, sans-serif; 
    font-size: 16px;}
&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
 &amp;lt;!-- Our page will be here --&amp;gt;
&amp;lt;div class="container"  margin: auto;"&amp;gt;
 &amp;lt;h2 class="todo__caption"&amp;gt;Password generator&amp;lt;/h2&amp;gt;
 &amp;lt;br&amp;gt;
 &amp;lt;!-- interface begins --&amp;gt;
 &amp;lt;input type="text" id="site_url" size="50" placeholder="Where do you need this password? Paste the address"&amp;gt;
 &amp;lt;br&amp;gt;
 &amp;lt;input type="text" id="keyword" size="50" placeholder="Some key word here"&amp;gt;
 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;
 &amp;lt;!-- Main button --&amp;gt;
 &amp;lt;button style="font-size: 100%; padding:5px 10px 10px 10px" onclick="generate()"&amp;gt;Generate password&amp;lt;/button&amp;gt;
 &amp;lt;p&amp;gt;Your password is:&amp;lt;/p&amp;gt;
 &amp;lt;div id = "pass_text" style="font-weight: bold"&amp;gt;&amp;lt;/div&amp;gt;  
&amp;lt;/div&amp;gt;
 &amp;lt;script&amp;gt;
// setting up variables
var site, salt;
var text, password;
// The function to run all the useful code
function generate(){
    //Step 1
site = document.getElementById('site_url').value;
    //Step 2
salt = document.getElementById('keyword').value;
    //Step 3
text = site + salt + 'Practicum Rules';
    //Step 4
password = md5(text);
    //Step 5
document.getElementById('pass_text').innerHTML=password;
}
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save it, load it, type in your secret word and the site URL, and press Generate. Yay, you got yourself a password generator. Congrats!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F52ttwfnnkex4bupxlmbw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F52ttwfnnkex4bupxlmbw.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What can be done next:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;You can make the encryption fancier by running the md5 algorithm many times. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can work with upper- and lowercase letters and add extra characters to the generated password.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can shorten the password to 9-12 characters to make it more manageable.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhoek11vm6jllxxozendt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhoek11vm6jllxxozendt.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to learn more things like this, check out our course in &lt;strong&gt;Web Development&lt;/strong&gt; on &lt;a href="https://practicum.yandex.com/web-developer" rel="noopener noreferrer"&gt;Practicum&lt;/a&gt;. It has 20 hours of free lessons 🚀 Also I'm always looking for beta testers, so shoot me an email if you're interested!&lt;/p&gt;

</description>
      <category>css</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Build a simple Reminder App in Python ⏰</title>
      <dc:creator>andrewu</dc:creator>
      <pubDate>Wed, 20 Nov 2019 20:14:33 +0000</pubDate>
      <link>https://dev.to/andrewu/build-a-simple-reminder-app-in-python-5gja</link>
      <guid>https://dev.to/andrewu/build-a-simple-reminder-app-in-python-5gja</guid>
      <description>&lt;p&gt;I keep forgetting to take breaks while working on my laptop, so I've decided to make a reminder app. I'm new to Python, so it will work in command-prompt mode. Yep, no graphical interface for now, but I might add it later. Here we go ✨&lt;/p&gt;

&lt;p&gt;The app will be super simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ask yourself what you wanna be reminded about&lt;/li&gt;
&lt;li&gt;Ask in what amount of time (in minutes)&lt;/li&gt;
&lt;li&gt;Calculate timeout&lt;/li&gt;
&lt;li&gt;Wait for the specified time&lt;/li&gt;
&lt;li&gt;Send a reminder from step 1&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flbqtu9sni12dct4qupqv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flbqtu9sni12dct4qupqv.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 0: Setting things up
&lt;/h3&gt;

&lt;p&gt;Here is a Python command that I'll use: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;import time&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Import tells Python to load a module with the tools that we'll need for this. Time is the name of the module. We’ll only need a method called ‘sleep’ from that module. I'll use it to pause the program for a certain amount of time. &lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Asking for a reminder
&lt;/h3&gt;

&lt;p&gt;First you need to ask a user (in this case, yourself 🙃) and get a response. In a perfect world, we’d want a code like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;reminder = user.ask("What shall I remind you about?")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But let's start with a simple implementation, so I’ll go with some built-in commands:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;print("What shall I remind you about?")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;print&lt;/code&gt; sends out a text message into Python’s default output (which in our case is command line).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;text = str(input())&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This means: ‘Take whatever the user has written, think of it as text, and put it into memory under the name “text”.’ Input() reads whatever the user inputs. Str() turns this into text. Equals means “put one thing into memory with such name.”&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Asking for time
&lt;/h3&gt;

&lt;p&gt;Since we're building a reminder for work, let's calculate time in minutes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;print("In how many minutes?")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;local_time = float(input())&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The second line means ‘Take whatever the user typed, think of it as a number, put it in memory under the name “local_time”. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fdnddyao17bzuci1x4h6i.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fdnddyao17bzuci1x4h6i.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3. Calculating timeout
&lt;/h3&gt;

&lt;p&gt;We have a number of minutes that our app needs to wait before reminding us. But Python’s time.sleep() method requires seconds, not minutes. So we need to convert minutes into seconds: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;local_time = local_time * 60&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This reads: ‘take whatever is in memory under the name “local_time”, multiply it by 60, and put it in memory under the name “local_time”’.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4. Waiting...
&lt;/h3&gt;

&lt;p&gt;Now we’ll need that time module that we loaded in step 0: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;time.sleep(local_time)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This reads: ‘Take the method “sleep.” from the “time” module. Find a piece of data under the name “local_time.” from the memory.  Give that piece of data to “sleep” and see what happens.” &lt;/p&gt;

&lt;p&gt;What happens is: we have a number of seconds in ‘local_time’. We give that number to ‘Sleep,’ and the program dozes off for the specified number of seconds.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5. Sending a reminder
&lt;/h3&gt;

&lt;p&gt;Remember that the reminder text is stored in memory under the name ‘text’? It’s time to use it: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;print(text)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This means: take whatever is in the memory under ‘text’ and send it to output. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flrt0u4e78ykbvsbgd2ff.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flrt0u4e78ykbvsbgd2ff.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Final code
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;import time&lt;br&gt;
print("What shall I remind you about?")&lt;br&gt;
text = str(input())&lt;br&gt;
print("In how many minutes?")&lt;br&gt;
local_time = float(input())&lt;br&gt;
local_time = local_time * 60&lt;br&gt;
time.sleep(local_time)&lt;br&gt;
print(text)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you input this into your Jupyter notebook and run (Shift + Enter), you’ll see your program in action: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fsd92vu3tylimwhbj7d45.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fsd92vu3tylimwhbj7d45.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it for now, but I might add the graphical interface to it later. Would love to hear your comments on this!&lt;/p&gt;

&lt;p&gt;Meanwhile, if you're bored and want to learn &lt;strong&gt;Python&lt;/strong&gt; through building practical things, check out &lt;a href="https://practicum.yandex.com/data-analyst" rel="noopener noreferrer"&gt;our course at Practicum&lt;/a&gt;. It has 20 hours of free lessons 🚀&lt;/p&gt;

</description>
      <category>python</category>
      <category>codenewbie</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Create Your Own Ad Blocker in 3 Minutes ⏳</title>
      <dc:creator>andrewu</dc:creator>
      <pubDate>Thu, 31 Oct 2019 12:47:02 +0000</pubDate>
      <link>https://dev.to/andrewu/create-your-own-ad-blocker-in-3-minutes-5hfh</link>
      <guid>https://dev.to/andrewu/create-your-own-ad-blocker-in-3-minutes-5hfh</guid>
      <description>&lt;p&gt;Hey everyone, today I'm going to use some basic programming and browser plugins to make a simple ad blocker. Because... why not?&lt;/p&gt;

&lt;p&gt;I'll be using a CSS command that can hide any element on a page: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;display:none !important&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;To make sure this command works for every page I visit with a browser, I'll embed it in a special extension.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's an extension?
&lt;/h3&gt;

&lt;p&gt;Extensions (or plugins) enhance a browser's basic features. They let you quickly save videos from YouTube, find out what font is used on a web page, or do whatever else they're programmed for.&lt;/p&gt;

&lt;p&gt;I’ll use Google Chrome for all of the steps that involve extensions.&lt;br&gt;
Most other browsers have their own plugins, and working with them is more or less similar to working with extensions in Google Chrome.&lt;/p&gt;

&lt;p&gt;I’ll need an extension that will work with CSS and apply our command to the right element style. I’m going to choose an extension called &lt;a href="https://chrome.google.com/webstore/detail/user-css/okpjlejfhacmgjkmknjhadmkdbcldfcb/related"&gt;User CSS&lt;/a&gt;, but feel free to pick any other extension that applies custom CSS styles. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: It's safer to download extensions from the official Chrome Web Store since Google checks these extensions for viruses before making them public.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;First, go to the plugin page and click "Install." The browser will ask you if you're sure — I am. When everything's ready, you'll see the extension icon and a tooltip in the upper-right corner of your browser. From this point on, the extension will run on every new page you open.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to block ads
&lt;/h3&gt;

&lt;p&gt;Open the page, and wait for the unwanted banner to cover the screen. Then find the code that makes the banner appear: right-click the dark area, and select "View code". Look for the name of the element in quotation marks after the &lt;code&gt;class=&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;For example, the line can look like this:&lt;br&gt;
&lt;code&gt;&amp;lt;div class="b-popup" id="popup1" style=""&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can see that the pop-up I want to block has a class called &lt;code&gt;b-popup&lt;/code&gt;. A class is a CSS statement that gives an instruction like, "Output everything which belongs to this class in the following way." If I train the browser to hide everything in the b-popup class, that'll be mission accomplished.&lt;/p&gt;

&lt;p&gt;In CSS, class names start with a period, and the commands that apply to the class are enclosed in curly brackets. So my code for configuring the pop-up should look something like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.b-popup {some commands}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;All I have to do is write inside the brackets our command to hide elements from the screen:&lt;br&gt;
&lt;code&gt;.b-popup {display:none !important;}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now on that same page with the ad, click the extension icon, turn it on, and paste our command on a blank line.&lt;/p&gt;

&lt;p&gt;From now on, the extension will always monitor this website. Moreover, if other pages attempt to show similar pop-ups, the extension will block those pop-ups too. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zmH2xyB9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/4afy328ynhey79gf986s.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zmH2xyB9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/4afy328ynhey79gf986s.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it! Your personal ad blocker is ready to go. Whenever you come across something annoying on a website, simply get the name of that element, and add the relevant class to the extension.&lt;/p&gt;

&lt;p&gt;If you enjoy this post, keep an eye on some new ones. I'll be posting some tips for beginner programmers. &lt;/p&gt;

&lt;p&gt;Also feel free to reach out with any questions if you want &lt;strong&gt;to learn Web Development&lt;/strong&gt; through building practical things 🚀&lt;/p&gt;

</description>
      <category>css</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
