<?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: Omar Benmegdoul</title>
    <description>The latest articles on DEV Community by Omar Benmegdoul (@omarbenmegdoul).</description>
    <link>https://dev.to/omarbenmegdoul</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%2F624083%2Fc39ea6d4-4418-428b-8ede-e3eaf6aba5e9.jpeg</url>
      <title>DEV Community: Omar Benmegdoul</title>
      <link>https://dev.to/omarbenmegdoul</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omarbenmegdoul"/>
    <language>en</language>
    <item>
      <title>More web dev snippets</title>
      <dc:creator>Omar Benmegdoul</dc:creator>
      <pubDate>Fri, 25 Jun 2021 16:33:14 +0000</pubDate>
      <link>https://dev.to/omarbenmegdoul/more-web-dev-snippets-5741</link>
      <guid>https://dev.to/omarbenmegdoul/more-web-dev-snippets-5741</guid>
      <description>&lt;p&gt;Last month I posted a JS snippet for &lt;a href="https://dev.to/omarbenmegdoul/a-verbose-log-snippet-for-easier-debugging-gb6"&gt;verbose logs&lt;/a&gt; -- it's easier to debug when the log contains the origin filename, line number, type, and name of whatever you're trying to log. Several classmates found it useful, so here are some others I've gotten good mileage out of.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6a8snlldfkbbqwfz824q.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6a8snlldfkbbqwfz824q.gif" alt="A gif demonstration of what the snippet does and how to use VSCode snippets"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I improved on the verbose log snippet with these two. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first is shorter and therefore less likely to take up vertical space on the screen. &lt;/li&gt;
&lt;li&gt;The other omits the &lt;code&gt;typeof&lt;/code&gt; operator since it's not needed in the majority of cases -- this also lets you log multiple arguments.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"Labeled log to console"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"llog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="s2"&gt;"console.log(`❗ $TM_FILENAME:$TM_LINE_NUMBER '${2:expression}' &amp;lt;&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;${typeof ${2:expression}&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;}&amp;gt;`,${2:expression});"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Logs filename, rough line called, name, type, and value of expression "&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shorter version with no &lt;code&gt;typeof&lt;/code&gt; - use with &lt;code&gt;slog&lt;/code&gt; then tab:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;"Short log to console"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"slog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="s2"&gt;"console.log(`❗ $TM_FILENAME:$TM_LINE_NUMBER '${2:expression}'`,${2:expression});"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Logs filename, rough line called, name, and value of expression "&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  React component (💅)
&lt;/h2&gt;

&lt;p&gt;While working on my final project for Concordia's bootcamp, I found myself needing these. &lt;/p&gt;

&lt;p&gt;Here's a React component snippet. It also imports styled-components and adds a &lt;code&gt;&amp;lt;Wrapper&amp;gt;&lt;/code&gt; element inside the component -- I needed that, you might not.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nl"&gt;"React component"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rreact"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="s2"&gt;"import React from 'react';"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="s2"&gt;"import styled from 'styled-components';"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="s2"&gt;"const ${1:ComponentName} = ({${2:myProps}&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;}) =&amp;gt; {return ("&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;Wrapper&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\t\t&lt;/span&gt;&lt;span class="s2"&gt;'I'm a placeholder'"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/Wrapper&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;")};"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"const Wrapper = styled.div``"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="s2"&gt;"export default ${1:ComponentName};"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Flexbox
&lt;/h2&gt;

&lt;p&gt;90% of my flexboxes look like this and I got tired of typing them. &lt;code&gt;flex-direction:column&lt;/code&gt; may not be what you need, but since &lt;code&gt;row&lt;/code&gt; is the default it's easier to delete that line when you don't need it than to add it when you do. Depending on what you're doing, this might go in your JS or CSS snippets.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"Flexbox boilerplate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fflex"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"display:flex;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"flex-direction:column;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"justify-content:center;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"align-items:center;"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"flexbox to center content"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>react</category>
      <category>beginners</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>A Verbose Log Snippet for Easier Debugging</title>
      <dc:creator>Omar Benmegdoul</dc:creator>
      <pubDate>Sat, 08 May 2021 12:32:19 +0000</pubDate>
      <link>https://dev.to/omarbenmegdoul/a-verbose-log-snippet-for-easier-debugging-gb6</link>
      <guid>https://dev.to/omarbenmegdoul/a-verbose-log-snippet-for-easier-debugging-gb6</guid>
      <description>&lt;p&gt;Here's a VSCode snippet that populates a &lt;code&gt;console.log&lt;/code&gt; call with more information to help you interpret your output. Typing &lt;code&gt;llog&lt;/code&gt; then Tab will get you something like:&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;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`❗ data.js line:78 'reservations' &amp;lt;type: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;reservations&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;reservations&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of just printing the value of your &lt;code&gt;console.log&lt;/code&gt; argument, you get the file name, the line number, the name of the argument, its type, and &lt;em&gt;then&lt;/em&gt; its output. There is also a red emoji to mark this as your own note and to easily spot the beginning of the log.&lt;/p&gt;

