<?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: Mykal</title>
    <description>The latest articles on DEV Community by Mykal (@mykalcodes).</description>
    <link>https://dev.to/mykalcodes</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%2F101284%2Fd6b0e368-0354-4373-af21-f9e7cf99465d.jpg</url>
      <title>DEV Community: Mykal</title>
      <link>https://dev.to/mykalcodes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mykalcodes"/>
    <language>en</language>
    <item>
      <title>Previewing Hidden Content in an Unpublished Shopify Theme</title>
      <dc:creator>Mykal</dc:creator>
      <pubDate>Wed, 08 Jul 2020 19:22:42 +0000</pubDate>
      <link>https://dev.to/mykalcodes/previewing-hidden-content-in-an-unpublished-shopify-theme-mfa</link>
      <guid>https://dev.to/mykalcodes/previewing-hidden-content-in-an-unpublished-shopify-theme-mfa</guid>
      <description>&lt;h2&gt;
  
  
  What's the Issue?
&lt;/h2&gt;

&lt;p&gt;You're working on a brand new product for your Shopify store, it's set to unavailable and you &amp;amp; the team are working on a launch for it later this month. &lt;/p&gt;

&lt;p&gt;You're also working on a new theme that will launch alongside your product, &lt;strong&gt;how are you supposed to see how that new product looks with your new theme?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;You can preview the new product, but it opens in the published theme, not the new theme you're working on... &lt;/p&gt;

&lt;p&gt;So do you have to make your new product available and just hope no one notices? 😥 &lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution!
&lt;/h2&gt;

&lt;p&gt;Thankfully, there's a way we can get around this! &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your Shopify admin to your hidden product, and click "Preview" at the top of the page&lt;/li&gt;
&lt;li&gt;From the product's preview page, copy the part of the URL that looks like this: &lt;code&gt;/products_preview?preview_key=your_key_goes_here&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;In a new tab, open the new theme you're working in as a preview. &lt;/li&gt;
&lt;li&gt;In the URL bar, paste the portion of the product URL we copied earlier. your new URL should look something like this &lt;code&gt;https://mystore.com/products_preview?preview_key=your_key_goes_here&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Hit enter and you should be able to preview your hidden product in your new theme ✨🎉&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Not just for Products
&lt;/h2&gt;

&lt;p&gt;This will work for hidden pages, and articles as well! Which is great when you're working on a landing page or a fancy new blog template! &lt;/p&gt;

&lt;p&gt;This has been a huge pain for me when working on themes, and I just recently found this quick fix so I thought I'd share! Hopefully it helped you as well.&lt;/p&gt;

&lt;p&gt;Thanks for reading 👋&lt;/p&gt;

</description>
      <category>shopify</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>ZEIT Hackathon 2019: My First Server-less Hackathon</title>
      <dc:creator>Mykal</dc:creator>
      <pubDate>Thu, 06 Jun 2019 18:39:10 +0000</pubDate>
      <link>https://dev.to/mykalcodes/zeit-hackathon-2019-a-retrospective-3goe</link>
      <guid>https://dev.to/mykalcodes/zeit-hackathon-2019-a-retrospective-3goe</guid>
      <description>&lt;p&gt;This past weekend, I participated in &lt;a href="https://zeit.co/hackathon" rel="noopener noreferrer"&gt;ZEIT's first ever Hackathon&lt;/a&gt;. It was a 48-hour event that was centred around building an integration for ZEIT's "now" server-less hosting platform. I had never worked with Now before, but I love a lot of ZEIT's other software (&lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;Next.js&lt;/a&gt; &amp;amp; &lt;a href="https://hyper.is/" rel="noopener noreferrer"&gt;Hyper.js&lt;/a&gt;) and I figured this would be a good opportunity to learn about Now through building a little project with it. &lt;/p&gt;

