<?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: R☭</title>
    <description>The latest articles on DEV Community by R☭ (@richardj).</description>
    <link>https://dev.to/richardj</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%2F138886%2F6d0f30d5-0fc9-4007-9ba7-5881afa18753.jpeg</url>
      <title>DEV Community: R☭</title>
      <link>https://dev.to/richardj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/richardj"/>
    <language>en</language>
    <item>
      <title>TIL: Setting up new computer (macOS)</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Tue, 27 Feb 2024 16:40:00 +0000</pubDate>
      <link>https://dev.to/richardj/til-setting-up-new-computer-macos-5dpa</link>
      <guid>https://dev.to/richardj/til-setting-up-new-computer-macos-5dpa</guid>
      <description>&lt;p&gt;Sometimes you run into some useful snippets and to not forget about them...&lt;/p&gt;

&lt;p&gt;When setting up and installing a new Macbook (after finally upgrading it).&lt;/p&gt;

&lt;p&gt;On old computer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; Brew bundle dump
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit where needed&lt;/p&gt;

&lt;p&gt;On new computer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Brew bundle &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Saves probably a few minutes!&lt;/p&gt;

&lt;p&gt;If you have useful commands that could save minutes... share them in the comments.&lt;/p&gt;

</description>
      <category>todayilearned</category>
      <category>homebrew</category>
      <category>macos</category>
    </item>
    <item>
      <title>Website update</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Wed, 17 Mar 2021 09:21:41 +0000</pubDate>
      <link>https://dev.to/richardj/website-update-4c46</link>
      <guid>https://dev.to/richardj/website-update-4c46</guid>
      <description>&lt;p&gt;Ssh-ing into my webserver and using vim in the index.html document is still my all time favorite way of updating a website. Sometimes it is good to not having to deal with complex compilation, packaging, deployment pipelines and to embrace just the basics of the web.&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>html</category>
      <category>website</category>
      <category>deployment</category>
    </item>
    <item>
      <title>A quick Vue (Nuxt) component example.</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Fri, 12 Mar 2021 10:41:00 +0000</pubDate>
      <link>https://dev.to/richardj/a-quick-vue-nuxt-component-example-3jea</link>
      <guid>https://dev.to/richardj/a-quick-vue-nuxt-component-example-3jea</guid>
      <description>&lt;p&gt;A short introduction to create a reusable alert component. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prequisites and setup
&lt;/h2&gt;

