<rss
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
version="2.0">

  <channel>

    <title>Recent &amp; Good Blog Posts on CodePen</title>

    <link>https://codepen.io/posts/</link>

    <description/>

    <dc:language>en</dc:language>

    <dc:creator>nospam@codepen.io</dc:creator>

    <dc:rights>Copyright 2017</dc:rights>

    <dc:date>
      2017-08-31T08:08:36-07:00
    </dc:date>

      <item>

  <title>BEM with CSS/SCSS</title>

  <link>https://codepen.io/igorbumba/post/bem-scss</link>
  <guid>https://codepen.io/igorbumba/post/bem-scss</guid>

  <dc:creator>Bumba</dc:creator>

  <description>
    <![CDATA[
    <p>BEM (Block Element Modifier) is a highly useful, powerful, and simple naming convention that makes your front-end code easier to read and understand, easier to work with, easier to scale, more robust and explicit, and a lot more strict.</p>

<h2>Block</h2>

<p>Encapsulates a standalone entity that is meaningful on its own. While blocks can be nested and interact with each other, semantically they remain equal; there is no precedence or hierarchy.</p>

<pre>
  <code class="HTML">&lt;div class="block"&gt;
    &lt;p&gt;Block&lt;/p&gt;
&lt;/div&gt;
</code>
</pre>

<pre>
  <code class="CSS">.block {
    width: 100%;
    color: white;
    display: block;
    background-color: black;
}
</code>
</pre>

<h2>Element</h2>

<p>Parts of a block and have no standalone meaning. Any element is semantically tied to its block. Any DOM node within a block can be an element. Within a given block, all elements are semantically equal.</p>

<pre>
  <code class="HTML">&lt;div class="block"&gt;
    &lt;div class="block__element"&gt;
        &lt;p&gt;Element inside block&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code>
</pre>

<pre>
  <code class="CSS">.block {
    width: 100%;
    color: white;
    display: block;
    background-color: black;    
}

.block__element {
    padding: 10px 15px;
}
</code>
</pre>

<h2>Modifier</h2>

<p>Flags on blocks or elements. Use them to change appearance, behavior or state.</p>

<pre>
  <code class="HTML">&lt;div class="block block--white"&gt;
    &lt;div class="block__element"&gt;
        &lt;p&gt;Block element with modified&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code>
</pre>

<pre>
  <code class="CSS">.block {
    width: 100%;
    color: white;
    display: block;
    background-color: black;
}

.block.block--white {
    color: black;
    background-color: white;
}

.block__element {
    padding: 10px 15px;
}
</code>
</pre>

<h2>Using SCSS</h2>

<p>The <strong>&amp;</strong> (ampersand) is an advantageous feature in SCSS. Used them when nesting. It can be an excellent time-saver when you know how to use it, or a bit of a time-waster when you're struggling and could have written the same code in regular CSS.</p>

<pre>
  <code class="SCSS">.block {

    width: 100%;
    color: white;
    display: block;
    background-color: black;

    &amp;__element {
        padding: 10px 15px;
    }

    &amp;.block--white {
        color: black;
        background-color: white;
    }

}
</code>
</pre>

<h3>I have a long name and a few modifiers</h3>

<p>Use <strong>&amp;</strong> FTW...</p>

<pre>
  <code class="SCSS">.blockname {

    width: 100%;
    color: white;
    display: block;
    background-color: black;

    &amp;__element {
        padding: 10px 15px;
    }

    &amp;#{&amp;}--white {
        color: black;
        background-color: white;
    }

    &amp;#{&amp;}--red {
        color: white;
        background-color: red;
    }

    &amp;#{&amp;}--blue {
        color: white;
        background-color: blue;        
    }

}
</code>
</pre>

<pre>
  <code class="CSS">/** COMPILED CSS **/

.blockname {
    width: 100%;
    color: white;
    display: block;
    background-color: black;
}

.blockname__element {
    padding: 10px 15px;
}

.blockname.blockname--white {
    color: black;
    background-color: white;
}

.blockname.blockname--red {
    color: white;
    background-color: red;
}

.blockname.blockname--blue {
    color: white;
    background-color: blue;
}
</code>
</pre>

<p>...or use variable...</p>

<pre>
  <code class="SCSS">$blockName: 'blocklongname';

.#{$blockName} {

    width: 100%;
    color: white;
    display: block;
    background-color: black;

    &amp;__element {
        padding: 10px 15px;
    }

    &amp;.#{$blockName}--white {
        color: black;
        background-color: white;
    }

    &amp;.#{$blockName}--red {
        color: white;
        background-color: red;
    }

    &amp;.#{$blockName}--blue {
        color: white;
        background-color: blue;
    }

}
</code>
</pre>

<pre>
  <code class="CSS">/** COMPILED CSS **/

.block {
    width: 100%;
    color: white;
    display: block;
    background-color: black;
}
.block__element {
    padding: 10px 15px;
}
.block.block--white {
    color: black;
    background-color: white;
}
.block.block--red {
    color: white;
    background-color: red;
}
.block.block--blue {
    color: white;
    background-color: blue;
}
</code>
</pre>

<p>..or set the parent as a variable:</p>

<pre>
  <code class="SCSS">.blockname {

    $b: &amp;; // Set the parent as a variable (b = block)

    width: 100%;
    color: white;
    display: block;
    background-color: black;

    &amp;__element {
        padding: 10px 15px;
    }

    &amp;#{$b}--white {

        color: black;
        background-color: white;

        #{$b}__element {
            color: orange;
        }

    }

    &amp;#{$b}--red {
        color: white;
        background-color: red;
    }

    &amp;#{$b}--blue {
        color: white;
        background-color: blue;        
    }

}
</code>
</pre>

<pre>
  <code class="CSS">/** COMPILED CSS **/

.blockname {
    width: 100%;
    color: white;
    display: block;
    background-color: black;
}

.blockname__element {
    padding: 10px 15px;
}

.blockname.blockname--white {
    color: black;
    background-color: white;
}

.blockname.blockname--white .blockname__element {
    color: orange;
}

.blockname.blockname--red {
    color: white;
    background-color: red;
}

.blockname.blockname--blue {
    color: white;
    background-color: blue;
}
</code>
</pre>

<p>Don't worry; variables stay within the scope they are declared. This won't work:</p>

<pre>
  <code class="SCSS">.blockname {
  $b: &amp;;
}

#{$b}__element {} // undefined variable $b
</code>
</pre>

<h2>Conclusion</h2>

<p>I hated BEM at the start, most of the people hated this method, but in the end, it made my life and writing code easier, now I can't imagine working any other way. It will help you maintain your SCSS. Maybe this isn't the perfect solution, but it sure helps me and everyone on my team!</p>

    ]]>
  </description>

  <dc:subject>BEM with CSS/SCSS</dc:subject>

  <dc:date>
    2017-08-31T08:08:36-07:00
  </dc:date>

