<?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: John Costanzo</title>
    <description>The latest articles on DEV Community by John Costanzo (@jrock2004).</description>
    <link>https://dev.to/jrock2004</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%2F29073%2Fbaefcf3f-cb33-4fa4-a237-79560049aa61.png</url>
      <title>DEV Community: John Costanzo</title>
      <link>https://dev.to/jrock2004</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jrock2004"/>
    <language>en</language>
    <item>
      <title>Building Serverless Function for Slack Slash Command</title>
      <dc:creator>John Costanzo</dc:creator>
      <pubDate>Sun, 08 Aug 2021 00:19:18 +0000</pubDate>
      <link>https://dev.to/jrock2004/building-serverless-function-for-slack-slash-command-5e5n</link>
      <guid>https://dev.to/jrock2004/building-serverless-function-for-slack-slash-command-5e5n</guid>
      <description>&lt;p&gt;At work some of the side conversations we have is about watching Anime. We talk about what we are watching at the current time and sometimes people bring up an anime that you have never heard of. So typically I or a co-worker would send a slack message with a link to see some information about what the anime is about.&lt;/p&gt;

&lt;p&gt;So I wanted to get into learning about serverless functions and I am the type of person that needs a goal to help keep me motivated to learn. So I decided to build something that I could setup in slack to allow someone to type something like, &lt;code&gt;/anime One Piece&lt;/code&gt; and when I would hit enter we would get something like the following as a result:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Slack&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NK51Yphd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/jrock2004/anime-slackbot/main/image-slack-screenshot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NK51Yphd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/jrock2004/anime-slackbot/main/image-slack-screenshot.png" alt="A sample of what the output will look like in slack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dm2eZHxB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/jrock2004/anime-slackbot/main/image-markdown-screenshot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dm2eZHxB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/jrock2004/anime-slackbot/main/image-markdown-screenshot.png" alt="A sample of what the output will look like in markdown"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking at the markdown version really makes me excited for the day that Slack opens their eyes and support full markdown. If you are interested in looking at the full code for this, &lt;a href="https://github.com/jrock2004/anime-slackbot"&gt;here is the Github link to it&lt;/a&gt;. Next I want to break down the how I built some of this. The code is by no means fully ready as there are improvements I want to make, but I wanted to write this now before getting into make more changes.&lt;/p&gt;
&lt;h1&gt;
  
  
  Main Dependencies
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/@netlify/functions"&gt;Netlify Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.npmjs.com/package/node-fetch"&gt;Node Fetch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Netlify Functions
&lt;/h2&gt;

&lt;p&gt;This library made it real easy to get started with setting up the netlify function. The library gives you the handlers you need for when the function is called. In the past when I wrote an app like this, I set up an express server to build the route. Using this library I was able to create a ts file and just put the following to get started&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Handler&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;HandlerEvent&lt;/span&gt; &lt;span class="p"&gt;}&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;@netlify/functions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&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;HandlerEvent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello&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="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;With the help of Netlify CLI I took this code and I ran &lt;code&gt;netlify dev&lt;/code&gt; and I was able to go into Postman and call this API. &lt;/p&gt;
&lt;h2&gt;
  
  
  Node Fetch
&lt;/h2&gt;

&lt;p&gt;So since this is not running in a browser, we do not have access to use window fetch. So node fetch will give us a way to use fetch to get the data we need for the response.&lt;/p&gt;
&lt;h1&gt;
  
  
  Getting Data
&lt;/h1&gt;

&lt;p&gt;So before I got too far, I needed to find a way to lookup the anime data that a person would be searching for. So the 2 I found that had API access, was &lt;a href="https://anilist.co"&gt;Anilist&lt;/a&gt; and &lt;a href="https://www.animenewsnetwork.com"&gt;Anime News Network&lt;/a&gt;. Anilist API uses graphql and Anime News Network which uses rest with xml response. &lt;/p&gt;

&lt;p&gt;I did not want to deal with xml so I went with graphql as that was going to be way more flexible and easy for me. &lt;/p&gt;
&lt;h1&gt;
  
  
  Finish Up
&lt;/h1&gt;

&lt;p&gt;I would be interesting to know if people would find something like this useful or not. Take a look at the code and let me know what you think. You can view the code at:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/jrock2004"&gt;
        jrock2004
      &lt;/a&gt; / &lt;a href="https://github.com/jrock2004/anime-slackbot"&gt;
        anime-slackbot
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      This is a slack bot that will go out and get you information on your favorite anime
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>serverless</category>
      <category>typescript</category>
      <category>netlify</category>
      <category>slack</category>
    </item>
    <item>
      <title>One Thing I Do Not Like in Ember</title>
      <dc:creator>John Costanzo</dc:creator>
      <pubDate>Fri, 21 Aug 2020 02:05:58 +0000</pubDate>
      <link>https://dev.to/jrock2004/one-thing-i-do-not-like-in-ember-1j1m</link>
      <guid>https://dev.to/jrock2004/one-thing-i-do-not-like-in-ember-1j1m</guid>
      <description>&lt;p&gt;So I was interviewing someone for a role with my company and during the part where you ask the person, “Do you have any questions for me?” came up, he asked something different. Tell me one thing that you do not like in Ember.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/3o7TKTDn976rzVgky4/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3o7TKTDn976rzVgky4/giphy.gif" alt="Tom Hanks thinking about something"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I had to sit back and think about this. I did not want to cop out and say, there is nothing wrong in Ember, I like it all. EmberJS is a great framework to use and its improving all the time. So I thought about it for a second, and I remembered about how the API I work with, returns their properties in sentence case, instead of camel case.&lt;/p&gt;