&lt;p&gt;This is not a formal setup guide, but just the way i have it set up so it can be replicated. It is expected to have a Nuxt application running, if you want to know how to easily do that &lt;a href="https://nuxtjs.org/docs/2.x/get-started/installation"&gt;Nuxt installation&lt;/a&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nuxt 2.14*&lt;/li&gt;
&lt;li&gt;Node 14 (but Node &amp;gt; 10 should suffice)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The component
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;code&gt;components/general/alert.vue&lt;/code&gt;&lt;/strong&gt; (file name for the component)
&lt;/h4&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;template&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"alert"&lt;/span&gt; &lt;span class="na"&gt;:class=&lt;/span&gt;&lt;span class="s"&gt;"type"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    {{ message }}
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;alert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is a single div component, which contains a message that is passed down as a &lt;code&gt;props&lt;/code&gt; value. It also has a type props that is being used to set a class. the shorthand &lt;code&gt;:class&lt;/code&gt; is being used (which does the same as &lt;code&gt;v-bind:class&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Using the component
&lt;/h2&gt;

&lt;p&gt;To use this component with dynamic values, you need to import it in a different component. Register it in the &lt;code&gt;components&lt;/code&gt; object and then it is usable as a custom HTML element.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;code&gt;pages/index.vue&lt;/code&gt;&lt;/strong&gt; (file name for the page file)
&lt;/h4&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;template&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"page"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Page title&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;alert&lt;/span&gt; &lt;span class="na"&gt;:message=&lt;/span&gt;&lt;span class="s"&gt;"'Error Error!'"&lt;/span&gt; &lt;span class="na"&gt;:type=&lt;/span&gt;&lt;span class="s"&gt;"'error'"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/template&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Alert&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/path/to/alert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;basic-page&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;components&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Alert&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we &lt;code&gt;import Alert from '@/path/to/alert';&lt;/code&gt; then we register it in &lt;code&gt;components: { Alert }&lt;/code&gt;. Finally we use it as a custom HTML element. We use &lt;code&gt;:message=&lt;/code&gt; to pass a String value.&lt;/p&gt;

&lt;p&gt;(notice that we are using single quotes within the double quotes to specifically pass a String, if you want to pass down an object or a  variable, do it like: &lt;code&gt;:message="customMessage"&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Finally in the same way we are passing the String &lt;code&gt;error&lt;/code&gt;. which is then added as a class to the element.&lt;/p&gt;

&lt;p&gt;The final HTML output will then be something like:&lt;br&gt;
&lt;/p&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;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"alert error"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  Error Error!
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By adding &lt;code&gt;methods&lt;/code&gt;, &lt;code&gt;computed&lt;/code&gt; values and fancier styling you can create components that are very flexible, small and are usable wherever you want in your application.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>nuxt</category>
      <category>html</category>
    </item>
    <item>
      <title>Laptop stickers 2020</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Tue, 08 Dec 2020 09:31:21 +0000</pubDate>
      <link>https://dev.to/richardj/laptop-stickers-2020-3h9h</link>
      <guid>https://dev.to/richardj/laptop-stickers-2020-3h9h</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fksmq4nwij4aj5a66er7v.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fksmq4nwij4aj5a66er7v.jpg" alt="Alt Text" width="800" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Less coding stickers, more activism stickers. Show yours.&lt;/p&gt;

</description>
      <category>stickers</category>
      <category>laptop</category>
    </item>
    <item>
      <title>Looking for some backend node help here</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Thu, 23 Apr 2020 07:45:56 +0000</pubDate>
      <link>https://dev.to/richardj/looking-for-some-backend-node-help-here-161c</link>
      <guid>https://dev.to/richardj/looking-for-some-backend-node-help-here-161c</guid>
      <description>&lt;p&gt;So i am working on this application (side project) and i am mainly a frontend developer. And now i am really stuck on getting the authentication in place.&lt;/p&gt;

&lt;p&gt;I have written user registration and simple email + password login, but now getting the authentication and sessions in place is just something i keep getting stuck on. &lt;/p&gt;

&lt;p&gt;I am running a MEVN (Mongo, Express, VueJS 2, Node) stack so i tried some of the options (auth0, express-connect, json webtokens), but i just can't find a combination that works and that i feel is secure.&lt;/p&gt;

&lt;p&gt;So if someone wants to offer a hand / help with implementation or just knows the right up to date tutorial.&lt;/p&gt;

&lt;p&gt;(or if you are a backend focused person and are very into music / a musician, i am looking for partners as well).&lt;/p&gt;

</description>
      <category>help</category>
      <category>authentication</category>
      <category>mongodb</category>
      <category>node</category>
    </item>
    <item>
      <title>What if drivers were hired like software developers?</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Thu, 31 Oct 2019 14:39:18 +0000</pubDate>
      <link>https://dev.to/richardj/what-if-drivers-were-hired-like-software-developers-3k1o</link>
      <guid>https://dev.to/richardj/what-if-drivers-were-hired-like-software-developers-3k1o</guid>
      <description>&lt;p&gt;&lt;strong&gt;Job title&lt;/strong&gt;: car driver&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Job requirements&lt;/strong&gt;: professional skills in driving normal- and heavy-freight cars, buses and trucks, trolley buses, trams, subways, tractors, shovel diggers, contemporary light and heavy tanks currently in use by NATO countries.&lt;/p&gt;

&lt;p&gt;Skills in rally and extreme driving are obligatory!&lt;br&gt;
Formula-1 driving experience is a plus.&lt;/p&gt;

&lt;p&gt;Knowledge and experience in repairing of piston and rotor/Wankel engines, automatic and manual transmissions, ignition systems, board computer, ABS, ABD, GPS and car-audio systems by world-known manufacturers - obligatory!&lt;/p&gt;

&lt;p&gt;Experience with car-painting and tinsmith tasks is a plus.&lt;/p&gt;

&lt;p&gt;The applicants must have certificates by BMW, General Motors and Bosch, but not older than two years.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compensation&lt;/strong&gt;: $15-$20/hour, depends on the interview result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Education requirements&lt;/strong&gt;: Bachelor's Degree of Engineering.&lt;/p&gt;




&lt;p&gt;original: &lt;a href="https://www.jitbit.com/alexblog/203-what-if-drivers-were-hired-like-programmers"&gt;https://www.jitbit.com/alexblog/203-what-if-drivers-were-hired-like-programmers&lt;/a&gt;&lt;/p&gt;

</description>
      <category>humor</category>
    </item>
    <item>
      <title>FIXED: Upload to DigitalOcean Spaces with AWS S3 getSignedUrl with correct permissions and Content Type</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Thu, 31 Oct 2019 10:09:57 +0000</pubDate>
      <link>https://dev.to/richardj/upload-to-digitalocean-spaces-with-aws-s3-getsignedurl-with-correct-permissions-and-content-type-29og</link>
      <guid>https://dev.to/richardj/upload-to-digitalocean-spaces-with-aws-s3-getsignedurl-with-correct-permissions-and-content-type-29og</guid>
      <description>&lt;p&gt;Solution:&lt;/p&gt;

&lt;p&gt;What i actually had to do, was allow for custom headers to be set in the put request. This was done through the DigitalOcean interface in the CORS settings for your spaces.&lt;/p&gt;

&lt;p&gt;I am trying to upload assets through the getSignedUrl method that the aws-sdk provides, a NodeJS backend with Axios where the upload happens from a VueJS 2 frontend. Now whatever combination i try, or the file is able to upload but always sets it to private and the wrong Content-Type, or i get 403 permission errors.&lt;/p&gt;

&lt;p&gt;If i leave out all the ACL and ContentType stuff, the file is displayed on the Spaces interface as being private.&lt;/p&gt;

&lt;p&gt;This is how it should be shown, and what i get when i upload manually through the interface:&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%2F7wepfya9fnhf1r04gzm2.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%2F7wepfya9fnhf1r04gzm2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What i want to do is that the upload has an ACL that is public-read and the correct Content-Type. &lt;/p&gt;

&lt;p&gt;The following is the code that i use:&lt;/p&gt;

&lt;p&gt;To get a signed Url&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

const s3 = new AWS.S3({
    accessKeyId: keys.spacesAccessKeyId,
    secretAccessKey: keys.spacesSecretAccessKey,
    signatureVersion: 'v4',
    endpoint: 'https://REGIO.digitaloceanspaces.com',
    region: 'REGIO'
});

app.get('/api/upload/image', (req, res) =&amp;gt; {
        const type = req.query.type;

        s3.getSignedUrl('putObject', {
            Bucket: 'BUCKET',
            ContentType: type,
            ACL: 'public-read',
            Key: 'random-key'
        }, (error, url) =&amp;gt; {
            if (error) {
                console.log(error);
            }
            console.log('KEY:', key);
            console.log('URL:', url);
            res.send({ key, url });
        });
    });


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This provides a signed url that looks like:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

https://BUCKET.REGION.digitaloceanspaces.com/images/e173ca50-fafe-11e9-b18c-d3cfd4814069.png?Content-Type=image%2Fpng&amp;amp;X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;amp;X-Amz-Credential=NSX3EZOFXE57BAFSKDIL%2F20191030%2Ffra1%2Fs3%2Faws4_request&amp;amp;X-Amz-Date=20191030T102022Z&amp;amp;X-Amz-Expires=900&amp;amp;X-Amz-Signature=f6bcdcd35da5dc237f881a714ec9ca09cb7aa3f3ffbd2389648a7c30808ab56e&amp;amp;X-Amz-SignedHeaders=host%3Bx-amz-acl&amp;amp;x-amz-acl=public-read


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then for actually uploading the file i use the following:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

await UploadService.uploadImage(uploadConfig.data.url, file, {
          'x-amz-acl': 'public-read',
          'Content-Type': file.type
      });


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With the service looking like:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  async uploadImage (url, file, headers) {
    await axios.put(url, file, headers.headers);
  }


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;disclaimer: this works with S3 itself as you can set the permissions on a per bucket level so you don't have to worry about it. But Spaces providers a CDN as well and is just generally cheaper. :) &lt;/p&gt;

</description>
      <category>help</category>
      <category>node</category>
      <category>aws</category>
      <category>digitalocean</category>
    </item>
    <item>
      <title>Become a technical mentor at Gaza Sky Geeks third annual women’s inclusivity hackathon</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Thu, 17 Oct 2019 09:39:41 +0000</pubDate>
      <link>https://dev.to/richardj/become-a-technical-mentor-at-gaza-sky-geeks-third-annual-women-s-inclusivity-hackathon-373d</link>
      <guid>https://dev.to/richardj/become-a-technical-mentor-at-gaza-sky-geeks-third-annual-women-s-inclusivity-hackathon-373d</guid>
      <description>&lt;p&gt;Gaza Sky Geeks is organizing their third annual women’s inclusivity hackathon in Gaza on December 5-8. They want to recruit a team of mentors to come to Gaza and support the teams during the hackathon. &lt;/p&gt;

&lt;p&gt;Are you a developer or designer -- or do you know any amazing developers and designers -- who would be interested and able to make the trip out to Gaza and participate in the hackathon as a technical mentor?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gazaskygeeks.com"&gt;https://gazaskygeeks.com&lt;/a&gt; is part of the Mercy Corps &lt;a href="https://www.mercycorps.org"&gt;https://www.mercycorps.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To apply:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://airtable.com/shr6qSeiwlL1Gw4Wm"&gt;https://airtable.com/shr6qSeiwlL1Gw4Wm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few notes:&lt;/p&gt;

&lt;p&gt;You have to pay for the flight to Tel Aviv yourself, also you have to take care of a visa for Israel. Your stay there will be paid for (sleeping arrangement, food etc). Basically this is voluntary position.&lt;/p&gt;

&lt;p&gt;To find more information about what it takes to be a mentor: &lt;a href="https://gazaskygeeks.com/become-a-mentor/"&gt;https://gazaskygeeks.com/become-a-mentor/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This page also has information about the safety of Gaza. &lt;/p&gt;

</description>
      <category>mentor</category>
      <category>hackathon</category>
      <category>inclusion</category>
      <category>gaza</category>
    </item>
    <item>
      <title>Terminal of choice?</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Thu, 17 Oct 2019 07:58:42 +0000</pubDate>
      <link>https://dev.to/richardj/terminal-of-choice-8hg</link>
      <guid>https://dev.to/richardj/terminal-of-choice-8hg</guid>
      <description>&lt;p&gt;What is your terminal of choice? &lt;/p&gt;

&lt;p&gt;I used to dabble with Hyper for some time because of the customization i could do with it, but eventually dropped it because of the poor performance compared to the default (mac) terminal and Iterm. &lt;/p&gt;

&lt;p&gt;After i became bored with Iterm (and found it sluggish as well) i moved to the default terminal which gave me more than enough customization and most important of all, the performance i want.&lt;/p&gt;

&lt;p&gt;But yesterday i opened Iterm again, and saw that it now includes things through its preferences (git status, upload / download speed, memory usage of the computer etc).&lt;/p&gt;

&lt;p&gt;So for now i am moving back to Iterm 2. What is your Terminal of choice? &lt;/p&gt;

</description>
      <category>terminal</category>
      <category>iterm</category>
      <category>hyper</category>
    </item>
    <item>
      <title>Javascript events, going back to the basics</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Tue, 26 Feb 2019 12:28:20 +0000</pubDate>
      <link>https://dev.to/richardj/javascript-events-going-back-to-basics-33p</link>
      <guid>https://dev.to/richardj/javascript-events-going-back-to-basics-33p</guid>
      <description>&lt;p&gt;In my previous &lt;a href="https://dev.to/richardj/javascript-events--868"&gt;post&lt;/a&gt; i wanted to discuss a way of a single event handler on document level that would listen to click events on certain elements or its children. By traversing the &lt;code&gt;event.path&lt;/code&gt; i would check if in the path there was a class and then call a function if that was true.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/richardj" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n8K2klVw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://media.dev.to/cdn-cgi/image/width%3D150%2Cheight%3D150%2Cfit%3Dcover%2Cgravity%3Dauto%2Cformat%3Dauto/https%253A%252F%252Fdev-to-uploads.s3.amazonaws.com%252Fuploads%252Fuser%252Fprofile_image%252F138886%252F6d0f30d5-0fc9-4007-9ba7-5881afa18753.jpeg" alt="richardj"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/richardj/javascript-events--868" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Javascript events&lt;/h2&gt;
      &lt;h3&gt;R☭ ・ Feb 21 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#discuss&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#question&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#optimization&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;While this works in Chrome, &lt;code&gt;event.path&lt;/code&gt; is not widely supported, so i had to go back and implement a different solution, this time, by using &lt;code&gt;event.parentElement&lt;/code&gt;.&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;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;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;findAncestor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="nf"&gt;runFunction&lt;/span&gt;&lt;span class="p"&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="nf"&gt;findAncestor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parentElement&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;matches&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;matchesSelector&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;sel&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is possible to use a polyfill apprently, and there is something like &lt;code&gt;event.composedPath&lt;/code&gt;, more about that on &lt;a href="https://stackoverflow.com/questions/39245488/event-path-undefined-with-firefox-and-vue-js"&gt;Stack Overflow - event.path undefined with Firefox&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>events</category>
      <category>dom</category>
    </item>
    <item>
      <title>Javascript events</title>
      <dc:creator>R☭</dc:creator>
      <pubDate>Thu, 21 Feb 2019 09:47:52 +0000</pubDate>
      <link>https://dev.to/richardj/javascript-events--868</link>
      <guid>https://dev.to/richardj/javascript-events--868</guid>
      <description>&lt;p&gt;Working on a message system, i want to catch all the events that happen on the message element, or its children. Would this be the most optimal way of doing this?&lt;/p&gt;

&lt;p&gt;I can also add a &lt;code&gt;pointer-events: none&lt;/code&gt; through CSS on all the child elements. But that doesn't feel like a good scalable way to go.&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;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;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for &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;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;         
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nf"&gt;doThings&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>discuss</category>
      <category>question</category>
      <category>optimization</category>
    </item>
  </channel>
</rss>