</item>

      <item>

  <title>CodePen Chicago: August 28th 2017</title>

  <link>https://codepen.io/brianmontanaweb/post/codepen-chicago-august-28th-2017</link>
  <guid>https://codepen.io/brianmontanaweb/post/codepen-chicago-august-28th-2017</guid>

  <dc:creator>Brian Montana</dc:creator>

  <description>
    <![CDATA[
    <h1>CodePen Chicago REBOOT!</h1>

<p>It's been a while since the last CodePen Chicago but I'm excited we had so many people turn up! Matt Soria, <a href="https://codepen.io/poopsplat/">@poopsplat</a>, handed the reins to me, Brian Montana, <a href="https://codepen.io/brianmontanaweb">@brianmontanaweb</a>, as the new organizer to continue CodePen Chicago while he does some awesome remote work while traveling. The wonderful Marvin Cespo, <a href="https://codepen.io/mcespo/">@mcespo</a>, will be doing the photography and documention :D</p>

<p>Ten people presented their pens and we saw some neat features from the CodePen team. Handed out t-shirts, water bottles and Material Design Icon posters.</p>

<h3>Here's all of our wonderful presenters:</h3>

<h5>Chris Coyier showing off <a href="https://codepen.io/tv">CodePen TV</a> and <a href="https://blog.codepen.io/2017/08/29/say-hello-new-dashboard/">Your Dashboard</a> features</h5>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-011.jpg" alt="Chris Coyier presenting new CodePen features" />
</p>

<h5>Sean Mann's <a href="https://codepen.io/sean_codes/pen/ZJRQrq">Growing Bubbles</a></h5>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-007.jpg" alt="Sean Mann presenting Growing Bubbles" />
</p>

<p>Sean is a game and front end developer building web apps. He presented a Growing Bubbles to explore the UX of a smart watch.</p>

<h5>Kevin Lesht's <a href="https://codepen.io/klesht/pen/gxBGxM">Potato or Tomato?!</a></h5>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-012.jpg" alt="Kevin Lesht presenting Potato or Tomato" />
</p>

<p>Kevin works as a software engineer at Home Chef created a very difficult puzzle Potato or Tomato. It's a real time graphics based puzzle where a user makes a tough choice between Potato or Tomato!</p>

<h5>Daniel Cortes's <a href="https://codepen.io/dgca/pen/vJRBeV">Hyper Finger Picker II Turbo: HD Remix</a></h5>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-016.jpg" alt="Daniel Cortes presenting Hyper Finger Picker II Turbo: HD Remix" />
</p>

<p>Dan created a touch point randomizer that picks a winner from one of the touch points. Use it for figuring out where to go for lunch, the best Overwatch hero or what finger is better.</p>

<h5>Jake Albaugh's Vocoder(private), <a href="https://codepen.io/jakealbaugh/">@jakealbaugh</a></h5>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-021.jpg" alt="Jake explaining how another audio app works" />
</p>

<p>Jake showed a Vocoder that modified audio on the fly using a mic or audio file. There was a second voting system pen that would play a major or minor note based on multiple user's input when visiting his pen.</p>

<h5>Kennedy Collins's <a href="https://codepen.io/kennedycollins/pen/ZeedeO">Warmer or Colder</a></h5>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-026.jpg" alt="Kennedy explaining Warmer or Colder by projection of code" />
</p>

<p>Can't find something? Hate complex map apps? Warmer or Colder is perfect for you! When you get closer to a geolocation this app will tell you if you're heading in the right direction :D</p>

<h5>Austin Andrews's <a href="https://codepen.io/templarian/pen/vgmMdj">Material Design Icons - Bootstrap 4</a></h5>

<p data-height="300" data-theme-id="17637" data-slug-hash="vgmMdj" data-default-tab="html,result" data-embed-version="2" class="codepen">See the Pen <a href="https://codepen.io/templarian/pen/vgmMdj/">Material Design Icons - Bootstrap 4</a> by Austin Andrews (<a href="https://codepen.io/templarian">@templarian</a>) on <a href="https://codepen.io">CodePen</a>.</p>



<p>Austin Andrew's has been building out the documentation for Material Design Icons in CodePen to share with the team. It's like Bootstrap docs but emoji filled!</p>

<h5>Matt Helbig's <a href="https://codepen.io/reallygoodemails/">Really Good Emails</a></h5>

<p data-height="300" data-theme-id="17637" data-slug-hash="GvYbxy" data-default-tab="html,result" data-embed-version="2" class="codepen">See the Pen <a href="https://codepen.io/reallygoodemails/pen/GvYbxy/">Startup Framework 2 is here, a new release by Designmodo!</a> by Really Good Emails (<a href="https://codepen.io/reallygoodemails">@reallygoodemails</a>) on <a href="https://codepen.io">CodePen</a>.</p>



<p>Matt's part of the group at Really Good Emails. They collect the best work in email marketing, clean up the code and curate these wonders!</p>

<h5>Jack Doyle, <a href="https://codepen.io/GreenSock/">@GreenSock</a></h5>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-029.jpg" alt="Jack showing BendyBox" />
</p>

<p>Jack Doyle aka GreenSock showed off the latest features and explorations with GreenSock. First was BendyBox, an animation showing stretch and squash with SVG. PathEditor that allows a user to update an SVG path handles, similar to Adobe Illustrator. GSDevTools a tool that lets you pick specific chunks of animation, render speed, timeline, etc.</p>

<h5>Mica Alaniz's Illinois Map(private), <a href="https://codepen.io/micada/">@micada</a></h5>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-778/20170828-codepen-chicago-031.jpg" alt="Mica talking about Pawar campaign and the SVG map of Illinois" />
</p>

<p>Mica talks about building a map of Illinois using Firebase, D3 and SVG. She's presenting location Pawar has been and where volunteers for the campaign are located across the state. Mica talked about proof of concepts are build in CodePen and handed off internally for the Pawar team to review.</p>

<h5>Mike Aparicio's <a href="https://codepen.io/peruvianidol/pen/RZxegO">Beauty Now Responsive v2</a></h5>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-033.jpg" alt="Mike Aparicio show off responsive designs for Groupon" />
</p>

<p>Mike works for Groupon and decided to build a proof of concept for a responsive solution to the current site.</p>

<h3>Photos</h3>

<p>Here's the rest and the <a href="https://goo.gl/photos/WDK1vk6dscBySGhv7">album</a>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-003.jpg" alt="Brian Montana welcoming guests while holding a can of beer" />
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-022.jpg" alt="View of all the guests at CodePen Chicago about 50" />
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/283591/20170828-codepen-chicago-024.jpg" alt="Brian Montana doing a give away of swag: t-shirts, water bottles, Material Design Icon posters" /></p>

<h3>ALL THE THANK YOUS!</h3>

<p>Thank you to Chris Coyier, and the CodePen team for their help and support. A big thanks to <a href="https://mediatemple.net/">Media Temple</a> for sponsoring the pizza and beer :D Many thanks to Rudy, Angelica and Kevin at Salesforce for hosting us. Thanks to Austin for the Material Design Icon posters, and Marvin our photographer did an awesome job of documenting and picturing it up! Finally thanks to everyone who presented and/or showed up to support!</p>

<p>Please fill out this <a href="https://brianmontanaweb.typeform.com/to/l3eTw9">survey</a> to help make CodePen Chicago a better experience :D</p>

    ]]>
  </description>

  <dc:subject>CodePen Chicago: August 28th 2017</dc:subject>

  <dc:date>
    2017-08-31T01:39:51-07:00
  </dc:date>

