<?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: Ty</title>
    <description>The latest articles on DEV Community by Ty (@xxtyb).</description>
    <link>https://dev.to/xxtyb</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F352406%2F0ed6ba4d-6f40-4bbb-82c7-581c9b7ef1ed.png</url>
      <title>DEV Community: Ty</title>
      <link>https://dev.to/xxtyb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xxtyb"/>
    <language>en</language>
    <item>
      <title>Using API with Discord Bots</title>
      <dc:creator>Ty</dc:creator>
      <pubDate>Sun, 23 Aug 2020 01:54:11 +0000</pubDate>
      <link>https://dev.to/xxtyb/using-api-with-discord-bots-4k2k</link>
      <guid>https://dev.to/xxtyb/using-api-with-discord-bots-4k2k</guid>
      <description>&lt;p&gt;Welcome back to my weekly discord bot update. This time, I'll be using MyAnimeList api to write a cool search function with our discord bot!&lt;/p&gt;

&lt;p&gt;Unfortunately, there is no real api for myanimelist yet. But there are current plans for an early official release. Our discord bot will be making use of Jikan which you can find the documentation &lt;a href="https://jikan.moe/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Taking a look at this unofficial api, there has been already implementation for nodejs for this api!Thank you to xy137 for creating the github and making it easy for us to use Jikan!&lt;br&gt;
&lt;a href="https://github.com/xy137/jikan-node"&gt;NodeJS Github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Installation of this api is easy as pie! First we would want to install the packages with &lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install jikan-node --save&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And you're done! In order to use the api you'll only need to add two lines of code which are&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const Jikan = require('jikan-node');&lt;br&gt;
const mal = new Jikan();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We're just calling jikan through mal and wanting to use their search anime function.&lt;/p&gt;

&lt;p&gt;Here is a basic fetch in order to grab an anime I want to search up.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mal.search("anime", args, "page")&lt;br&gt;
.then(info =&amp;gt; console.log(info)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With this one function, we're able to search up an anime with what the user typed.&lt;/p&gt;

&lt;p&gt;I'll be breaking down the function! &lt;strong&gt;mal&lt;/strong&gt; is Jikan and we would want to use the search function. &lt;strong&gt;anime&lt;/strong&gt; is the a string that we want the type for. This can be interchangeable with people or manga as well. &lt;strong&gt;args&lt;/strong&gt; is what the user searched for, and &lt;strong&gt;page&lt;/strong&gt; is the result we would want about the anime.&lt;/p&gt;

&lt;p&gt;This would bring us a result of of what we had search for. Since this is going to bring us an array of animes. You can look at your console.log and see what would you want to do with the results you have received.&lt;/p&gt;

&lt;p&gt;Since I just want to find the first result of an anime and put it into a embed message, my code looks like &lt;/p&gt;

&lt;p&gt;&lt;code&gt;mal.search("anime", args, "page")&lt;br&gt;
        .then(info =&amp;gt; { &lt;br&gt;
            const exampleEmbed = new Discord.MessageEmbed()&lt;br&gt;
            .setColor('#0099ff')&lt;br&gt;
            .setTitle(`${info.results[0].title}`)&lt;br&gt;
            .setURL(`${info.results[0].url}`)&lt;br&gt;
            .setAuthor('Chulainn')&lt;br&gt;
            .setDescription(`${info.results[0].synopsis}`)&lt;br&gt;
            .addFields(&lt;br&gt;
                { name: 'Rating', value: `${info.results[0].score}` },&lt;br&gt;
            )&lt;br&gt;
            .setImage(`${info.results[0].image_url}`)&lt;br&gt;
            .setTimestamp()&lt;br&gt;
            .setFooter('Brought to you by Chulain');&lt;br&gt;
            message.channel.send(exampleEmbed)&lt;br&gt;
        })&lt;br&gt;
        .catch(err =&amp;gt; console.log(err))&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bvBdjXmY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.discordapp.net/attachments/730946903835017277/746909843238944860/sFInb67.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bvBdjXmY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.discordapp.net/attachments/730946903835017277/746909843238944860/sFInb67.png" alt="My output looks like this!"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Making Discord Bot Commands</title>
      <dc:creator>Ty</dc:creator>
      <pubDate>Sat, 15 Aug 2020 23:22:17 +0000</pubDate>
      <link>https://dev.to/xxtyb/making-discord-bot-commands-3kef</link>
      <guid>https://dev.to/xxtyb/making-discord-bot-commands-3kef</guid>
      <description>&lt;p&gt;Oh boy! Another week has passed and I learned a lot more about discord bots in general. Discord.js makes everything so simple to run and use!&lt;/p&gt;

&lt;p&gt;Today, I want to write about just coding a simple discord command. This would just output Hello world!&lt;/p&gt;

&lt;p&gt;So first we would start on how to actually get what messages are being sent on your discord server&lt;/p&gt;

&lt;p&gt;Right under my previous code where I showed you how to turn on your discord bot, we're gonna add a code to listen for any messages that may start with !hi&lt;/p&gt;

&lt;p&gt;But first lets get the basics up on how to actually get messages from your discord server&lt;/p&gt;

&lt;p&gt;Under your &lt;em&gt;client.login&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We're going to add &lt;br&gt;
&lt;code&gt;client.on('message', message =&amp;gt; {&lt;br&gt;
})};&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Inside this code block is how we'll be getting our messages!&lt;/p&gt;

