<?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: Matthew Epler</title>
    <description>The latest articles on DEV Community by Matthew Epler (@matthewepler).</description>
    <link>https://dev.to/matthewepler</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%2F87652%2Fcea2c24e-1bb4-4278-8e02-2197b20e0eed.jpeg</url>
      <title>DEV Community: Matthew Epler</title>
      <link>https://dev.to/matthewepler</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/matthewepler"/>
    <language>en</language>
    <item>
      <title>How MIME types crashed our production app</title>
      <dc:creator>Matthew Epler</dc:creator>
      <pubDate>Fri, 15 Oct 2021 15:39:54 +0000</pubDate>
      <link>https://dev.to/matthewepler/how-mime-types-crashed-our-production-app-5617</link>
      <guid>https://dev.to/matthewepler/how-mime-types-crashed-our-production-app-5617</guid>
      <description>&lt;p&gt;As the sun came up on the East Coast of the Americas continent, an alarm went off in our team Slack channel. The homepage was returning 4XX errors. &lt;/p&gt;

&lt;p&gt;The problem turned out to be related to two things, but one of those was so basic I didn't even think of it. MIME types. Yup. Our page went down (for a very short time) because of MIME types. &lt;/p&gt;

&lt;p&gt;A quick review of MIME-types led me to &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types"&gt;this nugget from Mozilla&lt;/a&gt; on MIME-sniffing:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1yUJYcw_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0g2swz4ie0iucpg21qy3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1yUJYcw_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0g2swz4ie0iucpg21qy3.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It turns out that a partial/invalid bundle of our app on Cloudflare had produced a malformed file. That file was returned as part of the page request and when the browser couldn't confirm that the MIME type in the header matched the contents, it freaked out and refused to show the page. &lt;/p&gt;

&lt;p&gt;In the end, we just had to rebuild the bundles and all was well. But we never would have discovered this clue if someone had not thought to check the MIME-type response header. Seeing that and knowing that it should have been something different led us to the real issue. &lt;/p&gt;

&lt;p&gt;Basics FTW!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>mime</category>
      <category>html</category>
    </item>
    <item>
      <title>Using Makefiles to Automate Workflows</title>
      <dc:creator>Matthew Epler</dc:creator>
      <pubDate>Fri, 07 Aug 2020 19:34:44 +0000</pubDate>
      <link>https://dev.to/matthewepler/using-makefiles-to-automate-workflows-acd</link>
      <guid>https://dev.to/matthewepler/using-makefiles-to-automate-workflows-acd</guid>
      <description>&lt;p&gt;As a junior developer, I was unsure why anyone would want to use a Makefile when they could use bash or write a script in the language of their choice. I had no idea what a Makefile is and why you'd want to use one so I did some reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  A really really quick intro to Makefiles
&lt;/h2&gt;

&lt;p&gt;Makefiles are used to automate workflows and are composed of chunks of instructions (much like functions) that build on one another to accomplish multi-step processes. Many teams use Makefiles to automate processes both within single projects and across projects/teams. &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Why use a Makefile instead of a script (bash, python, etc)?
&lt;/h2&gt;

&lt;p&gt;Makefiles have the advantage (like bash) of being language agnostic. This is good for teams with a diversity of experience. For example, a front-end junior developer and a senior dev ops engineer. &lt;/p&gt;

&lt;p&gt;Unlike bash or a regular programming language, the make application that runs Makefiles is smart about the work it does. This is because it builds dependency trees under the hood. It knows if you are using a config file to build other files. If you haven't updated the config, then it won't bother building the other files that depend on it. &lt;/p&gt;

&lt;p&gt;While this dependency tree functionality might not seem revolutionary at first glance, it can be used to create some very powerful workflows. Check the article references at the end for some examples.&lt;/p&gt;

&lt;p&gt;Lastly, Makefiles are extremely modular and flexible. You can use small blocks of logic and combine them to create very powerful chains that are linked together. And then you can easily re-use those blocks in other Makefiles just like you would in any other programming language. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. What are some examples of things I can do with a Makefile?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;clean-up unwanted files&lt;/li&gt;
&lt;li&gt;combine the multiples steps documented in the README to get an app up and running into one simple command&lt;/li&gt;
&lt;li&gt;as an alias for really long commands with lots of flags (which you can change when you call the make command!)&lt;/li&gt;
&lt;li&gt;project templates to get you and your team writing code faster without worrying about common dependencies, tooling, and file structure&lt;/li&gt;
&lt;li&gt;any of the above in combination, and more!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. How do I know when a Makefile is the right tool?
&lt;/h2&gt;

&lt;p&gt;First, there are some cases where it might NOT make sense to use Makefiles: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;your team doesn't use Makefiles and the time it would take to get them familiar/comfortable with it isn't justified&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;what you need to accomplish is not complicated and can be easily written in a common script like bash, python, etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are some cases where it does make sense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;your project involves more than one language or tool. For example, helm/k8s + docker + python + git hooks and you need a simple interface to complete tasks across those tools.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;you want short, easy to remember commands to take the place of long cli commands (without giving up the ability to inject options!)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;your team is working across many languages on its projects and you want a common language for automation. For example, installing and running any project locally on your machine whether it's written in python, javascript, or go. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. What do I need to know to get started with Makefiles?
&lt;/h2&gt;

&lt;p&gt;While I am still very much a beginner at Makefiles, I found these pages to be helpful:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://makefiletutorial.com/"&gt;makefiletutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.digitalocean.com/community/tutorials/how-to-use-makefiles-to-automate-repetitive-tasks-on-an-ubuntu-vps"&gt;How to use Makefiles to Automate Repetitive Tasks...&lt;/a&gt; by Justin Ellingwood&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://opensource.com/article/18/8/what-how-makefile"&gt;What is a Makefile and How Does it Work?&lt;/a&gt; by  Sachin Patil&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Further resources
&lt;/h2&gt;

&lt;p&gt;Here are the articles I used to write this article, each of which have some great examples of Makefiles and why you'd want to use them. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://blog.theodo.com/2018/05/why-you-need-a-makefile-on-your-project/"&gt;Why you need a Makefile on your Project&lt;/a&gt; by Martin Guillier&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://bost.ocks.org/mike/make/"&gt;Why Use Make&lt;/a&gt; by Mike Bostock&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://krzysztofzuraw.com/blog/2016/makefiles-in-python-projects.html"&gt;Makefiles in python projects&lt;/a&gt; by Krzysztof Zuraw&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/@habibdhif/simple-makefile-to-automate-python-projects-e233af7681ad"&gt;Simple Makefile to automate Python projects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.digitalocean.com/community/tutorials/how-to-use-makefiles-to-automate-repetitive-tasks-on-an-ubuntu-vps"&gt;How to use Makefiles to Automate Repetitive Tasks...&lt;/a&gt; by Justin Ellingwood&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://matthewkudija.com/blog/2018/03/15/makefile-automation/"&gt;Automation Using Makefiles&lt;/a&gt; by Matthew Kujija&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>makefiles</category>
      <category>python</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
