<?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>Forem: Matt Shirlaw</title>
    <description>The latest articles on Forem by Matt Shirlaw (@mshirlaw).</description>
    <link>https://forem.com/mshirlaw</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%2F221319%2F24e67a4a-1045-47f0-84af-6070863e86ee.jpeg</url>
      <title>Forem: Matt Shirlaw</title>
      <link>https://forem.com/mshirlaw</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mshirlaw"/>
    <language>en</language>
    <item>
      <title>React: Neatly hide conditional DOM elements 👀</title>
      <dc:creator>Matt Shirlaw</dc:creator>
      <pubDate>Sat, 26 Oct 2019 10:38:01 +0000</pubDate>
      <link>https://forem.com/mshirlaw/react-neatly-hide-conditional-dom-elements-2ke7</link>
      <guid>https://forem.com/mshirlaw/react-neatly-hide-conditional-dom-elements-2ke7</guid>
      <description>&lt;p&gt;If you are anything like me you always cringe a little bit when you come across something like this in a React project 😬&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i9pegoiQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/mshirlaw/react-conditional-block/blob/master/img/old.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i9pegoiQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/mshirlaw/react-conditional-block/blob/master/img/old.png%3Fraw%3Dtrue" alt="Without react conditional block"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The more conditionals that you have, the worse it gets and the as people add more and more code over time it just gets worse and worse. &lt;/p&gt;

&lt;p&gt;To solve this I always end up building a tiny wrapper component to hide this logic away. I'm sure other people do this sort of thing as well so I built a little &lt;code&gt;npm&lt;/code&gt; package which will let you do this &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nt3jT4DF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/mshirlaw/react-conditional-block/blob/master/img/new.png%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nt3jT4DF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/mshirlaw/react-conditional-block/blob/master/img/new.png%3Fraw%3Dtrue" alt="With react conditional block"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are interested you can &lt;a href="https://www.npmjs.com/package/react-conditional-block"&gt;get it on NPM&lt;/a&gt;. It certainly won't save you a heap of time but hey, a minute saved is a minute saved right 😜&lt;/p&gt;

</description>
      <category>react</category>
      <category>conditional</category>
      <category>block</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Attack of the bots: The deeper you dig the more there are!</title>
      <dc:creator>Matt Shirlaw</dc:creator>
      <pubDate>Thu, 24 Oct 2019 10:45:40 +0000</pubDate>
      <link>https://forem.com/mshirlaw/attack-of-the-bots-the-deeper-you-dig-the-more-there-are-187i</link>
      <guid>https://forem.com/mshirlaw/attack-of-the-bots-the-deeper-you-dig-the-more-there-are-187i</guid>
      <description>&lt;p&gt;I always knew that there were bots on Twitter but I am not sure I had truely gathered just how deep this network goes 🤦&lt;/p&gt;

&lt;p&gt;I've been trying to debug a pretty weird issue with one of my own bots on and off for the last week or so and I couldn't work out what was going on. &lt;/p&gt;

&lt;p&gt;While it doesn't do a whole lot (it essentially justs retweets storm information to warn people who follow it that there might be storms in the area) this particular bot is relatively popular so I try to keep it somewhat functional.&lt;/p&gt;

&lt;p&gt;Recently I noticed that another account was spamming some of the key words that the bot retweets with conspiracy theories. Usually this isn't much of an issue as the Twitter API allows you to filter out tweets from specific users with a query like &lt;code&gt;q=-from:user&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;I updated my code to exclude the user who was spamming and I expected it would solve the problem pretty much instantly. &lt;/p&gt;

&lt;p&gt;Unfortunately, over the next few days I kept seeing tweets from this user showing up in my bots feed 🤔&lt;/p&gt;

&lt;p&gt;At first I thought I had messed up my query string but after digging into the logs a little more I could find no tweets from the user that I was trying to exclude at all yet they were still showing up in my bots feed 🤯&lt;/p&gt;

&lt;p&gt;After a bunch more testing and a few wtf moments I worked out that somehow tweets from other users were appearing in my bots feed as if my bot had directly retweeted the spam account.&lt;/p&gt;

&lt;p&gt;It turns out that my bot was retweeting other users who had retweeted the spam account. Each time I blocked a new user it would immediately be replaced by another retweet and it didn't take long for me to realise that there was a massive network of bots all retweeting the original spam account and my bot had inadvertently joined in on the party.&lt;/p&gt;

&lt;p&gt;The eventual solution was pretty simple. All I needed to do was add &lt;code&gt;-filter:retweets&lt;/code&gt;to my query string but it took a whole lot longer than it should have to arrive at that realisation. &lt;/p&gt;

