<?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: velocichaptor</title>
    <description>The latest articles on DEV Community by velocichaptor (@velocichaptor).</description>
    <link>https://dev.to/velocichaptor</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%2F470794%2F99a4235c-161e-4011-82fd-27ce2e1d966c.jpg</url>
      <title>DEV Community: velocichaptor</title>
      <link>https://dev.to/velocichaptor</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/velocichaptor"/>
    <language>en</language>
    <item>
      <title>Workin' Styles Real Quick! Semantic for ReactJS</title>
      <dc:creator>velocichaptor</dc:creator>
      <pubDate>Wed, 21 Apr 2021 20:22:26 +0000</pubDate>
      <link>https://dev.to/velocichaptor/workin-styles-real-quick-semantic-for-reactjs-5497</link>
      <guid>https://dev.to/velocichaptor/workin-styles-real-quick-semantic-for-reactjs-5497</guid>
      <description>&lt;p&gt;Web Dev bootcamps are a very draining experience. The deluge of information is unrelenting and difficult to manage. Anything that might be done to ease headaches could be considered a blessing!&lt;/p&gt;

&lt;p&gt;In labs, there are many quirky projects that provide pre-built chunks of apps with nice looking CSS that let us focus on the work at hand. When it comes to scratch built projects however, we don't have that luxury. And sometimes you just want something nice to look at while you're slamming your head against the wall trying to unlock the functionality of your amateur logic. &lt;/p&gt;

&lt;p&gt;In the past I have tried some other frameworks in the past but they've all left me a bit confused and unsure of their full potential. Recently I dove into Semantic UI for a React project, and I cannot believe how simple it was! So if you are like me and need shallow, pretty looking nascent web apps to keep you coding for your boot camp, check this out.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$  npm install semantic-ui-react semantic-ui-css&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Throw that command into your bash. And then, in your entry file (which is often index.js) include this line at the top with your imports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;semantic-ui-css/semantic.min.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the setup. I know it's crazy! &lt;/p&gt;

&lt;p&gt;Semantic is a front-end framework that allows you to style very quickly. Like Bootstrap, it has some pre-defined stylings and layouts that allow you to put together a site lickity split. Bootstrap is a bit more involved and is a bit more restrictive, so for a beginner, introduction Semantic styling components with Hooks in React has been a dream.&lt;/p&gt;

&lt;p&gt;In any component you will be rendering UI elements that you will use Semantic for, you'll need an import line at the top like anything else.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&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;Button&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Divider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Grid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Segment&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;semantic-ui-react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So what this line is doing is grabbing those five specific components from the Semantic frame work. Then you implement them in your just by calling them in your rendering.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Segment&lt;/span&gt; &lt;span class="nx"&gt;placeholder&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Grid&lt;/span&gt; &lt;span class="nx"&gt;columns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;relaxed&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;very&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;stackable&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Grid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Column&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Form&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Input&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Input&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Login&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;primary&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Form&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Grid.Column&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Grid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Column&lt;/span&gt; &lt;span class="nx"&gt;verticalAlign&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;middle&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt;  &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Grid.Column&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Grid&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Divider&lt;/span&gt; &lt;span class="nx"&gt;vertical&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Or&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Divider&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Segment&amp;gt;/&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can pass down props and logic through these just like any other component. This plug and play functionality is possible because Semantic has official integration with React. You can go to their official &lt;a href="https://react.semantic-ui.com/"&gt;documentation&lt;/a&gt; and see a very lengthy collection of prebuilt objects you can pick and choose from. And if they &lt;em&gt;don't&lt;/em&gt; have something you want, you can build it out in your own css file and reference it without the framework yelling at you.&lt;/p&gt;

&lt;p&gt;This is a very basic entry into a framework that does have a decent amount of depth, but it is very easy to start playing around with. Hopefully, this can help you produce some slick styling in your developing apps. &lt;/p&gt;

</description>
      <category>react</category>
      <category>css</category>
      <category>bootcamp</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Class it up!</title>
      <dc:creator>velocichaptor</dc:creator>
      <pubDate>Fri, 25 Sep 2020 12:56:58 +0000</pubDate>
      <link>https://dev.to/velocichaptor/class-it-up-4484</link>
      <guid>https://dev.to/velocichaptor/class-it-up-4484</guid>
      <description>&lt;p&gt;Class is a neat little word. Among all of its uses in the English language, they all in some way refer to a categorization of things. Socio-economic &lt;em&gt;class&lt;/em&gt;, vehicle &lt;em&gt;class&lt;/em&gt;, biological taxonomy &lt;em&gt;class&lt;/em&gt;. It's a very versatile word, and its meaning and traits carry into Ruby! But just like the any bit of clerical organization, building a class takes a little work. It's worth it, however, because Object-Oriented programming in Ruby loves to use classes to help you build cool and efficient code. &lt;/p&gt;