</item>

      <item>

  <title>CodePen Barcelona: August 2017</title>

  <link>https://codepen.io/quezo/post/codepen-barcelona-august-2017</link>
  <guid>https://codepen.io/quezo/post/codepen-barcelona-august-2017</guid>

  <dc:creator>Alex Vazquez</dc:creator>

  <description>
    <![CDATA[
    <p>
  <img class="-top" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/2/lewagon-2.jpg" alt="Meetup Attendance" />
</p>

<p>CodePen joined <a href="https://www.lewagon.com/barcelona">LeWagon Barcelona</a> for a meetup with many of it's students and local front end developers in Barcelona Spain. The meetup was hosted by LeWagon Barcelona's driver <a href="https://github.com/devitagus">Gustavo</a> and sponsored by <a href="https://mediatemple.net/">Media Temple</a>. The event was well attended considering we only had one week to promote the event in Barcelona.</p>

<p>Two members of Team CodePen were working remotely in Barcelona when a serendipitous meeting with a new coder friend, <a href="https://twitter.com/erin__douglas">Erin</a>, introduced us to Gustavo and future LeWagon driver in Milan <a href="https://www.lewagon.com/milan">Francesco</a>. </p>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/2/lewagon-1.jpg" alt="Francesco and The Gus" />
</p>

<p>The ties that bind the tech community are strong. Our very own <a href="https://codepen.io/deegill/">Dee Gill</a> quickly setup a CodePen meetup with Gustavo. We chose an interview format because we thought it would be interesting to the coding bootcamp students who were getting started with their front end development education. </p>

<div class="center">
  <img class="landscape" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/2/lewagon-3.jpg" alt="Pizza Pizza" />
  <img class="portrait" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/2/lewagon-4.jpg" alt="Talking Bout Codepen" />
</div>

<p>I told my version of how CodePen was created. We discussed how we decide what to work on at CodePen, why we chose to take funding after three years of bootstrapping and where we hope to take CodePen in the future.</p>

<p>A fun fact about CodePen. <a href="https://codepen.io/chriscoyier/">Chris Coyier</a> emailed <a href="https://codepen.io/tsabat">Tim</a> and I about starting this fun "weekend" project on February 2, 2012. Chris tentatively named said project <strong>TinkerBox</strong> 😬. We chose CodePen because the domain name wasn't available 😌.</p>

    ]]>
  </description>

  <dc:subject>CodePen Barcelona: August 2017</dc:subject>

  <dc:date>
    2017-08-31T16:20:01-07:00
  </dc:date>