&lt;p&gt;This post is going to go over what I built, what I learned, and some takeaways for my next Hackathon.  &lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I was initially having trouble coming up with an Idea for the hackathon. I spent some time in the event's slack looking at ideas but nothing really came to me. So, by the recommendation of the event organisers, I decided to build an integration with one of their Sponsors: &lt;a href="https://www.twilio.com/" rel="noopener noreferrer"&gt;Twilio&lt;/a&gt;! &lt;/p&gt;

&lt;p&gt;I ended up putting together a dead simple token manager integration that allows users to manage multiple Twilio authentication tokens and accounts across different deployments! When looking through the docs, I noticed that Now allows you to pass in environment variables into your projects through their API. I used this feature as a starting point, and after 48 hours (only around 16 hours of which I was actually coding) I had my integration!&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%2F7pwf5hk91x2nq6bvhkhu.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%2F7pwf5hk91x2nq6bvhkhu.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the end, all my integration really allows you to do is pass in some Twilio Credentials as Environment Variables and manage which projects have access to which credentials. If you use Now you can check it out at its Now Marketplace link &lt;a href="https://zeit.co/integrations/twilio-now" rel="noopener noreferrer"&gt;here&lt;/a&gt; or check out the documentation at &lt;a href="https://twilionow.tech" rel="noopener noreferrer"&gt;twilionow.tech&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Server-less is Awesome (most of the time)
&lt;/h3&gt;