&lt;p&gt;So we want the only the message content, not any other thing. Inside the code block lets check for the message to say !hi&lt;br&gt;
&lt;code&gt;client.on('message', message =&amp;gt; {&lt;br&gt;
   if (message.content === `!hi`) &lt;br&gt;
})};&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we're checking if the message is exactly !hi&lt;br&gt;
Now lets output something back!&lt;/p&gt;

&lt;p&gt;&lt;code&gt;client.on('message', message =&amp;gt; {&lt;br&gt;
   if (message.content === `!hi`) {&lt;br&gt;
   message.channel.send('Greetings.');&lt;br&gt;
}&lt;br&gt;
})};&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Message.channel.send basically is your bot outputting message into that discord server channel and only that channel. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C0O1rbV8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/fccSt0W.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C0O1rbV8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/fccSt0W.png" alt="It should look something like this at the end"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>First Steps of discord bots</title>
      <dc:creator>Ty</dc:creator>
      <pubDate>Sun, 09 Aug 2020 00:11:17 +0000</pubDate>
      <link>https://dev.to/xxtyb/first-steps-of-discord-bots-3hno</link>
      <guid>https://dev.to/xxtyb/first-steps-of-discord-bots-3hno</guid>
      <description>&lt;p&gt;So today, I've decided to enter the realm of creating a discord bot. For those who are unfamiliar with discord. It's basically another version of slack which you can communicate with people around the world and even voice chat. &lt;/p&gt;

&lt;p&gt;I decided on creating a discord bot just to have fun and see what I can do in order to help my daily life. Maybe make it have eval command for my personal use. &lt;/p&gt;

&lt;p&gt;But as of right now, I want to note on the process of just even putting the discord bot online.&lt;/p&gt;

&lt;p&gt;First, we need to create our bot on the discord developer site which is located &lt;a href="https://discord.com/developers/applications/"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create your bot and get your token. Make sure no one knows the token and don't accidentally upload it to github!&lt;/p&gt;

&lt;p&gt;Next, I use visual studio code in order to create my bot, but lets create a config.json and add in our bot token variable!&lt;br&gt;
It should look something like &lt;/p&gt;

&lt;p&gt;&lt;code&gt;"BOT_TOKEN": "BOT TOKEN"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Make sure to also use &lt;em&gt;npm init&lt;/em&gt; to create your package.json&lt;/p&gt;

&lt;p&gt;afterwards use npm install discord.js. This will install discords api.&lt;/p&gt;