&lt;p&gt;Hopefully this little story prevents someone else from heading down a similar rabbit hole in the future 👍&lt;/p&gt;

</description>
      <category>twitter</category>
      <category>bot</category>
      <category>python</category>
      <category>aws</category>
    </item>
    <item>
      <title>UI/UX design for engineers</title>
      <dc:creator>Matt Shirlaw</dc:creator>
      <pubDate>Thu, 12 Sep 2019 10:55:06 +0000</pubDate>
      <link>https://forem.com/mshirlaw/ui-ux-design-for-engineers-368e</link>
      <guid>https://forem.com/mshirlaw/ui-ux-design-for-engineers-368e</guid>
      <description>&lt;p&gt;Like many other software engineers who work in web development, I feel quite comfortable writing JavaScript and have lots of experience with frameworks such as Angular or React but I'd love to brush up on my user interface design and CSS skills. &lt;/p&gt;

&lt;p&gt;This seems to be a common theme amongst engineers so I thought it would be good to share resources aimed at those who don't have formal training in UI/UX design. Have you found anything worth sharing recently? &lt;/p&gt;

&lt;p&gt;To kick it off I'll start with some resources that I have come across thanks mostly to browsing twitter &amp;amp; especially Sarah Drasner who has an amazing amount of content on her personal site, github &amp;amp; codepen 🙏🙏🙏🙏&lt;/p&gt;

&lt;p&gt;I'll keep it updated as I come across new content from time to time: &lt;/p&gt;

&lt;h3&gt;
  
  
  Resources 🔗
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://css-tricks.com" rel="noopener noreferrer"&gt;CSS Tricks&lt;/a&gt; A great site with a huge amount of content&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://frontendmasters.com/courses/design-for-developers" rel="noopener noreferrer"&gt;Design for Developers&lt;/a&gt; A course by Sarah Drasner on Frontend Masters&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://css-tricks.com/where-do-you-learn-html-css-in-2019" rel="noopener noreferrer"&gt;Where do you learn HTML &amp;amp; CSS in 2019&lt;/a&gt; An awesome article by Chris Coyier&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.figma.com/" rel="noopener noreferrer"&gt;Figma&lt;/a&gt; and &lt;a href="https://www.figma.com/resources/learn-design/" rel="noopener noreferrer"&gt;Learn with figma&lt;/a&gt; An awesome online design tool &amp;amp; plenty of accompanying resources&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://ui-patterns.com" rel="noopener noreferrer"&gt;UI patterns&lt;/a&gt; Common solutions to common problems in interaction design&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://css-tricks.com/bem-101" rel="noopener noreferrer"&gt;BEM 101&lt;/a&gt; A good introduction to the reasons why you might adopt the BEM CSS naming convention&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Books 📚
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.goodreads.com/book/show/43190966-refactoring-ui" rel="noopener noreferrer"&gt;Refactoring UI&lt;/a&gt; by Adam Wathan &amp;amp; Steve Schoger&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.goodreads.com/book/show/36436141-design-systems" rel="noopener noreferrer"&gt;Design Systems&lt;/a&gt; by Alla Kholmatova&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  DEV articles 📖
&lt;/h3&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/mustapha" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F174804%2Fcb831252-9db8-4f7a-a600-0bf8db47b92f.png" alt="mustapha"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/mustapha/css-grid-illustrated-introduction-52l5" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;CSS Grid: illustrated introduction&lt;/h2&gt;
      &lt;h3&gt;Mustapha Aouas ・ Sep 12 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  DEV users 💻
&lt;/h3&gt;


&lt;div class="ltag__user ltag__user__id__9053"&gt;
    &lt;a href="/sarah_edo" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&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%2Fuser%2Fprofile_image%2F9053%2FoaLvwS7y.jpg" alt="sarah_edo image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/sarah_edo"&gt;Sarah Drasner&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/sarah_edo"&gt;/sarah_edo&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div class="ltag__user ltag__user__id__2545"&gt;
    &lt;a href="/chriscoyier" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&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%2Fuser%2Fprofile_image%2F2545%2F5m0hKrUC.jpg" alt="chriscoyier image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/chriscoyier"&gt;Chris Coyier&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/chriscoyier"&gt;Writing at [CSS-Tricks](https://css-tricks.com), podcasting at [ShopTalk](https://shoptalkshow.com), co-founder of [CodePen](https://codepen.io).&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>css</category>
      <category>design</category>
      <category>javascript</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