&lt;p&gt;Now is a server-less hosting platform. At the start of the Hackathon, I knew Now was a server-less deployment but I didn't understand what that meant in practice. Essentially, all of your Now projects are broken into a bunch of cloud-based functions called "AWS Lambda" functions. This has a few major benefits: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost Savings:&lt;/strong&gt; Apps only use compute-power when they're in use, greatly reducing the cost of the app in the first place* &lt;strong&gt;Crazy-fast Deployments:&lt;/strong&gt; Apps literally take 10-15 seconds to go from local to live with Now which saves time and overall just feels really cool.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CDN without the work&lt;/strong&gt;: Now allows you to duplicate your app across their servers which are placed throughout the world with a few lines of config (seriously it's crazy simple, see &lt;a href="https://zeit.co/docs/v2/deployments/concepts/cdn-and-global-distribution/" rel="noopener noreferrer"&gt;here&lt;/a&gt;) &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While all of this stuff is super cool, I did encounter a few issues with Now and Server-less:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Things don't work as expected:&lt;/strong&gt; when trying to build out an example Node.js/Express app to demo my integration, I quickly realized I couldn't build just any old express app. I would need to have a &lt;a href="https://github.com/zeit/now-examples/tree/master/express" rel="noopener noreferrer"&gt;lambda based setup&lt;/a&gt; where each endpoint is in a separate .js file, among other things. Building my example app took way longer than expected because this setup was so much different than what I was used to. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  I Need Clean Code
&lt;/h3&gt;

&lt;p&gt;Despite the event's hackathon name, I felt like the hackier I was in my integration, the less efficient I became. &lt;/p&gt;

&lt;p&gt;After the first day of programming, most of my code was still in one file and it felt like an absolute mess to work in. Every time I had to make a change it would take a minute to even really understand what my code was doing. When I finally figured it out, I would often have forgotten what I was even trying to do in the first place, leaving me at square 1 all over again.&lt;/p&gt;

&lt;p&gt;At the start of day two, I did some hardcore code cleaning. I moved all my template literals (which I was using to build the integration's UI) to their own component-based files, which I then imported into pages, and broke my app logic into a few separate files as well.  &lt;/p&gt;

&lt;p&gt;This not only saved me probably 1-2 hours of programming time on day 2, but it also made me feel much better when writing code, which allowed me to really get into my code for longer.&lt;/p&gt;

&lt;p&gt;This might not apply to anyone, but I personally wished I would have just started a little more organised and known from the start I need a (relatively) clean codebase to be efficient. &lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways For The Next Hackathon
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Read the Documentation Beforehand
&lt;/h3&gt;

&lt;p&gt;The ZEIT integration platform has &lt;strong&gt;awesome&lt;/strong&gt; &lt;a href="https://zeit.co/docs" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;. It's super in-depth, well-organized, and has guides and open-source code as examples. That said, I didn't spend nearly as much time as I should have in the docs &lt;strong&gt;before the event&lt;/strong&gt;. I often found myself breaking my integration, writing a fix, and testing it, just to go to the documentation and find an awesome, well-explained example of the exact thing I was trying to build. &lt;/p&gt;

&lt;p&gt;This all could have been solved with a solid once-over of the docs the week before the event. Skimming through the documentation would have maybe taken an hour to do and probably would have saved me at least two or three hours of time spent rewriting my code. &lt;/p&gt;

&lt;h3&gt;
  
  
  Minimize Distractions
&lt;/h3&gt;

&lt;p&gt;Admittedly, I didn't spend nearly as much time as I wanted to on this Hackathon. Despite it being a 48-hour hackathon, I probably spent less than a day of actual focused time working on my integration and the final product reflects that. I didn't adequately prepare for the event or let the people around me know I was going to be AWOL which often pulled me away from VS Code, and into the real world for long periods of time. For example: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Saturday afternoon I had a friend come over to hang out.&lt;/li&gt;
&lt;li&gt;Saturday night I went out to a movie I'd promised to go see.&lt;/li&gt;
&lt;li&gt;Sunday night I rushed to finish my integration so I could go out for a previously planned date. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If I could do it over again, I would either go all in on the hackathon or just have my normal weekend. By trying to mix the two, I took away time and from my integration, and ended up being either late or stressed out when hanging out with friends &amp;amp; family.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Overall, it was a great weekend!I learned about server-less, made some friends in the Hacakthon's slack, and got another opportunity to grow as a Developer! &lt;/p&gt;

&lt;p&gt;Also, I want to give a huge thanks to the Whole ZEIT team for throwing this event. They were super encouraging, answered a bunch of my questions and made participating online a blast!&lt;/p&gt;

</description>
      <category>hackathon</category>
      <category>javascript</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Preparing for Battlesnake</title>
      <dc:creator>Mykal</dc:creator>
      <pubDate>Thu, 04 Apr 2019 20:26:53 +0000</pubDate>
      <link>https://dev.to/mykalmachon/preparing-for-battlesnake-4bl5</link>
      <guid>https://dev.to/mykalmachon/preparing-for-battlesnake-4bl5</guid>
      <description>&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%2Ftq0l5cyh01gay0mh8agx.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%2Ftq0l5cyh01gay0mh8agx.png" alt="My snake AI in action: the pink one"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This year's Battlesnake competition takes place on March 2nd 2019 at the Victoria Convention Center and I've got quite a bit of preparation to do before then.&lt;/p&gt;

&lt;h3&gt;
  
  
  But Wait a second... what's Battlesnake?
&lt;/h3&gt;

&lt;p&gt;In the organizer's words...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Battlesnake is a fun way to practice programming and learn new skills. Groups and individuals build AI bots to play the game Snake using modern, real-world technology. Read the docs, deploy your snake to a live web server, and join other programmers trying be the last snake slithering. (&lt;a href="https://play.battlesnake.io/" rel="noopener noreferrer"&gt;Battlesnake.io&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you've ever played the classic game &lt;strong&gt;snake&lt;/strong&gt; on your phone or computer, you know exactly what a battlesnake arena looks like.&lt;/p&gt;

&lt;p&gt;Just imagine instead of one snake on the screen, there are 4-5 of them. All fighting for the same food and space with the best programmed snake taking home a cash prize and the esteemed title of Battlesnake Champ.&lt;/p&gt;

&lt;p&gt;Sounds fun right? I thought so! If you're still not convinced, &lt;a href="https://www.youtube.com/watch?v=ygvQds0C1X8" rel="noopener noreferrer"&gt;here's a video&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  My Goals for Battlesnake This Year
&lt;/h3&gt;

&lt;p&gt;Since I've got the fundamentals down, I'm taking battlesnake as an opportunity to spend some time sharpening my pathfinding skills and programming a snake that can at least sort of stand on its own two, metaphorical, legs.&lt;/p&gt;

&lt;p&gt;While, in a perfect world, I'd be spending hours on this a night, I've got midterms the week of and the week after battlesnake so I'm going to have to prioritize a little bit.&lt;/p&gt;

&lt;h4&gt;
  
  
  Priority #1: Self Sustaining
&lt;/h4&gt;

&lt;p&gt;This is the very bare minimum I'd like to get my snake AI to.&lt;/p&gt;

&lt;p&gt;At this level my snake should be able to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Not kill itself by running into its own body / other snakes / walls...&lt;/li&gt;
&lt;li&gt;Be able to find a route to food in the area and determine whether it can do so before any other snakes.&lt;/li&gt;
&lt;li&gt;As a result of 1 + 2, be able to be &lt;em&gt;self-sustaining&lt;/em&gt; if it is the only snake in an arena.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Priority #2: Basic Pathfinding
&lt;/h4&gt;

&lt;p&gt;This is where I realistically feel that I should be able to get the snake to before the competition.&lt;/p&gt;

&lt;p&gt;At this level my snake should be able to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Do everything that a self-sustaining snake could do&lt;/li&gt;
&lt;li&gt;Have some sort of intrinsic goal. For example, always be on the move for food, or always be trying to trap other snakes.&lt;/li&gt;
&lt;li&gt;Have a basic weighting system where the snake can determine which move would be best and act on that.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Priority #3: Getting Fancy
&lt;/h4&gt;

&lt;p&gt;These are the things I think would be really cool to play around with, but doubt I will actually get to implement.&lt;/p&gt;

&lt;p&gt;At this level my snake should be able to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Do everything a Basic Pathfinding snake could do.&lt;/li&gt;
&lt;li&gt;Be operating off a trained neural network. Most likely something built through OpenAI or Clarifai&lt;/li&gt;
&lt;li&gt;Capability to autonomously improve or "learn" after each match through the use of machine learning.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I've never used any AI tech beyond using some very simple pre-trained facial recognition models. This would be a tonne of fun to play around with, but may be a little too far out of my wheelhouse to be achievable in two weeks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Closing Thoughts
&lt;/h3&gt;

&lt;p&gt;This is actually my second year attending BattleSnake. I first attended in 2017, my first year of university. I don't think my team and I could even get the snake to change directions. We were all pretty inexperienced developers at the time and had never worked with, or even heard of, tools like Node.js or Heroku.&lt;/p&gt;

&lt;p&gt;Despite our lack of knowledge, We had a tonne of fun! The event's atmosphere was awesome and I learned more about real-world development in that 5-6 hour event than I had all year in class. I remember feeling so proud that we even got our snake to respond with a 200 to the server.&lt;/p&gt;

&lt;p&gt;It's crazy to think that just two years ago I knew absolutely nothing about any of the technology I use on an almost daily basis today. I sometimes feel like I'm constantly losing a race with technology; Like I can never learn enough, fast enough, to feel caught up and knowledgeable.&lt;/p&gt;

&lt;p&gt;That said, Being able to look back on my skills in 2017 and contrast them to my skills today through the lens of something like battlesnake has really inspired me to prove to myself just how far I have come in that time. I can't wait to start this years snake!&lt;/p&gt;

&lt;p&gt;This post was originally written on February 18, 2019, &lt;a href="https://mykalmachon.com" rel="noopener noreferrer"&gt;for my personal blog.&lt;/a&gt; My snake AI went on to make it into the second round of the beginner's bracket 🎉! I’ve definitely made progress and I’m looking forward to making even more, come next year’s Battlesnake.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>justforfun</category>
    </item>
  </channel>
</rss>