&lt;p&gt;To start, you build a beachhead with this syntax:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Monster
end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Bam! There's a class. But it is super empty and wants to be filled with all sorts of juicy data nuggets, or Objects. Like most things in programming, Objects need to be explicitly defined. So up there we have a class Monster, because obviously, you're a Dungeon Master preparing your next session of the world's great roleplaying game&lt;sup&gt;&lt;sup&gt;&lt;sup&gt;&lt;sup&gt;&lt;sup&gt;&lt;sup&gt;&lt;sup&gt;&lt;sup&gt;tm&lt;/sup&gt;&lt;/sup&gt;&lt;/sup&gt;&lt;/sup&gt;&lt;/sup&gt;&lt;/sup&gt;&lt;/sup&gt;&lt;/sup&gt;. And what's a good adventure without a few bag guys for your intrepid heroes to get into a scrum with?&lt;/p&gt;

&lt;p&gt;So we want to come up with a way to have a few monsters and their pertinent information. For starters, every monster needs a name, so we can go ahead and figure that we'll need one of those.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Monster

    attr_accessor :name

    def initialize(name)
        @name = name
    end

end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Whooaaa, Bessie, you might be thinking. What's with the giddyup? That's a lot to just get a name of a lil' twerp goblin. Don't worry, intrepid reader, it all has a purpose.&lt;/p&gt;

&lt;p&gt;What he have set up is a few things. The line 'attr_accessor :name' is a dual-purpose tool that you can use the set up both a &lt;em&gt;writer&lt;/em&gt; and a &lt;em&gt;reader&lt;/em&gt; for the name of an Instance of the class. This way, you will be able to both change and call on the information that is the 'name' of any given Instance of &lt;code&gt;class Monster&lt;/code&gt;. There is specific syntax you can use to &lt;em&gt;only&lt;/em&gt; write or read, but for this, we want to do both. Because if your players adopt a goblin, as they invariably will, you need to be able to give 'goblin8' a new, more charming name, like '"Sparx"'.&lt;/p&gt;

&lt;p&gt;Below the accessor we have method &lt;code&gt;initialize&lt;/code&gt;, which currently only takes the argument of a name. Within the method, you have a single line of code, '@name = name'. @name is a local variable within the class Monster. What this initialize method is doing is allowing us to assign a name to &lt;strong&gt;every&lt;/strong&gt; Instance of Monster without having to write out a separate method for each one. Isn't that sweet!&lt;/p&gt;

&lt;p&gt;Now, if you create a new Instance of Monster below the class with the line 'goblin = Monster.new("goblin")', you get your first little Object nugget!&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;=&amp;gt; #&amp;lt;Monster:0x00007fe2b09b0150 @name="goblin"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;But that's just the name of the goblin. You can't run an encounter without any stats! So let's beef up our class a little bit with a few more details.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Monster

    attr_accessor :name, :weapon, :ability

    def initialize(name, weapon, ability)
        @name = name
        @weapon = weapon
        @ability = ability
    end

end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now we have a cool spread of information to fill your Monster Instances with. If you run this through your code...&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;goblin = Monster.new("goblin", "shortbow", "nimble escape")
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Whoa, what an upgrade. But man, one goblin solo isn't going to do much good for you. You should send it out with a few friends. Goblins can run with a few different friends, often times bugbears or hobgoblins!&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bugbear = Monster.new("bugbear", "morning star", "surprise attack")
hobgoblin = Monster.new("hobgoblin", "longsword", "leadership")
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here's what this dastardly trio looks like in Instance form:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;goblin
=&amp;gt; #&amp;lt;Monster:0x00007ff42310fda0 @ability="nimble escape", @name="goblin", @weapon="shortbow"&amp;gt;
bugbear
=&amp;gt; #&amp;lt;Monster:0x00007ff42310fd00 @ability="surprise attack", @name="bugbear", @weapon="morning star"&amp;gt;
hobgoblin
=&amp;gt; #&amp;lt;Monster:0x00007ff42310fc60 @ability="leadership", @name="hobgoblin", @weapon="longsword"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now it's a party! You have your sneaky goblin, your brutal bugbear bruiser, and the stern hobgoblin to lead them against your player's intrepid heroes. But how to gather them all up? Very simple!&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Monster

    attr_accessor :name, :weapon, :ability

    @@all = []

    def initialize(name, weapon, ability)
        @name = name
        @weapon = weapon
        @ability = ability
        @@all &amp;lt;&amp;lt; self
    end

end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;See what we added? '@@all' is what we call a class variable. It starts out equaling an empty array. If you follow the syntax, you'll see that the method initialize will push every new Instance of Monster into this array as it comes into existence. And then with a single method outside the initialize:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def self.all
    @@all
end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can summon the monsters from the dark wood, ready to do your bidding! Now, in any future methods you create for this class, you can use this self method to call on all of its Instances! This is a good way to reference the information in this class without a lot of bloat in your code.&lt;/p&gt;

&lt;p&gt;The initialize method and the class variable are two steps you can take at the start of building your class that can make a lot of your legwork down the way more streamlined and refined.&lt;/p&gt;

</description>
      <category>student</category>
      <category>ruby</category>
      <category>class</category>
      <category>method</category>
    </item>
  </channel>
</rss>