</item>

      <item>

  <title>Sass Maps, Loops, and CSS word scrambling!</title>

  <link>https://codepen.io/FUGU22/post/word-scramble-using-sass-maps</link>
  <guid>https://codepen.io/FUGU22/post/word-scramble-using-sass-maps</guid>

  <dc:creator>Charlie Marcotte</dc:creator>

  <description>
    <![CDATA[
    <p><strong>Note:</strong> <em>To understand this tutorial, it definitely helps to have some preliminary knowledge of Sass/SCSS and Sass loops. We also use the checkbox hack in this tutorial, so knowing that can help too!</em></p>

<p>So I was browsing websites the other day, and stumbled upon a really cool word scramble effect. The website in question was definitely using JavaScript to create the effect, but I thought it may be possible to re-create the effect using only CSS animations and pseudo-elements. I created this attempt the other day: </p>

<p><p data-slug-hash="qXYMyd" data-default-tab="result" data-height="300" data-theme-id="0" data-embed-version="2" class="codepen"></p></p>

<p>All of the above was using psuedo-elements and the content property. It was a fun little "proof-of-concept" to do, but the code is <em>disgusting</em> - it's clumsy and you have to enter the scrambled letters for each content property at every keyframe step. Definitely not modular or time efficient - but I found a solution today using a feature of Sass called "maps". Maps operate a lot like JavaScript objects or JSON - which is perfect for our needs!</p>

<p>Quickly, here is a Sass map:
<code>
$colors: (1: red, 2: blue, 3: green)
</code></p>

<p>And here is how we would call something from it:</p>

<pre>
  <code>.container
  background: map-get($colors, 1)
  // The background is now red. Not too bad, right?!
</code>
</pre>

<p>First, let's start with the HTML(Pug):</p>

<pre>
  <code>.container
  input(type='radio' id='button1' name="button")
  label(for='button1') &lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;
.container
  input(type='radio' id='button2' name="button")
  label(for='button2') &lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;
.container
  input(type='radio' id='button3' name="button")
  label(for='button3') &lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;
</code>
</pre>

<p>Essentially we are creating three containers, and inside each one we have an <strong>input</strong>, a <strong>label</strong>, and a crap ton of <strong>spans</strong> inside each label. The <strong>input</strong> is simply for the checkbox hack, so it is optional (read more about that <a href="https://css-tricks.com/the-checkbox-hack/">here</a>). The big key here is the spans inside of the label - we will be using the psuedo-element :after on those to create the actual word! So if your word is going to be "hello", we will need 5 EMPTY spans in there. The word will come with the css. </p>

<p>Now for the Sass set up. Like I said, we will be using maps to access all of our fun word scramble data! Here is the basic Sass variable / map set-up:</p>

<pre>
  <code>
$colors: (1: red, 2: blue, 3: green, 4: yellow, 5: orange, 6: purple, 7: pink, 8: teal, 9: tomato, 10: red)

$scramble: (1: "a", 2: "#", 3: "x", 4: "?", 5: "r", 6: "%", 7: "w", 8: "b", 9: "q", 10: "!")

$count: 10

$finalWord: (1: 'H', 2: 'e', 3: 'l', 4: 'l', 5: 'o')

$finalWordCount: 5 

</code>
</pre>

<p>The <strong>$colors</strong> map has all of our randomized colors that we want - you can put whatever color in whatever quantity you want! The <strong>$scramble</strong> map has all the letters and symbols you want to randomly scramble-ize. And the <strong>$finalWord</strong> map is simply the final word that we want - in our case, "Hello". <strong>$count</strong> is simply the number of things in our maps; you can coordinate those numbers to be the same, like I did, or you can do two different numbers. You will see the time-saving advantage of maps shortly.</p>

<p>First we will start off by writing our word "Hello" by using the content property of the span:after elements. That's a mouthful, I know, but bear with me. We will access the map containg hello with a for loop! Check it out: </p>

<pre>
  <code>@for $z from 1 through $finalWordCount
  span:nth-child(#{$z}):after
    color: black
    content: map-get($finalWord, $z)
</code>
</pre>

<p>Boom, this writes our word out. So, we make a loop. The loop counts the length of the letters in our word. We attach the loop variable to the nth:child():after, essentially selecting the psuedo-element of every span. In the <strong>content</strong> property, we put the map function in and put our <strong>$finalWord</strong> variable in, followed by our loop variable. This spells out our word! You can see where we are here: </p>

<p><p data-slug-hash="gxjGyz" data-default-tab="result" data-height="300" data-theme-id="0" data-embed-version="2" class="codepen"></p></p>

<p>Now we need to do our scramble animation. This requires us to make another loop that can access the <strong>$scramble</strong> and <strong>$colors</strong> maps. Here is what our code looks like:</p>

<pre>
  <code>@for $x from 1 through $count
  input:checked ~ label &gt; span:nth-child(#{$x}):after
    $increase: $x * 175
    animation: move-#{$x} ((1000 + $increase) + ms) linear forwards 1
    @keyframes move-#{$x}
      @for $e from 1 through 7
        #{$e}0%
          content: map-get($scramble, random($count))
          color: map-get($colors, random($count))

</code>
</pre>

<p>Here we essentially create another loop that counts up to the length of our <strong>$scramble</strong> and <strong>$colors</strong> maps. When our input is checked, we select the label and then each span child's after psuedo-element. Complicated selection, I know, but if you walk through it slowly you'll get it no problem.</p>

<p>We then create an <strong>$increase</strong> variable for our use later. We also call a CSS animation, and to make a unique animation for each span:nth-child():after element, we attach our loop variable to the CSS animation name. It looks like this: move-#{$x}. As for the speed of the animation, I take a base-line speed and then add our recently created <strong>$increase</strong> variable to it. This creates a nice staggered effect with the word!</p>

<p>We call the animation with the keyframes, and then create ANOTHER loop inside the animation. This makes it so we can generate a unique color and word for each step of the animation! Inside the animation itself we add the content and color properties, and both call a map. For content, the map parameter is our <strong>$scramble</strong> variable, and we randomize our <strong>$count</strong> variable to access any of our scrambled words. The <strong>$colors</strong> variable is the exact same; we will randomize the colors!</p>

<p><p data-slug-hash="KvBNyb" data-default-tab="result" data-height="300" data-theme-id="0" data-embed-version="2" class="codepen"></p></p>

<p>Now we have a word scramble! While this code does compile to quite a bit, it is SO much simpler to read and write than my first attempt. The maps feature of Sass definitely has a ton of potential, and I hope this was a pragmatic example of its ability. :D</p>

    ]]>
  </description>

  <dc:subject>Sass Maps, Loops, and CSS word scrambling!</dc:subject>

  <dc:date>
    2017-08-25T17:22:13-07:00
  </dc:date>

</item>

      <item>

  <title>Interface segregation principle  </title>

  <link>https://codepen.io/allanpope/post/interface-segregation-principle</link>
  <guid>https://codepen.io/allanpope/post/interface-segregation-principle</guid>

  <dc:creator>Allan Pope</dc:creator>

  <description>
    <![CDATA[
    <h2>Interface segregation principle</h2>

<p>This is part four of a five part series covering the SOLID principles. For more information on what the SOLID principles are, check out <a href="https://codepen.io/allanpope/post/single-responsibility-principle">part one</a>.</p>

<ul>
<li><a href="https://codepen.io/allanpope/post/single-responsibility-principle">Single responsibility principle</a></li>
<li><a href="https://codepen.io/allanpope/post/open-closed-principle">Open/closed principle</a></li>
<li><a href="https://codepen.io/allanpope/post/liskov-substitution-principle">Liskov substitution principle</a></li>
<li><a href="https://codepen.io/allanpope/post/interface-segregation-principle">Interface segregation principle</a> </li>
<li>Dependency inversion principle</li>
</ul>

<h3>The rule</h3>

<blockquote>
<p>No <em>client</em> should be forced to depend on <em>methods</em> it does not use.</p>
</blockquote>

<h3>What does it mean?</h3>

<p>This principle is one of the more clear ones but lets define the terminology in case it's unfamiliar. A <em>client</em> is something that is asking/requesting something from another class. A <em>method</em> is a function that is on a class. It differs from a function as it can access data on the class.</p>

<p>This principle is concerned with how we use classes. It helps us to separate our code and improve our developing experience over a long period. This principle differs from the single responsibility principle which is concerned with what a group of codes responsibility is. Whereas interface segregation is about how we use and interact with the code.</p>

<h3>Example</h3>

<p>Here we have a class called <code>Car</code> with a list of methods on it, such as <code>turnOn</code>, <code>turnOff</code>, <code>doors</code> etc. We are creating an instance of it and storing it in a variable called <code>electricCar</code>. We are calling the <code>information</code> method on it to print out the cars information to the webpage.</p>

<p data-height="460" data-theme-id="12524" data-slug-hash="015dcddc73a8963db8c7ae662c8c6938" data-default-tab="js,result" data-embed-version="2" class="codepen"></p>

<p>This works great, you can create as many cars as you like and print the information to the webpage. Now pretend you're given a new task of creating a <code>motorCar</code>. You reach for the <code>Car</code> class, initialise it and store the result in a variable called <code>motorCar</code>. The <code>motorCar</code> differs from the <code>electricCar</code> though. It's motor is different, it uses gas and isn't electric. </p>

<p>Let's add two new method's to the <code>Car</code> class, <code>combustionEngine</code> and <code>fuelTank</code>. When you are initialing the <code>Car</code> class for <code>motorCar</code> what do you put for <code>rechargableBattery</code>, <code>electricMotor</code> and <code>kilowatts</code>? What do you put for <code>combustionEngine</code> and <code>fuelTank</code> on the <code>electricCar</code>?</p>

<p>You could put a null value and then do a conditional check to see if you should render it in the <code>information</code> method or not. That will start to complicate the code more with a lot of conditional logic. How about we put the word "no" there for the time being, as we don't mind stating that these items aren't in our car.</p>

<p data-height="460" data-theme-id="12524" data-slug-hash="827d83842c77e40fc094be0069868aac" data-default-tab="js,result" data-embed-version="2" class="codepen"></p>

<h5>Are there any issues?</h5>

<p>This violates the principle as we are now depending on methods we don't use and have to cater for them.</p>

<p>A better way to approach this would be to carve out the similar methods into it's own class. We could create a <code>GasEngine</code> and <code>ElectricEngine</code> class and pass the engine in when we initialise it. That way, the two classes are not tied together. For the <code>electricCar</code> we can pass in an <code>ElectricEngine</code> and for <code>motoCar</code> we can pass in <code>GasEngine</code>. Having the classes split up means we can compose the parts we want, to form our <code>Car</code>.</p>

<h5>Refactor</h5>

<p>Below is our refactored code. We've created a <code>GasEngine</code> and <code>ElectriEngine</code> class with the relevant methods.  We have also added an <code>information</code> method to each engine, so that in <code>Car</code> we can ask for the engines information and not care what engine it's using.</p>

<p data-height="460" data-theme-id="12524" data-slug-hash="df77738b1af351fcd902f98994ceba4e" data-default-tab="js,result" data-embed-version="2" class="codepen"></p>

<h3>Why it is important?</h3>

<ul>
<li><strong>Composition</strong>.  If we have many small interfaces, we can compose classes together with the parts we need.</li>
<li><strong>Decoupling</strong>. Tying your classes together with only relevant methods, will mean for a better developer experience. You will be able to refactor and change code more freely.</li>
<li><strong>Testing</strong>. Smaller classes are easier to test. It's a simpler object to create and test against. </li>
</ul>

<h3>Wrap up</h3>

<p>Apply the solid principles you've learned so far and avoid large monolith classes/modules that do to much. When you have a large piece of code, look at how you could carve it up into smaller pieces. Compose classes together to form larger, more complex classes. To find out more about this look into <a href="https://en.wikipedia.org/wiki/Composition_over_inheritance">composition over inheritance</a>.</p>

<p>That's the interface segregation principle. If you have any questions about it or some of the ES6 syntax I've used, ask a question in the comments section.</p>

<p>If you want to see how another person explains it then check out the links below. They are both short videos which go over the same principle.</p>

<ul>
<li><a href="https://www.youtube.com/watch?v=xahwVmf8itI">Code Walks - interface segregation principle</a></li>
<li><a href="https://www.youtube.com/watch?v=3CtAfl7aXAQ">Interface Segregation Principle in 5 minutes</a></li>
</ul>



    ]]>
  </description>

  <dc:subject>Interface segregation principle  </dc:subject>

  <dc:date>
    2017-08-24T11:10:20-07:00
  </dc:date>

</item>

      <item>

  <title>Using the Fetch API to send and receive JSON with PHP.</title>

  <link>https://codepen.io/derickruiz/post/fetch-api-json-php</link>
  <guid>https://codepen.io/derickruiz/post/fetch-api-json-php</guid>

  <dc:creator>Derick Ruiz</dc:creator>

  <description>
    <![CDATA[
    <p>If you want to use the Fetch API to send and receive JSON to your PHP script there are a few things you have to take into account.</p>

<p>
  <strong>Javascript</strong>
</p>

<pre>
  <code>  fetch("/", {
    method: "POST",
    mode: "same-origin",
    credentials: "same-origin",
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "payload": myObj
    })
  })
</code>
</pre>

<p>By default, fetch won't send or receive any cookies from the server, resulting in unauthenticated requests if the site relies on maintaining a user session (to send cookies, the credentials init option must be set).</p>

<p>That really threw me off at first  and I was wondering why my requests were not authenticated, but having the propery <code>credentials: 'same-origin'</code>  took care of that.</p>

<p>That's about all you need from the Javascript side of things.</p>

<p>
  <strong>PHP</strong>
</p>

<p>You can't access JSON by default in PHP with the $_POST variable so you have to do a bit of trickery to get access to it.</p>

<pre>
  <code>$contentType = isset($_SERVER["CONTENT_TYPE"]) ? trim($_SERVER["CONTENT_TYPE"]) : '';

if ($contentType === "application/json") {
  //Receive the RAW post data.
  $content = trim(file_get_contents("php://input"));

  $decoded = json_decode($content, true);

  //If json_decode failed, the JSON is invalid.
  if(! is_array($decoded)) {

  } else {
    // Send error back to user.
  }
}
</code>
</pre>

<p>That's about it. With that you should now be able to send and receive JSON via the Fetch API with your PHP.</p>

    ]]>
  </description>

  <dc:subject>Using the Fetch API to send and receive JSON with PHP.</dc:subject>

  <dc:date>
    2017-08-21T04:22:40-07:00
  </dc:date>