&lt;p&gt;Last step in order for your discord bot to go online, you'll need to make a index.js with a few line of code&lt;/p&gt;

&lt;p&gt;The code should look something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Discord = require("discord.js");
const config = require("./config.json");
const client = new Discord.Client();

client.login(config.BOT_TOKEN);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now test it by running node index.js!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Using api's with react</title>
      <dc:creator>Ty</dc:creator>
      <pubDate>Thu, 18 Jun 2020 21:58:06 +0000</pubDate>
      <link>https://dev.to/xxtyb/using-api-s-with-react-5aaf</link>
      <guid>https://dev.to/xxtyb/using-api-s-with-react-5aaf</guid>
      <description>&lt;p&gt;If there is a frontend, there has to be a backend for your website. Throughout my course with Flatiron, we utilized api's for our backend. Wether we made our own api with rails or used an external api, at least our project utilized some sort of api. &lt;/p&gt;

&lt;p&gt;While there are multiple api's any commercial use would need an api key. This api key would allow for only your product / website to be able to use a certain api. However there are plenty of free api sites that do not need an api key to use.&lt;br&gt;
&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--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/public-apis"&gt;
        public-apis
      &lt;/a&gt; / &lt;a href="https://github.com/public-apis/public-apis"&gt;
        public-apis
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A collective list of free APIs for use in software and web development.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;h1&gt;
Public APIs &lt;a href="https://github.com/public-apis/public-apis/actions?query=workflow%3A%22Run+tests%22"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YoSKOSvw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/public-apis/public-apis/workflows/Run%2520tests/badge.svg" alt="Run tests"&gt;&lt;/a&gt; &lt;a href="https://github.com/public-apis/public-apis/actions?query=workflow%3A%22Validate+links%22"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C8IDae6---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/public-apis/public-apis/workflows/Validate%2520links/badge.svg%3Fbranch%3Dmaster" alt="Validate links"&gt;&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;A collective list of free APIs for use in software and web development.&lt;/p&gt;
&lt;p&gt;A public API for this project can be found &lt;a href="https://github.com/davemachado/public-api"&gt;here&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;For information on contributing to this project, please see the &lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/.github/CONTRIBUTING.md"&gt;contributing guide&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Please note a passing build status indicates all listed APIs are available since the last update. A failing build status indicates that 1 or more services may be unavailable at the moment.&lt;/p&gt;
&lt;h2&gt;
Index&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#animals"&gt;Animals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#anime"&gt;Anime&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#anti-malware"&gt;Anti-Malware&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#art--design"&gt;Art &amp;amp; Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#books"&gt;Books&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#business"&gt;Business&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#calendar"&gt;Calendar&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#cloud-storage--file-sharing"&gt;Cloud Storage &amp;amp; File Sharing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#continuous-integration"&gt;Continuous Integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#cryptocurrency"&gt;Cryptocurrency&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#currency-exchange"&gt;Currency Exchange&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#data-validation"&gt;Data Validation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#development"&gt;Development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#dictionaries"&gt;Dictionaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#documents--productivity"&gt;Documents &amp;amp; Productivity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#environment"&gt;Environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#events"&gt;Events&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#finance"&gt;Finance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#food--drink"&gt;Food &amp;amp; Drink&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#games--comics"&gt;Games &amp;amp; Comics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#geocoding"&gt;Geocoding&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#government"&gt;Government&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#health"&gt;Health&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#jobs"&gt;Jobs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#machine-learning"&gt;Machine Learning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#music"&gt;Music&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#news"&gt;News&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#open-data"&gt;Open Data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#open-source-projects"&gt;Open Source Projects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#patent"&gt;Patent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#personality"&gt;Personality&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#photography"&gt;Photography&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#science--math"&gt;Science &amp;amp; Math&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#security"&gt;Security&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#shopping"&gt;Shopping&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#social"&gt;Social&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#sports--fitness"&gt;Sports &amp;amp; Fitness&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#test-data"&gt;Test Data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#text-analysis"&gt;Text Analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#tracking"&gt;Tracking&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#transportation"&gt;Transportation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#url-shorteners"&gt;URL Shorteners&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#vehicle"&gt;Vehicle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#video"&gt;Video&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/public-apis/public-apis/master/#weather"&gt;Weather&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Animals&lt;/h3&gt;
&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;API&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Auth&lt;/th&gt;
&lt;th&gt;HTTPS&lt;/th&gt;
&lt;th&gt;CORS&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://alexwohlbruck.github.io/cat-facts/" rel="nofollow"&gt;Cat&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;…&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/public-apis/public-apis"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;I would use this website as a starter on learning api's!&lt;/p&gt;

