<?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 Kennedy</title>
    <description>The latest articles on DEV Community by John Kennedy (@johnkennedy9147).</description>
    <link>https://dev.to/johnkennedy9147</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%2F62743%2F4f4ee1ce-0cff-44a4-9312-1d9f2bf54c60.png</url>
      <title>DEV Community: John Kennedy</title>
      <link>https://dev.to/johnkennedy9147</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/johnkennedy9147"/>
    <language>en</language>
    <item>
      <title>Profile pic - not updated from github    </title>
      <dc:creator>John Kennedy</dc:creator>
      <pubDate>Wed, 04 Apr 2018 18:17:02 +0000</pubDate>
      <link>https://dev.to/johnkennedy9147/profile-pic---not-updated-from-github-----g6p</link>
      <guid>https://dev.to/johnkennedy9147/profile-pic---not-updated-from-github-----g6p</guid>
      <description>&lt;p&gt;This might be my imagination / bad memory but did dev.to not pull profile image from github automagically when I joined? &lt;/p&gt;

&lt;p&gt;If so, does it not update when github profile is updated?&lt;/p&gt;

&lt;p&gt;thanks&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Intro to the CSS Box Model.</title>
      <dc:creator>John Kennedy</dc:creator>
      <pubDate>Wed, 04 Apr 2018 16:42:17 +0000</pubDate>
      <link>https://dev.to/johnkennedy9147/intro-to-the-css-box-model-122e</link>
      <guid>https://dev.to/johnkennedy9147/intro-to-the-css-box-model-122e</guid>
      <description>

&lt;p&gt;&lt;em&gt;I originally wrote this as a contribution to the freeCodeCamp&lt;/em&gt; &lt;a href="https://guide.freecodecamp.org/"&gt;&lt;em&gt;Guide&lt;/em&gt;&lt;/a&gt; &lt;em&gt;project. You can view the article as it stands&lt;/em&gt; &lt;a href="https://guide.freecodecamp.org/css/the-box-model/"&gt;&lt;em&gt;here&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. You can read about the aims of the project in Quincy’s&lt;/em&gt; &lt;a href="https://medium.freecodecamp.org/heres-a-new-way-to-learn-coding-tools-and-concepts-right-when-you-need-them-ee82d15c576d"&gt;&lt;em&gt;article&lt;/em&gt;&lt;/a&gt; &lt;em&gt;from Sept 2017. Contributors to the project are always welcomed.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Understanding the CSS Box Model is crucial to being able to correctly layout a webpage.  &lt;/p&gt;

&lt;p&gt;When a browser renders (draws) a webpage each element, for example a piece of text or an image, is drawn as a rectangular box following the rules of the CSS Box Model.  &lt;/p&gt;