</item>

      <item>

  <title>Responsive Placeholder Image</title>

  <link>https://codepen.io/shshaw/post/responsive-placeholder-image</link>
  <guid>https://codepen.io/shshaw/post/responsive-placeholder-image</guid>

  <dc:creator>Shaw</dc:creator>

  <description>
    <![CDATA[
    <p>
  <a href="#summary-and-closing">tl;dr</a>
</p>

<h1>Transparent Pixels</h1>

<p>I became interested in image replacement techniques to keep page size down, AJAXing in full images later as needed, and I stumbled across <a href="http://proger.i-forge.net/The_smallest_transparent_pixel/eBQ">The Smallest Transparent Pixel</a>. Using a bas64 encoded 1x1 transparent pixel as a placeholder, you set the <code>width</code> and <code>height</code> attributes to the space you want to fill.</p>

<pre>
  <code class="html">&lt;img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw" width="200" height="150" /&gt;
</code>
</pre>

<p>Unfortunately, the 1x1 pixel images have issues with common responsive styles, due to the image's square aspect ratio.</p>

<p>Let's say you set <code>img { max-width: 100%; }</code> to prevent images from causing horizontal scrolling on small screens. Your 1x1 pixel img's width can be squished down below what you set in the <code>width</code> attribute, but the height remains the same, leaving you with an oddly shaped placeholder.</p>

<p><p data-slug-hash="NPLKjq" data-default-tab="result" data-height="250" data-theme-id="0" class="codepen"></p></p>

<p>If you try to correct this with <code>img { max-width: 100%; height: auto; }</code>, the <code>height</code> attribute is completely ignored, and the width can be squished below the <code>width</code> attribute's setting, leaving you with a square; probably not the aspect ratio you intended.</p>

<p><p data-slug-hash="jEvNmq" data-default-tab="result" data-height="250" data-theme-id="0" class="codepen"></p></p>

<p>This is intended behavior in the browser and works great for regular images, but how can we fix this for this filler image?</p>

<h1>SVG to the Rescue</h1>

<p>GIFs and PNGs aren't the only images you can inline. Our friend SVG can even be inlined <a href="https://css-tricks.com/probably-dont-base64-svg/">without base64</a>. SVG also has an aspect ratio built in using the <code>viewBox</code> attribute. So if we swap out our 1x1 pixel for this...</p>

<pre>
  <code class="html">&lt;img src="data:image/svg+xml;charset=utf-8,%3Csvg xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' viewBox%3D'0 0 200 150'%2F%3E" width="200" height="150" /&gt;
</code>
</pre>

<p>...our responsive styles work as intended! The important bit is the 116 byte <code>src</code> attribute. This works all the way back to IE9 due to the <code>encodedURIComponent</code> conversion of special characters, which unfortunately makes it a little more difficult to read. </p>

<p><p data-slug-hash="LEJPyB" data-default-tab="result" data-height="250" data-theme-id="0" class="codepen"></p></p>

<p>Notice how the responsively sized <code>svg</code> maintains its aspect ratio. This is set here <code>viewBox%3D'0 0 200 150'</code>, giving the <code>svg</code> a width (200) and height (150) to get the correct aspect ratio. This could be <code>viewBox%3D'0 0 16 9'</code> for 16x9 images or the exact width and height of the image you plan to use as a replacement.</p>

<h1>Image Replacement</h1>

<p>The above is a great snippet by itself to be used in place of the standard 1x1 pixel image, but how can we apply this to image replacement?</p>

<pre>
  <code class="html">&lt;figure class="image-replacement" data-src="http://i.imgur.com/YVSnio4.jpg" data-width="1400" data-height="900"&gt;
  &lt;noscript&gt;&lt;img src="http://i.imgur.com/YVSnio4.jpg" width="1400" height="900" /&gt;&lt;/noscript&gt;
&lt;/figure&gt;
</code>
</pre>

<p>In our HTML, we have a <code>figure</code> tag with the relevant image info set in data attributes for our Javascript to pull. There's a simple <code>noscript</code> fallback so that our Javascript-less bretheren don't suffer.</p>

<p>The placeholder <code>svg</code> has been updated to display an icon instead of just being blank, but the technique is still the same of setting the correct <code>viewBox</code>. The icon itself is a <code>symbol</code> which has its own <code>viewBox</code>, allowing it to be easily sized and centered in the main <code>svg</code>. Unfortunately, the symbol can't be defined or reused outside of the individual <code>img</code>, since it seems that browsers treat it as an external, self contained file.</p>

<p><p data-slug-hash="myGbbQ" data-default-tab="result" data-height="500" data-theme-id="0" class="codepen"></p></p>

<p>The Javascript is very minimal, taking the data attributes of the <code>figure</code> to create the placeholder, then loading the image when hovered, mainly to show how the image seamlessly replaces the placeholder. The content doesn't have to reflow and text doesn't jump around. For a real image replacement scenario, you'd likely want to configure it to load images as they come into viewport, or perhaps when they're next in the slideshow.</p>

<div id="summary-and-closing"></div>

<h1>Summary and Closing</h1>

<p>Use <code>data:image/svg+xml;charset=utf-8,%3Csvg xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' viewBox%3D'0 0 200 150'%2F%3E</code> as the placeholder <code>src</code> attribute for any image you need to replace, updating the <code>viewBox</code> value to keep the correct aspect ratio.</p>

<p>There are other ways you can accomplish all of this, but this technique is ultra simple, self-contained and can likely be used outside of image replacement.</p>

<p>Comment below if you have any improvements or examples of other uses.</p>

    ]]>
  </description>

  <dc:subject>Responsive Placeholder Image</dc:subject>

  <dc:date>
    2016-02-05T15:34:24-07:00
  </dc:date>