&lt;p&gt;In our code base, we have a bunch of serialization files that basically tell ember that something like, FirstName is really firstName. Of course at a certain point, Ember has come up with a better solution for this, and we have converted from doing this way, to the new way. Ember Data expects your API to send you back the data in a certain way. When it does not, there are things you need to do to change that output to be Ember Data friendly.&lt;/p&gt;

&lt;p&gt;For you Ember developers out there, how would you answered this question? Comment and let me know.&lt;/p&gt;

</description>
      <category>ember</category>
    </item>
    <item>
      <title>Responsive Design with Safari Responsive Mode</title>
      <dc:creator>John Costanzo</dc:creator>
      <pubDate>Thu, 21 May 2020 18:10:28 +0000</pubDate>
      <link>https://dev.to/jrock2004/responsive-design-with-safari-responsive-mode-m7i</link>
      <guid>https://dev.to/jrock2004/responsive-design-with-safari-responsive-mode-m7i</guid>
      <description>&lt;p&gt;Today I learned that you can see how your website would look if a user on the iPad have your site docked to the side in split screen. I think this is really cool&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JnS5lHXH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/6CWIpYb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JnS5lHXH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/6CWIpYb.png" alt="Responsive Design with Safari Responsive Mode"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>safari</category>
      <category>webdesign</category>
    </item>
    <item>
      <title>What Developers Should Ask in QA Interview</title>
      <dc:creator>John Costanzo</dc:creator>
      <pubDate>Wed, 22 May 2019 11:05:50 +0000</pubDate>
      <link>https://dev.to/jrock2004/what-developers-should-ask-in-qa-interview-3fnj</link>
      <guid>https://dev.to/jrock2004/what-developers-should-ask-in-qa-interview-3fnj</guid>
      <description>&lt;p&gt;So I been started to ask to be part of the interview process for new possible new QA resources. As a developer what type of questions do you ask? I mean the person is already be asked QA type questions but the other QA people that are interviewing that person. But I was wondering what type of questions other devs ask. &lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Should I get 2nd Monitor for 27" iMac</title>
      <dc:creator>John Costanzo</dc:creator>
      <pubDate>Mon, 25 Feb 2019 01:45:00 +0000</pubDate>
      <link>https://dev.to/jrock2004/should-i-get-2nd-monitor-for-27-imac-4aee</link>
      <guid>https://dev.to/jrock2004/should-i-get-2nd-monitor-for-27-imac-4aee</guid>
      <description>&lt;p&gt;I am wonder that if at this time if more people are going back to single monitor. I have the nice iMac display then I have a 30: monitor. The height is all different and just not sure if the headache of fixing is worth it. With Mac OS and the iMac can I get by with just it, or do people think the 2nd monitor is still a requirement.&lt;/p&gt;

&lt;p&gt;What I do with my iMac, is I do web development and some sketch work. Thoughts by other people on what they do. &lt;/p&gt;

</description>
      <category>imac</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Is WSL enough to Switch</title>
      <dc:creator>John Costanzo</dc:creator>
      <pubDate>Mon, 16 Apr 2018 22:44:34 +0000</pubDate>
      <link>https://dev.to/jrock2004/is-wsl-enough-to-switch-2432</link>
      <guid>https://dev.to/jrock2004/is-wsl-enough-to-switch-2432</guid>
      <description>&lt;p&gt;So I’m not expecting people to say no because of Windows privacy concerns. I’m looking for peoples opinion if WSL is at a point that you switch from Linux or Mac to development fully in WSL?&lt;/p&gt;

&lt;p&gt;I am seriously considering it. &lt;/p&gt;

</description>
      <category>wsl</category>
      <category>development</category>
    </item>
    <item>
      <title>A simple interview question</title>
      <dc:creator>John Costanzo</dc:creator>
      <pubDate>Wed, 25 Oct 2017 16:43:02 +0000</pubDate>
      <link>https://dev.to/jrock2004/a-simple-interview-question-1an</link>
      <guid>https://dev.to/jrock2004/a-simple-interview-question-1an</guid>
      <description>&lt;p&gt;I went on an interview and I was asked a question like the one in the codepen. I was asked to fix it as its broken. Just curious how others would answer this one&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/jrock2004/pen/rGXMxP/"&gt;Here it is on CodePen&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>jquery</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Piping to fzf</title>
      <dc:creator>John Costanzo</dc:creator>
      <pubDate>Tue, 08 Aug 2017 15:26:31 +0000</pubDate>
      <link>https://dev.to/jrock2004/piping-to-fzf</link>
      <guid>https://dev.to/jrock2004/piping-to-fzf</guid>
      <description>&lt;p&gt;So what are some good aliases that you have setup in your zshrc for using FZF? Let me give you some examples of what I have and maybe you can comment on some of your that might be interesting to others.&lt;/p&gt;

&lt;p&gt;Some of these I have found on the internet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;gcorb&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'gco --track $(git branch -r | fzf)'&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;gcob&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'gco $(git branch | fzf)'&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;gmob&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'git merge $(git branch | fzf)'&lt;/span&gt;

fkill&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;kill&lt;/span&gt; &lt;span class="nt"&gt;-9&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;ps ax | fzf | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{ print $1 }'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;apps&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'dpkg-query --show | fzf'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>fzf</category>
    </item>
  </channel>
</rss>