&lt;p&gt;When using react, you would use a fetch method to get the info that you need. You have many ways in order to fetch from the api. I would prefer to either handle it by a button press, or an asynchronous event such as ComponentDidMount. &lt;/p&gt;

&lt;p&gt;While using ComponentDidMount, you would do a simple fetch request and save it to your state. The fetch would run automatically on page load.&lt;/p&gt;

&lt;p&gt;An example code of the fetch to an api would look like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch("https://www.themealdb.com/api/json/v1/1/random.php")
        .then(resp =&amp;gt; resp.json())
        .then(data =&amp;gt; {
            this.setState({food: data})
        })
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, I am using a free api called themealdb in order to get a random recipe. This would allow me to save one random food into my food state which I can call at anytime throughout the page or even pass it down to other pages as well.&lt;/p&gt;

&lt;p&gt;This api does not need an api key, but if it did need an api key, make sure to store it in your development environment table instead of the actual code. You want your api to be hidden to the public so no one can use that key besides you!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Sorts</title>
      <dc:creator>Ty</dc:creator>
      <pubDate>Thu, 21 May 2020 19:31:28 +0000</pubDate>
      <link>https://dev.to/xxtyb/sorts-23no</link>
      <guid>https://dev.to/xxtyb/sorts-23no</guid>
      <description>&lt;p&gt;Sorts, oh sorts. A simple function but multiple ways to do them. During my dicussion questions in Flatiron. We were introduce to sorts and how they visually worked in react. Which was super fascinating to learn and also, I wanted to know more about algorithms. So I dove head first into sorts. Let's start with the two easiest sorts! Selection sort and insertion sort. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // One by one move boundary of unsorted subarray 
    int n = arr.length; 

    for (int i = 0; i &amp;lt; n-1; i++) 
    { 
        // Find the minimum element in unsorted array 
        int min_idx = i; 
        for (int j = i+1; j &amp;lt; n; j++) 
            if (arr[j] &amp;lt; arr[min_idx]) 
                min_idx = j; 

        // Swap the found minimum element with the first 
        // element 
        int temp = arr[min_idx]; 
        arr[min_idx] = arr[i]; 
        arr[i] = temp; 
    } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;What a selection sort is that it grabs the lowest number and put it to the front. Example on the first iteration, it'll grab index 0 and go through all the numbers in the array to find the lowest. Then it'll swap the element to the front if there is a lower number within the array length. &lt;br&gt;
EX - 3, 4, 1, 5&lt;br&gt;
It'll start with 3 and check if 4 &amp;lt; 3, or 1 &amp;lt; 3. Once that is true, the 1 and 3 swap places to be 1, 4, 3, 5. This repeat's til the end of the loop.&lt;/p&gt;