</item>

      <item>

  <title>Create A Basic Portfolio Filtering System</title>

  <link>https://codepen.io/brianhaferkamp/post/create-a-basic-filtering-system</link>
  <guid>https://codepen.io/brianhaferkamp/post/create-a-basic-filtering-system</guid>

  <dc:creator>Brian Haferkamp</dc:creator>

  <description>
    <![CDATA[
    <p>One of the things I'm often looking for but can't find is a basic filtering system for portfolio items. It seems like the ones I find online are too complicated or bloated. They're trying to do way too much. So I created a basic framework for a portfolio filtering system that works great as-is. You can also fork it and add any bells and whistles you want.</p>

<h2>HTML</h2>

<pre>
  <code>&lt;main&gt;
  &lt;nav id="controls"&gt;
    &lt;ul&gt;
      &lt;li class="filter filter-all active"&gt;All&lt;/li&gt;
      &lt;li class="filter filter-landscape"&gt;Landscape&lt;/li&gt;
      &lt;li class="filter filter-urban"&gt;Urban&lt;/li&gt;
      &lt;li class="filter filter-portrait"&gt;Portrait&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/nav&gt;
  &lt;section class="grid-wrapper"&gt;
    &lt;div class="image landscape landscape-1 all"&gt;&lt;/div&gt;
    &lt;div class="image urban urban-1 all"&gt;&lt;/div&gt;
    &lt;div class="image urban urban-2 all"&gt;&lt;/div&gt;
    &lt;div class="image portrait portrait-1 all"&gt;&lt;/div&gt;
    &lt;div class="image urban urban-3 all"&gt;&lt;/div&gt;
    &lt;div class="image portrait portrait-2 all"&gt;&lt;/div&gt;
    &lt;div class="image urban urban-4 all"&gt;&lt;/div&gt;
    &lt;div class="image landscape landscape-2 all"&gt;&lt;/div&gt;
    &lt;div class="image portrait portrait-3 all"&gt;&lt;/div&gt;
    &lt;div class="image landscape landscape-3 all"&gt;&lt;/div&gt;
    &lt;div class="image landscape landscape-4 all"&gt;&lt;/div&gt;
    &lt;div class="image portrait portrait-4 all"&gt;&lt;/div&gt;
  &lt;/section&gt;
&lt;/main&gt;
</code>
</pre>

<p>I'm using <code>div</code> tags here but you could just as easily make those more semantic. We essentially have two sections: the navigation (#controls) and the grid (.grid-wrapper). I'm attaching the class <code>.filter</code> to the individual navigation elements. Each of the elements also has a specific class of <code>.filter-[name]</code> attached. We will use this to connect to the appropriately labeled items in the grid. There is also an <code>.active</code> class that will be applied to the element the user clicks.</p>

<p>The grid is a collection of images. I'm using the <code>background-image</code> property to serve the images to the appropriate cells. You could go with hard-coded images using the <code>img</code> tag, too. The images share a class called <code>.image</code> that gives some general values for all the images. Each image also has a class that represents its filter type: urban, portrait, landscape, all. These filter types are what I will use to hook the filtering system to. Finally, each image has a unique class that allows me to apply the background image to a specific grid cell.</p>

<h2>CSS</h2>

<pre>
  <code>* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

.hide {
  -webkit-animation: fadeOut 150ms ease;
          animation: fadeOut 150ms ease;
  opacity: 0;
}

@-webkit-keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.hide {
  display: none;
}

#controls {
  margin-bottom: 2rem;
}
#controls ul {
  list-style: none;
  padding: 1rem;
  margin: 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}
#controls ul li {
  margin: 0;
  padding: 0.5rem;
  border: 1px solid #eee;
  cursor: pointer;
}
#controls ul li:hover {
  background: #eee;
}
@media (min-width: 400px) {
  #controls ul li {
    margin-right: 1rem;
    padding: 1rem;
  }
}
#controls ul .active {
  background: #444;
  color: white;
}
#controls ul .active:hover {
  color: #444;
}

.grid-wrapper {
  display: -ms-grid;
  display: grid;
  -ms-grid-columns: (1fr)[1];
      grid-template-columns: repeat(1, 1fr);
  -ms-grid-rows: auto;
      grid-template-rows: auto;
  grid-gap: 1rem;
  -ms-grid-column-align: center;
      justify-items: center;
  margin: 1rem;
}