&lt;p&gt;At the centre of the box is the content itself, which takes up a certain height and width. This region is known as the &lt;strong&gt;Content Area&lt;/strong&gt;. The size of the content area can be automatically determined, or you can explicitly set the size of height and width. (see note below regarding &lt;code&gt;box-sizing&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--waQNaCZJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/343/1%2A_r62OrD_SdDYYjccCfKGLA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--waQNaCZJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/343/1%2A_r62OrD_SdDYYjccCfKGLA.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Around the Content Area this is a region known as &lt;strong&gt;Padding Area&lt;/strong&gt;. The size of the &lt;code&gt;padding&lt;/code&gt; can be the same all around, or you can set individually for top, bottom, left and right padding. If you are using a background for the element, the background will extend into the Padding Area.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o1bT9LmR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/343/1%2AisGpZLL9d9aaW3BGrpq37g.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o1bT9LmR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/343/1%2AisGpZLL9d9aaW3BGrpq37g.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next there is a &lt;strong&gt;Border Area&lt;/strong&gt;. This creates a border around the element and its padding. You can set thickness, colour and style of the border. Style options include none, solid, dashed, dotted and several others. (see note below regarding &lt;code&gt;box-sizing&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u-tQ8QzN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/399/1%2AY2wKEqxt3o1RWyyXLbWmCg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u-tQ8QzN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/399/1%2AY2wKEqxt3o1RWyyXLbWmCg.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally there is the &lt;strong&gt;Margin Area&lt;/strong&gt;. This creates clear space around the element, padding and border. Again you can individually set top, bottom, left and right margins. Under certain circumstances margin collapsing occurs and the margins between adjacent elements may be shared.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YwIthwH5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/399/1%2ALCWYi8UVXqF24rgU-8sPHA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YwIthwH5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/399/1%2ALCWYi8UVXqF24rgU-8sPHA.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Box-Sizing&lt;/code&gt; Property&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The default for this property is &lt;code&gt;content-box&lt;/code&gt;. If you use the default then the box model will allow the author to specify the size of the content area. However, it is possible to use these to instead specify the size of the border area. This is done by changing &lt;code&gt;box-sizing&lt;/code&gt; property to &lt;code&gt;border-box&lt;/code&gt;. This can sometimes make layouts easier. You can set the &lt;code&gt;box-sizing&lt;/code&gt; property per element as desired.&lt;/p&gt;


</description>
      <category>css</category>
      <category>beginners</category>
      <category>freecodecamp</category>
    </item>
    <item>
      <title>Breaking down an interview coding question.</title>
      <dc:creator>John Kennedy</dc:creator>
      <pubDate>Wed, 07 Mar 2018 15:26:20 +0000</pubDate>
      <link>https://dev.to/johnkennedy9147/breaking-down-an-interview-coding-question-b08</link>
      <guid>https://dev.to/johnkennedy9147/breaking-down-an-interview-coding-question-b08</guid>
      <description>&lt;p&gt;As I was scrolling through Twitter just now I noticed a tweet where someone was commenting on the type of question asked in interviews and comparing against the daily reality of the position. The point he was making I totally agree with but I was surprised to see a number of people in the comments seeming to suggest the question wasn't a valid one to be asked in any coding interview.&lt;/p&gt;

&lt;p&gt;I disagree, as the question tests the interviewee’s problem solving abilities, knowledge of the language, and how they handle pressure. Important characteristics to assess when considering hiring someone.&lt;/p&gt;

&lt;p&gt;The question was “What will be the value of:”&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var a = 10, b= 20; 
console.log(-+a++-+-+b--);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first glance a reaction like “WTF…” is natural, such obfuscation should never be present in real code. But nothing else about interviews is a realistic situation why should the code questions be? This isn’t actually a hard problem to solve. Take a moment and think about how this will execute and you should be able to figure it out.&lt;/p&gt;

&lt;p&gt;First off the values of a and b will be retrieved.&lt;/p&gt;

&lt;p&gt;Then the postfix operators ++ and -- have higher precedence so they will be pulled out of the expression and applied to the variables BUT postfix operators are applied AFTER the values are returned to the expression so now a has the value 11 and b the value 19. But their original values will be used in evaluating the expression.&lt;/p&gt;

&lt;p&gt;What we have at this point is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(-+(10)-+-+(20))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This might look like multiple addition and subtraction operators, but these apply on left and right operands. Which are mostly missing, so what will happen? Well there are two operators Unary Plus and Unary Negation. These operate right to left, the opposite of addition and subtraction, and they only require one operand, on their right. Unary plus converts its operand to a number if it isn't already, unary negation does the same but then negates it. All very complex sounding, but its not really. I’m sure you understand what this means -10 how about -x well that means take the value of x, make it a number and negate it.&lt;/p&gt;

&lt;p&gt;Starting with variable a with value 10. First it has the unary plus applied +(10) and becomes, eh 10, so nothing actually changed. Now the unary negation is applied -(10) and it becomes -10.&lt;/p&gt;

&lt;p&gt;So our equation is now.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;((-10)-+-+(20))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we do the same process working from the second variable b, with value 20. Working right to left - unary plus, then unary negation then unary plus leaves us with -20. Remember unary plus doesn't change the operand if its already a number so it isn't changed to positive in that last step.&lt;/p&gt;

&lt;p&gt;Now we have two values, with a subtraction operator between them, (-10)-(-20)&lt;/p&gt;

&lt;p&gt;A bit of maths now, subtracting a negative number from a negative number. Gives us the answer: 10.&lt;/p&gt;

&lt;p&gt;If you are ever thrown a question like this remember its probably not as hard as it looks and you can probably solve it if you take a moment to break down the expression and consider how each operator behaves.&lt;/p&gt;

</description>
      <category>coding</category>
      <category>javascript</category>
      <category>interview</category>
    </item>
  </channel>
</rss>