&lt;p&gt;Another sort i'll be talking about is insertion sort. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    int n = arr.length; 
    for (int i = 1; i &amp;lt; n; ++i) { 
        int key = arr[i]; 
        int j = i - 1; 

        /* Move elements of arr[0..i-1], that are 
           greater than key, to one position ahead 
           of their current position */
        while (j &amp;gt;= 0 &amp;amp;&amp;amp; arr[j] &amp;gt; key) { 
            arr[j + 1] = arr[j]; 
            j = j - 1; 
        } 
        arr[j + 1] = key; 
    } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Basically insertion is backwards and how we would be doing if we played cards. It will check the current index and see if its lower than the previous index before. It will check and see if its greater then the number before and less than the number that comes after. If we have a card of 3 2 1 5. The first loop will stay the same. But on the 2nd loop, it'll check if 2 is less than 3. So it'll be changed to 2, 3, 1, 5. The same would happen to 1, it'll check if 1 is less than 3, and it is. But it'll check again if it is less than one, and it is as well. So the array would change to 1 2 3 5. Now it checks if 5 is less than 3, but it is not. So the element stays on the current index and the loop is done.  &lt;/p&gt;

&lt;p&gt;It is interesting to see on how sorts work and there are many more types of sorts out there such as bubble sort. It is great to know the difference of each sort and learn the algorithm!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>JavaScript Arrays</title>
      <dc:creator>Ty</dc:creator>
      <pubDate>Thu, 30 Apr 2020 19:38:26 +0000</pubDate>
      <link>https://dev.to/xxtyb/javascript-arrays-43ob</link>
      <guid>https://dev.to/xxtyb/javascript-arrays-43ob</guid>
      <description>&lt;p&gt;Every language has their own array. But Java has a special place in my heart. While it is similar to Ruby in my experience. There are different methods that would help with you learning JavaScript. &lt;/p&gt;

&lt;p&gt;Like any other arrays, the index of an array will always start at 0, and increment by 1. &lt;/p&gt;

&lt;p&gt;First you have your common methods such as &lt;strong&gt;push(), pop(), shift(), reverse()&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Push -&amp;gt; This method will allow you to add an element to the end of the array&lt;/p&gt;

&lt;p&gt;Shift -&amp;gt; This method removes the first element of the array&lt;/p&gt;

&lt;p&gt;Pop -&amp;gt; This method removes the last element of the array&lt;/p&gt;

&lt;p&gt;reverse -&amp;gt; This method will change the whole array order in reverse.&lt;/p&gt;

&lt;p&gt;However there are some methods that can help you iterate through a whole array.&lt;/p&gt;

&lt;p&gt;We have methods such as &lt;strong&gt;forEach(), and map()&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;forEach -&amp;gt; Executes a function that is used for every element in the array&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z-dPnlEp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/gWVj8pJ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z-dPnlEp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/gWVj8pJ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;map -&amp;gt; Returns a new array that is filled by the function that is being called on each element of the array&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0xTkg0y1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/KBzJxTo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0xTkg0y1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/KBzJxTo.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Knowing these arrays method would help you get through the basics of JavaScript and it is what I used the most on the daily. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>HTML Basics</title>
      <dc:creator>Ty</dc:creator>
      <pubDate>Wed, 08 Apr 2020 04:13:24 +0000</pubDate>
      <link>https://dev.to/xxtyb/html-basics-5910</link>
      <guid>https://dev.to/xxtyb/html-basics-5910</guid>
      <description>&lt;p&gt;While doing module 2 for my bootcamp at Flatiron school. We have completed many labs where html was needed. HTML may seem like munbo gumbo but it is really straight forward. Here are a few html basics that has helped me through my labs. &lt;/p&gt;

&lt;p&gt;Need to know lists? There are two easy lists you could do which are unordered and ordered lists.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;ul&amp;gt;
&amp;lt;li&amp;gt;Corgi&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;Husky&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an unorder list. You can tell with "ul instead of "ol" which are just sorten for what they mean. "li" basically means list and that you are adding it to the unorder or ordered list. Remember to close your lists with "/ul" or "/ol" and make sure they match what you had started with!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;ol&amp;gt;
&amp;lt;li&amp;gt;Corgi&amp;lt;/li&amp;gt;
&amp;lt;li&amp;gt;Husky&amp;lt;/li&amp;gt;
&amp;lt;/ol&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Want to add clickable links? Well thats really simple as well you would use the tag "href" here is an example!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;a href="Link"&amp;gt;Name of the link&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here it is in production!&lt;/p&gt;