&lt;h3&gt;
  
  
  The actual snippet
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"Labeled log to console"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"llog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="s2"&gt;"console.log(`❗ $TM_FILENAME line:$TM_LINE_NUMBER '${2:expression}' &amp;lt;type: &lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;${typeof ${2:expression}&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;}&amp;gt;`,${2:expression});"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Logs filename, rough line called, name, type, and value of expression "&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a shorter version of the same info:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"Labeled log to console"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"llog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="s2"&gt;"console.log(`❗ $TM_FILENAME:$TM_LINE_NUMBER '${2:expression}' &amp;lt;&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;${typeof ${2:expression}&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;}&amp;gt;`,${2:expression});"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Logs filename, rough line called, name, type, and value of expression "&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And an even shorter version with no &lt;code&gt;typeof&lt;/code&gt; - use with &lt;code&gt;slog&lt;/code&gt; then tab:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;"Short log to console"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"prefix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"slog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="s2"&gt;"console.log(`❗ $TM_FILENAME:$TM_LINE_NUMBER '${2:expression}'`,${2:expression});"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Logs filename, rough line called, name, and value of expression "&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shoutout to Neophius and alexdima for showing me &lt;a href="https://github.com/microsoft/vscode/issues/1670#issuecomment-277265737" rel="noopener noreferrer"&gt;the escape characters&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to use VSCode snippets
&lt;/h3&gt;

&lt;p&gt;It's easier if I just show you:&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6a8snlldfkbbqwfz824q.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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6a8snlldfkbbqwfz824q.gif" alt="A gif demonstration of what the snippet does and how to use VSCode snippets"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Notes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The line number doesn't update if the call moves to another line in the file. It doesn't matter very much in practice.&lt;/li&gt;
&lt;li&gt;Maybe you have more than one &lt;code&gt;index.js&lt;/code&gt;? Replace &lt;code&gt;TM_FILENAME&lt;/code&gt; in the snippet with &lt;code&gt;TM_FILEPATH&lt;/code&gt; for the full path to the file. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://code.visualstudio.com/docs/editor/userdefinedsnippets" rel="noopener noreferrer"&gt;Learn more about user snippets&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Scraping Kijiji: the Idea</title>
      <dc:creator>Omar Benmegdoul</dc:creator>
      <pubDate>Sun, 02 May 2021 00:28:40 +0000</pubDate>
      <link>https://dev.to/omarbenmegdoul/scraping-kijiji-the-idea-56dl</link>
      <guid>https://dev.to/omarbenmegdoul/scraping-kijiji-the-idea-56dl</guid>
      <description>&lt;p&gt;I want to create a website to help find apartments in Montreal.  Before I do or research anything, I just want to write out what I want it to do and how I &lt;em&gt;think&lt;/em&gt; I can do it.&lt;/p&gt;

&lt;h1&gt;
  
  
  Data
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Apartments
&lt;/h2&gt;

&lt;p&gt;The data will come from Kijiji. I've written a Kijiji scraper in Python before, and now that I know more about JS I think I can do it faster. With any luck there's an API out there that I can use instead.&lt;/p&gt;

&lt;p&gt;The scraper will periodically check Kijiji for new rental listings in Montreal. It will also scrape all the data for these listings so the end user can filter as narrowly as the data allows (which is more than Kijiji's user interface does).&lt;/p&gt;

&lt;h2&gt;
  
  
  Time distance
&lt;/h2&gt;

&lt;p&gt;Instead of specifying a radius around a point and showing results to the user around that point, I want to allow them to filter results by &lt;em&gt;time distance&lt;/em&gt;: how many minutes of walking, public transit, does it take to get from the apartment to some zip code.&lt;/p&gt;

&lt;p&gt;I assume Google Maps has an API that lets you find this out. But unless it's free I probably can't call it for every single listing. I'll probably have to have a table of time distances between every 3-digit zip code and use this as an approximation. It's less than ideal for walking as you can easily walk 20 minutes in a straight line within H2H for instance. I would have to look into more granular options...&lt;/p&gt;

&lt;h1&gt;
  
  
  User Interface
&lt;/h1&gt;

&lt;p&gt;There are a few things I don't like about Kijiji's interface:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some listing properties can't be used for filtering (date available if I remember correctly), or the filters are not great&lt;/li&gt;
&lt;li&gt;It is littered with duplicate listings and office rentals. A lot of apartment swaps, too, which may not be relevant.&lt;/li&gt;
&lt;li&gt;It takes many clicks to get the information you care about. You have to click on listings to read the description, then you have to click on the pictures to see what the place looks like, and you have to click to see a map showing the location of the apartment. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My solution is to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;simply allow filtering using every listing property, with options (e.g. exclude listings if heat/electricity/water would put them above your stated budget)&lt;/li&gt;
&lt;li&gt;include toggles to filter out duplicates, office rentals, and apartment swaps. They can be identified easily. &lt;/li&gt;
&lt;li&gt;Make listing info visible in the search results. Most descriptions are not long enough to warrant a clickthrough. A table with all properties can be shown. A reasonably large preview image should be shown, with a series of thumbnails that change the src of the preview image on mouseenter so all of them can be seen without clicking through. A Google map of the apartment's location should be shown on mouseover of the address.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Problems:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;That might be a lot of requests to make on a single page, leading the significant slowdowns. My hunch? Not as bad as waiting for dozens of different pages to load. &lt;/li&gt;
&lt;li&gt;Getting distances might be tough as explained above.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Optional:
&lt;/h4&gt;

&lt;p&gt;Is there a walk score API? &lt;/p&gt;

&lt;h1&gt;
  
  
  finally {
&lt;/h1&gt;

&lt;p&gt;That about covers it! I'll write about my progress once I start doing research to (in)validate my assumptions.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