@media (min-width: 500px) {
  .grid-wrapper {
    -ms-grid-columns: (1fr)[2];
        grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 768px) {
  .grid-wrapper {
    -ms-grid-columns: (1fr)[3];
        grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1368px) {
  .grid-wrapper {
    -ms-grid-columns: (1fr)[4];
        grid-template-columns: repeat(4, 1fr);
  }
}
.image {
  width: 100%;
  height: 50vh;
}

@media (min-width: 500px) {
  .image {
    width: 100%;
    height: 50vw;
  }
}
@media (min-width: 768px) {
  .image {
    width: 100%;
    height: 40vw;
  }
}
@media (min-width: 1368px) {
  .image {
    width: 100%;
    height: 20vw;
  }
}
.urban-1 {
  background: url(https://unsplash.it/1500?image=1075);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.urban-2 {
  background: url(https://unsplash.it/1500?image=1067);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.urban-3 {
  background: url(https://unsplash.it/1500?image=1033);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.urban-4 {
  background: url(https://unsplash.it/1500?image=983);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.landscape-1 {
  background: url(https://unsplash.it/1500?image=961);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.landscape-2 {
  background: url(https://unsplash.it/1500?image=916);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.landscape-3 {
  background: url(https://unsplash.it/1500?image=901);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.landscape-4 {
  background: url(https://unsplash.it/1500?image=876);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.portrait-1 {
  background: url(https://unsplash.it/1500?image=978);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.portrait-2 {
  background: url(https://unsplash.it/1500?image=996);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.portrait-3 {
  background: url(https://unsplash.it/1500?image=1027);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.portrait-4 {
  background: url(https://unsplash.it/1500?image=838);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
</code>
</pre>

<p>The CSS may be a little complicated if you're new to CSS3. I'm using some advanced concepts like keyframe animation and background images. Let me walk you through the different parts.</p>

<p>After setting up some basics with the <code>body</code> tag, I went right into an animation. This was the original concept. When you run the code, however, the second <code>.hide</code> class is overriding the animation. So if you want to see the items animate out, just comment out the second <code>.hide</code> class. The animation is pretty basic and just covers the opacity. You could also change the <code>visibility</code> property so that the items are no longer taking up space on the grid. If you don't bring down the opacity all the way to '0' then it has a nice highlighting effect. <a href="http://highwaywebconsulting.com/work.html">I've used this technique on my own portfolio.</a> In fact, I'm using this exact structure to create the portfolio grid on that page.</p>

<p>Next is the navigation. This is just a simple menu that is being inlined using Flexbox. If you don't know much about Flexbox, <a href="https://www.youtube.com/playlist?list=PLMklnyuK-t1FDh7UXOIli60XqVo-h9Pvl">check out my video tutorials on YouTube to get acquainted.</a> You should be using it a lot in your work, as <a href="http://caniuse.com/#search=flexbox">it's now almost universally supported</a> and will give you more control over the alignment of elements. You can see that I've styled the <code>.active</code> class here which is switched (through javascript) when the user clicks on a navigation item.</p>

<p>The final piece is the grid itself. I'm using CSS Grid Layout to set the structure of the grid. It's a fairly simple grid with equal sized columns and rows. I've set media queries to allow for more columns as the screen size gets larger. If you don't know about CSS Grid, I've also recorded <a href="https://www.youtube.com/playlist?list=PLMklnyuK-t1H-Y_VbyOexAsKoYF6N9LNi">an introductory video tutorial series that covers everything you need to know to get started with CSS Grid Layout.</a> It's not universally supported, but <a href="http://caniuse.com/#feat=css-grid">is supported in the latest versions of most major browsers.</a> For more complete browser support, check out this <a href="https://rachelandrew.co.uk/css/cheatsheets/grid-fallbacks">fallback cheatsheet from Rachel Andrew.</a></p>

<p>I've used the section with the class of <code>.grid-wrapper</code> to be the grid container. You could use an unordered list to be the grid container. This might make it more semantic. When that container is set to <code>display: grid</code> then all of its children become grid items. That's one of the reasons using an unordered list makes sense.</p>

<p>Finally, I set the height and width of each image. You can play around with the sizes here to fit your needs. I wanted to make sure the images were neither overwhelming nor too small, so there are several size adjustments as the screen gets larger. You can also see that each cell is being targeted specifically so that I can flow an image into the cell. If you're using an <code>img</code> tag for your images, these are unnecessary.</p>

<h2>JavaScript (jQuery)</h2>

<pre>
  <code>// Show all
$('.filter-all').on('click', function() {
  var $this = $(this);
  $('.filter').removeClass('active');
  $this.addClass('active');
  $('.all').removeClass('hide');
});

// Show landscape
$('.filter-landscape').on('click', function() {
  var $this = $(this);
  $('.filter').removeClass('active');
  $this.addClass('active');
  $('.landscape').removeClass('hide');
  $('.urban, .portrait').addClass('hide');
});

// Show urban
$('.filter-urban').on('click', function() {
  var $this = $(this);
  $('.filter').removeClass('active');
  $this.addClass('active');
  $('.urban').removeClass('hide');
  $('.portrait, .landscape').addClass('hide');
});

// Show portrait
$('.filter-portrait').on('click', function() {
  var $this = $(this);
  $('.filter').removeClass('active');
  $this.addClass('active');
  $('.portrait').removeClass('hide');
  $('.landscape, .urban').addClass('hide');
});
</code>
</pre>

<p>The jQuery is simple. I'm just hiding and showing different items based on which navigation button the user clicks. On click, I record the button in the variable <code>$this</code> and then switch the <code>.active</code> class to the filter button that the user clicked. The category the user wants to see is shown while the other categories are hidden. </p>

<p>I'm sure there are ways to make this more DRY. I'm no code poet when it comes to JS. You could also use vanilla JS for this. It would save some page size if you didn't want to use the jQuery library.</p>

<p>And that's it. Easy peasy. You can take this basic framework and add hover effects, animation effects, or anything else your heart desires. If you just need a quick and dirty filtering system, though, this will work for you just fine. It's small, straight forward, responsive, and scalable.</p>

<p>
  <a href="https://codepen.io/brianhaferkamp/pen/ZyOjPo/">View on Codepen</a>
</p>

    ]]>
  </description>

  <dc:subject>Create A Basic Portfolio Filtering System</dc:subject>

  <dc:date>
    2017-08-17T15:42:35-07:00
  </dc:date>

</item>

      <item>

  <title>2x Images as Default?</title>

  <link>https://codepen.io/john-sexton/post/2x-images-as-default</link>
  <guid>https://codepen.io/john-sexton/post/2x-images-as-default</guid>

  <dc:creator>John Sexton</dc:creator>

  <description>
    <![CDATA[
    <h6>
  <em>Update 8/19: also investigated 1.5x with interesting results!</em>
</h6>

<p>I've recently been tasked with optimizing load times on our sites. Most of our pages are pretty image heavy, so image optimization is naturally the quickest and cheapest way to get a performance boost. I noticed some of our larger images were coming in around 300 - 500k... uhf-dah. </p>

<p>I spoke with the image production team and they said for large screen images their target file size was 400k, since "that was the number that the largest images didn't lose too much quality". For the record, I am not an image optimization expert. I know there are many factors that go into optimizing an image, but 400k seemed pretty high for a benchmark. </p>

<p>So, I started looking into other tactics we could take. Somehow I ended up on articles about retina and 2x images and the tactic used to optimize 2x images intrigued me. Doubling the <em>dimensions</em> of the image would allow me to crank the image quality way down, then use CSS to dictate the image dimensions. I did this to some images and found that I could save around 100k with large images. Here's a demo of one of those images:</p>

<p><p data-slug-hash="KvyOrd" data-default-tab="result" data-height="500" data-theme-id="0" data-embed-version="2" class="codepen"></p></p>

<p>Both images <em>appear</em> to have comparable quality at 1920px wide and we saved 107k - woohoo!</p>

<p>My question is: <strong>are there any drawbacks to using 2x images by default?</strong></p>

<p>Sure we have to specify the width in code, but that's usually good for browser rendering anyway - right? Are there other browser layout/paint/composite concerns with this tactic?  Am I missing something? Is this already a thing and I don't know it? I talked to the designers on our team and no one knew anything about using 2x by default.</p>

<p>I'm not saying "2x all the things!!!", but especially for large hero images, it seems to make a lot of sense.</p>

<h3>Another Plus On Mobile</h3>

<p>I also applied this tactic to mobile images and I noticed that when at max zoom, the 2x version was less pixelated. It was also about 20k smaller. Feels like another win...</p>

<h4>Mobile 1x Max Zoom</h4>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/750178/1x-mobile-zoom.jpg" alt="1x zoom" />
</p>

<h4>Mobile 2x Max Zoom</h4>

<p>
  <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/750178/2x-mobile-zoom.jpg" alt="2x zoom" />
</p>

<p>Please let me know your thoughts!</p>

<h3>Update: 1.5x</h3>

<p>I sent this post to <a href="https://css-tricks.com/">CSS Tricks</a> and they referred me to <a href="http://daverupert.com/2013/06/ughck-images/">an article from a few years ago</a> and recommended looking at 1.5x. So I took a crack at it with the demo above and found that 1.5x and 10% quality I saved 194k! (87k more than 2x). Perceived quality appears to be pretty close to 1x and 2x.</p>

<p><p data-slug-hash="LjdYrw" data-default-tab="result" data-height="500" data-theme-id="0" data-embed-version="2" class="codepen"></p></p>

<p>I also <a href="https://codepen.io/john-sexton/pen/GvxREp">did this with a more complex image with less blur</a> and found that the 1.5x also saved the most weight and still looked good. (Thanks to <a href="https://codepen.io/mikelothar">Mike Lothar</a> for calling out blur and image complexity)</p>

<p>I'm still feeling like this tactic is pretty decent, whether it's 2x or 1.5x. Any other thoughts/concerns from anyone?</p>

    ]]>
  </description>

  <dc:subject>2x Images as Default?</dc:subject>

  <dc:date>
    2017-08-19T19:56:34-07:00
  </dc:date>

</item>

      <item>

  <title>Getting Started with CSS Animations</title>

  <link>https://codepen.io/gps-creative/post/getting-started-with-css-animations</link>
  <guid>https://codepen.io/gps-creative/post/getting-started-with-css-animations</guid>

  <dc:creator>Geek Powered</dc:creator>

  <description>
    <![CDATA[
    <h2>What Are CSS Animations?</h2>

<p>You obviously know what an animation is - what I'm tryng to get at here are the different kinds of CSS Animations. There are the kind we already using without thinking - <strong>transition animations</strong>, then there is the widely supported, but extremely basic <strong>CSS3 Keyframe Animations</strong>, and finally there are the significantly less supported <strong>Web Animations API</strong>.

</p><h3>Transition Animations</h3>
<p>Yes we know about these, we use them for :hover or :focus states all over our current sites. These animations are the least taxing on browsers (and therefore have the lowest impact on site performance/speed).</p>

<p class="aside">Sidenote on Speed &amp; Performance: Animating opacity and transforms hinder performace the least, and are the least taxing on browsers. Changing a layout with animation (width, display, etc.) is the most taxing on browsers, and therefore hinder speed the most.</p>

<p class="aside">
  <strong>Be wary of heavy animations, because slow or browser-heavy animations could cause the enitre page to repaint! (Ex: Say you're reading an article on your phone, and an add suddenly causes the page to reload or jump.)</strong>
</p>

<p>In case you don't know the full shorthand for CSS transitions, here it is: </p><pre class="lang-css has-code">
  <code class="css cm-s-default">.example {
    transition: [transition-property] [transition-duration] [transition-timing-function] [transition-delay];
}</code>
</pre>

<p>While we know a lot on how to use transition animations, one aspect of them that's always remained somewhat of a mystery to me are <strong>easing curves</strong>. An article I read talked about using easing curves in a really basic sense - thinking about using them in the same way motion occurs. For example, if you are driving somewhere, it takes you a bit of time to pick up speed (ease-in) &amp; when you're arriving at your destination, likewise it takes some time to slow down (ease-out). Basically, your transition animations should generally ease-in on :hover, then ease-out when you move your mouse away (ease-in-out). There are also a lot of other easing-curves, and while I'm no expert on all of them, <a rel="nofollow" href="http://easings.net/">these line graphs</a> do a really good job of explaining all of your options.</p>

<h3>CSS Keyframe Animations</h3>

<p>To find support for CSS keyframe animations or Web Animations API checkout <a rel="nofollow" href="http://caniuse.com/#search=animation">caniuse.com</a>. Basically, these keyframe animations can do most of what another transition animation can do, but with the ability to repeat the animation, and have greater control. Ideally, as we learn more about animations, we can come back to this specific topic, or learn together for more info.</p>

<h3>Web Animations API</h3>

<p>These animations are really <em>the bleeding edge</em> of what you can do on the web. These animations are javascript based, and edit the browser's DOM. Translation: they are a lot more taxing on the browser. Browsers weren't initially conceived to do this kind of thing, and they've been slow to adopt. The spec for this is still being edited, and Chrome &amp; Firefox are the only browsers that have any kind of support.</p>

<p>What is cool about these is that they're really on their way to becoming a replacement for Flash - which is now <a rel="nofollow" href="https://www.wired.com/story/adobe-finally-kills-flash-dead/">officially dead</a>. Web Animations API have the ability to create what most relate to auto-playing, video animations. But, with great power, comes great responsibility... </p>

<h2>When to Use CSS Animations</h2>

<p>I'm a big fan of <a rel="nofollow" href="http://thewebahead.net/">The Web Ahead Podcast</a>, and <a rel="nofollow" href="http://thewebahead.net/103">this episode</a> talked a lot about when to use animations &amp; how to avoid misusing animations. The idea of when and when not to use animations focused around an idea of <a rel="nofollow" href="https://alistapart.com/article/web-animation-at-work"><strong>6 major uses of web animation</strong></a></p>

<ol>
<li>Causality (click submit button and form dissapears)</li>
<li>Feedback (pressing a button, or video has loaded)</li>
<li>Relationship (tie where you’ve been with where you are - iOS enlarging app rather than a straight jump, animating page transition, etc.)</li>
<li>Progression (loading bar)</li>
<li>Physics (skeuomorphic design - using easings to make motion more believable)</li>
<li>Transition (think CSS transition animations)</li>
</ol>

<p>Some potential use-cases for us, surrounding these major uses could include animating <a rel="nofollow" href="https://codepen.io/Stephn_R/pen/pvpEVK">calls to action</a>, using parallax to <a rel="nofollow" href="https://www.cabletv.com/the-walking-dead">tell a story</a> with your page, or even something as simple as bringing in a sticky-nav or mobile-menu. In the podcast, they also mention that if you create an animation that it should fulfill at least 2 purposes (and delight should never be one of them.) Try to think about using animation like, "is this new information coming onto the page, or coming off of the page?" because if it's already there, it probably doesn't need to be animated.
</p><p><strong>The pitfalls of doing animation wrong:</strong> Animation done wrong can annoy the user, slow down a webpage, and potentially illegitimize the entire site. <em>'Is this spam?'</em> Animation should be incorperated into style-guides and be thought of as a part of the client's digital brand, made from deliberate and consistent decisions.</p>

<p class="aside">Ex: You would use a blowtorch to weld, but not to light birthday candles.</p>

<h2>Moving Forward</h2>

<p>If you want to learn more about CSS Animations, check out this <a rel="nofollow" href="http://webanimationweekly.com/">web animation weekly newsletter</a>, or explore the resources below.</p>

<h2>Resources</h2>

<ul>
<li><a rel="nofollow" href="https://css-tricks.com/css-animations-vs-web-animations-api/">CSS Tricks - CSS Animations vs Web Animations API</a></li>
<li><a rel="nofollow" href="http://learn.shayhowe.com/advanced-html-css/transitions-animations/">Transition &amp; Animations</a></li>
<li><a rel="nofollow" href="https://cssanimation.rocks/">CSS Animation Articles, Tips &amp; Tutorials</a></li>
<li><a rel="nofollow" href="https://daneden.github.io/animate.css/">Animate.css</a></li>
<li><a rel="nofollow" href="https://robots.thoughtbot.com/css-animation-for-beginners">CSS Animations for Beginners</a></li>
<li><a rel="nofollow" href="http://easings.net/">Learning About Easing Curves</a></li>
<li><a rel="nofollow" href="https://css-tricks.com/ease-out-in-ease-in-out/">CSS Tricks - About Easing</a></li>
<li><a rel="nofollow" href="http://css3.bradshawenterprises.com/transitions/">CSS Transitions</a></li>
<li><a rel="nofollow" href="http://css3.bradshawenterprises.com/animations/">CSS3 Animations</a></li>
<li><a rel="nofollow" href="http://thewebahead.net/103">The Web Ahead Podcast - Animating the Web</a></li>
<li><a rel="nofollow" href="https://codepen.io/jorgecardoso/post/1-css-transitions-and-animations">Exercises to Better Learn CSS Transitions &amp; Animations</a></li>
<li><a rel="nofollow" href="http://animista.net/">Animasta animation builder</a></li>
</ul>

    ]]>
  </description>

  <dc:subject>Getting Started with CSS Animations</dc:subject>

  <dc:date>
    2017-08-08T17:35:18-07:00
  </dc:date>

</item>


  </channel>

</rss>