&lt;p&gt;&lt;a href="Google.com"&gt;Click here to redirect to google!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;a means anchor, and you are referencing the link with href. Afterward, you would have the name or text or the link that users are able to click on!&lt;/p&gt;

&lt;p&gt;There are many other basic tags to add words to your website as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h1&amp;gt;&amp;lt;/h1&amp;gt; - Which is your header 
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt; - Which is your paragraph
&amp;lt;br&amp;gt; - to make a new line
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are to help you create basic descriptions, title headers, or just having a new line. &lt;/p&gt;

&lt;p&gt;An advanced tag would be making a form! Here is an example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form&amp;gt;
  &amp;lt;label for="dog_name"&amp;gt;Dog name:&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;
  &amp;lt;input type="text" id="dog_name" name="dog_name"&amp;gt;&amp;lt;br&amp;gt;
  &amp;lt;label for="breed"&amp;gt;breed:&amp;lt;/label&amp;gt;&amp;lt;br&amp;gt;
  &amp;lt;input type="text" id="breed" name="breed"&amp;gt;&amp;lt;br&amp;gt;
  &amp;lt;input type="submit" name="submit"&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which looks like this in production!&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7Wq-UZP4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/E9UT5Ph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7Wq-UZP4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/E9UT5Ph.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These have been the most used html code so far during my labs. It is very helpful to learn the basics to help you get prepared for the more advanced html codes!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Experience with Ruby</title>
      <dc:creator>Ty</dc:creator>
      <pubDate>Wed, 18 Mar 2020 17:33:19 +0000</pubDate>
      <link>https://dev.to/xxtyb/experience-with-ruby-539h</link>
      <guid>https://dev.to/xxtyb/experience-with-ruby-539h</guid>
      <description>&lt;p&gt;I have never heard of ruby until late 2019. As a community college student I have been focused on Java and C++. Hearing about ruby as a great introduction language got me curious. Joining my bootcamp, the first module we learned were the basics of ruby. While working on my assignments with ruby, there were many similarities with java and C++. However Ruby has its own unique twist to them, more so, simplified. &lt;/p&gt;

&lt;p&gt;Example making a method&lt;/p&gt;

&lt;p&gt;For Ruby it is much simpler making a method compared to Java&lt;/p&gt;

&lt;p&gt;def methodname&lt;/p&gt;

&lt;p&gt;end&lt;/p&gt;

&lt;p&gt;You only have to type 3 words. Defining the method name and ending that code block.&lt;/p&gt;

&lt;p&gt;Such as Java, it'll take you a little longer to write a method. Since you would have to call the datatype of the method and wether the method is public or private.&lt;/p&gt;

&lt;p&gt;public static string methodname {&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Even then it's the small things that makes you appreciate Ruby. Such as not using { } for if statements or loops. Even having more built in methods was a huge plus. &lt;/p&gt;

&lt;p&gt;Example, need to know the min-max of an array? There's a method for that literally called 'min-max'! Need to remove duplicates in an array? Theres another easy method for that called '.uniq'.&lt;/p&gt;

&lt;p&gt;Not only that, you do not need to set a type for your variable. No longer needing to say 'int var' or 'string var', you can just type 'var = nil' &lt;br&gt;
and var could be any datatype. It could hold a float, double, integer, string, and more without needing to specify. &lt;/p&gt;

&lt;p&gt;Whats even crazy is that you can use macros in order to write most of your setters and getters. Instead of typing out every method for your getters and setters. You can use "attr_accessor, attr_writer, and attr_reader" for your setters and getters. No more writing set and get. Everything can be stored in one whole line!&lt;/p&gt;

&lt;p&gt;Which is why I say Ruby is such a good introduction language. It super simplified which in terms helps remove common errors like using the wrong datatype for a variable. ("Using integer when you need it as a double") &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
