<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by T.J. Fogarty on Medium]]></title>
        <description><![CDATA[Stories by T.J. Fogarty on Medium]]></description>
        <link>https://medium.com/@tj_fogarty?source=rss-4c4483aed8bb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*nfgIsI3yWh_liP95R6-XzQ.jpeg</url>
            <title>Stories by T.J. Fogarty on Medium</title>
            <link>https://medium.com/@tj_fogarty?source=rss-4c4483aed8bb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:00:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tj_fogarty/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Image Parallax and Blur with Tornis]]></title>
            <link>https://medium.com/@tj_fogarty/image-parallax-and-blur-with-tornis-fa0233297173?source=rss-4c4483aed8bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa0233297173</guid>
            <category><![CDATA[parallax]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[T.J. Fogarty]]></dc:creator>
            <pubDate>Tue, 28 May 2019 10:19:05 GMT</pubDate>
            <atom:updated>2019-05-29T11:07:40.043Z</atom:updated>
            <content:encoded><![CDATA[<p>I updated my site recently and wanted to put a bit more focus on images. To do that, I included a space for cover images in articles. They take up a chunk of the top of the page, and I’ll probably re-think this approach at some stage. Maybe I’ll overlay the title and description over the image…</p><p>I wanted to include a bit of pizazz, and the image was the prime candidate. That’s when I remembered <a href="https://tornis.robbowen.digital/">Tornis</a> , a library that lets you respond to changes in the viewport. I wanted it for the scroll position monitoring, and while I can add an event listener to window and do the same thing, I&#39;m thinking of a few other use-cases for this library, so I figured why not give it a go.</p><p>Here’s a stripped down version of the code I used on my site. In reality, I’m checking for the existence of the cover image before kicking anything off. I followed the examples on the Tornis site to get here.</p><pre>const { watchViewport } = tornis<br>const coverImage = document.querySelector(&#39;.js-cover-image&#39;)<br>const updateValues = ({ scroll }) =&gt; { <br>  if (scroll.changed) {<br>    let scrollOffset = scroll.top / coverImage.clientHeight<br>    <br>    scrollOffset = scrollOffset &lt; 0 ? 0 : scrollOffset<br>    scrollOffset = scrollOffset &gt; 1 ? 1 : scrollOffset <br>    document.body.style.setProperty(&#39;--scrollY&#39;, scrollOffset) <br>  } <br>} </pre><pre>watchViewport(updateValues)</pre><p>I’m checking to see if we’ve scrolled past the cover image and setting a value between 0 and 1 in the scrollY custom property. With this custom property, I&#39;m setting the filter and transform property of the custom image.</p><p>I’m also using position: sticky so the image travels down the page with us.</p><pre>.cover-image {<br>  position: sticky;<br>  top: 0;<br>  height: 240px;<br>  overflow: hidden;<br>  filter: <em>blur</em>(<em>calc</em>(var(--scrollY) * 10px));<br>  transform: <em>translate</em>(0, <em>calc</em>(var(--scrollY) * -30px));<br>}</pre><p>For the blur, I’m multiplying scrollY by 10 pixels. So when scrollY is 0.3 that&#39;ll evaluate to a 3px blur. The transform behaves in the same fashion so that it slowly crawls in the opposite direction of the scroll.</p><p>You can probably think of more creative uses, for example, the amazing forest scrolling on the Tornis homepage.</p><p>See the Pen <a href="https://codepen.io/tjFogarty/pen/qGyqwa/">Tornis Parallax and Blur Demo</a> by T.J. Fogarty (<a href="https://codepen.io/tjFogarty">@tjFogarty</a>) on <a href="https://codepen.io/">CodePen</a>.</p><p><em>Originally published at </em><a href="https://tj.ie/image-parallax-and-blur-with-tornis/"><em>https://tj.ie</em></a><em> on May 28, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa0233297173" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Responsibilities of a Web Person]]></title>
            <link>https://medium.com/@tj_fogarty/responsibilities-of-a-web-person-20ba7e0e9365?source=rss-4c4483aed8bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/20ba7e0e9365</guid>
            <category><![CDATA[responsibility]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[T.J. Fogarty]]></dc:creator>
            <pubDate>Thu, 06 Aug 2015 19:49:20 GMT</pubDate>
            <atom:updated>2015-08-06T19:50:25.790Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is about what I think it means to be a web person. I’m using ‘person’ here because that’s what you get when you strip away all the titles. We’re people first.</p><p>Working with computers is a large part of our daily lives, so it’s easy to get lost in those titles. Job postings start looking like “we’re looking for this thing that has these features”.</p><p>It’s all person-to-person. I’m just trying to pare it back and look at the commonalities in what we’re all doing here.</p><h3>Responsibilities</h3><p>We all got into the web for different reasons, and it doesn’t matter what they are. What matters are the responsibilities we then inherit, whether we acknowledge them or not.</p><h4>Serving Ourselves</h4><p>These are the most obvious responsibilities. We want to be happy, so we do the things we like. If we’re not happy we try to alter our patterns or exert some kind of control over our situation.</p><p>Skills atrophy on the web. Everyday we wake up to something new and exciting so we need to learn a little bit about it. We need to keep iterating on our processes, or consider throwing them out completely. It can be a gruelling pace, but when something clicks, it’s an incredible experience. You share it, and others might get excited. It’s an inspiring chain-reaction.</p><h4>Serving Users</h4><p>These ones are a bit more nuanced. Our work is out there in the open, subject to every kind of user imaginable. This can be both exciting and terrifying.</p><p>Users expect things to work a certain way. These expectations are shaped by previous experiences. These exist in many forms in the myriad of devices available. You should know, you’re a user! You have every right to expect a pleasant, usable experience.</p><h3>Conflicts</h3><p>So, we’re a happy bunch of users. Why? We’re happy because we usually have the latest browsers or smartphones.</p><p>We can also be unhappy users when something doesn’t work the way expect. We might know how it was implemented, so we become more focused on the accessibility/usability/technical implementation of it.</p><p>What if the user doesn’t work on the web like some of us? How might our responsibilities to ourselves clash with our duty to serve the people?</p><p>We know already how quickly the web evolves. We might feel pressure to use the latest tools to keep up. This pressure can blind-side us to the people we’re excluding. Are we using this tool because it genuinely helps us help others? Or is it because it’s fun and we’re all talking about it?</p><h3>Resolution</h3><p>It’s not about shaming. It’s about thinking of the choices we make that make us feel good. Those choices may not feel good for a user who doesn’t have the same setup as us. We don’t consciously exclude people, and it can be impossible to avoid. We just need to think before we bower install sometimes.</p><p><em>Originally published at </em><a href="http://www.tjfogarty.io/responsibilities-of-a-web-person/"><em>www.tjfogarty.io</em></a><em> on July 20, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20ba7e0e9365" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pace Yourself]]></title>
            <link>https://medium.com/@tj_fogarty/pace-yourself-8ad5683cfffd?source=rss-4c4483aed8bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ad5683cfffd</guid>
            <category><![CDATA[burnout]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[mental-health]]></category>
            <dc:creator><![CDATA[T.J. Fogarty]]></dc:creator>
            <pubDate>Thu, 06 Aug 2015 17:04:32 GMT</pubDate>
            <atom:updated>2015-08-06T17:09:14.931Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first started college I was full-sure I was learning to become a web designer. I had experience with PhotoShop from my teen years when creating signature graphics, or “sigs”, for people on forums, or designing little sites on Freewebs (mostly with Flash-based games embedded on the page. They were fabulous travesties complete with background music and animated gifs, and I’m still not sorry.)</p><p>As I progressed, I found myself drawn more to the development side of things. This helped immensely as the course I was doing became more programming oriented. I moved from PhotoShop to Notepad++, and my colour palettes were more focused on syntax themes.</p><p>This shift meant I was becoming one of the go-to people when someone had a question or a problem. After a couple of years of this I started to feel more responsible for these problems, like I <em>needed</em> to know the answers — I put the unnecessary expectation on myself to have the solutions. Instead of trying to meet my own deadlines and being honest in saying “I don’t know, but here’s some resources that might help”, I would instead drop what I was doing and make those problems my own. There’s nothing wrong with doing that the odd time, but just not every time.</p><p>This got to a point where I even did someone’s final year project, and we were driving to the presentation while I typed their slides in the passengers seat. I put myself in that position when there was absolutely no need. I didn’t stop to consider if I was truly doing the right thing for myself or my friend.</p><p>After college, I was lucky enough to land a job as an intern web developer working alongside someone who was incredible at what they did. After 9 months he moved on, and I was back in a very familiar position by being the only in-house web developer. I learned so much in that time, but the trial by fire that followed coupled with my eternally-nodding head left me burnt out rather quickly. I’m not going to go into specifics about my journey, but I wouldn’t be where I am today without that experience, and I’ll forever be grateful for it.</p><p>Littered throughout all this are bouts of imposter syndrome, which is wonderfully explored by David Walsh in his blog post <a href="http://davidwalsh.name/impostor-syndrome">“I’m an Imposter”</a>. It’s such an honest article, and it can apply to any industry, not just the web.</p><p>You might hear about burn out, and attribute it to someone who was just worked too hard, but it’s also worth thinking about that fact that it’s not always the environment they’re put in that causes it. It certainly contributes, but there’s an onus there to know one’s limits as well. I would ignore my frazzled mind’s attempt to switch off, and if I felt happy every once in a while, well, that was just a bonus.</p><p>I love coding in my spare time which means work and play can sometimes overlap. I’ve gotten far better at managing this balance, and I can switch off and go do something else without a strange sense of guilt plaguing me. I try to imagine the world literally ending, and it all seems kind of silly.</p><p>So the takeaway for me was to step back, and not rush into commitments. It was irresponsible, and unfair to all parties involved. Sure there can be pressure there for an answer straight away, but it’s absolutely OK to say “I need more time before I can quote for that” or “I don’t know how to do that, I need time to research it. Let me get back to you after lunch with what I find”.</p><p>Take your time. You’ll never know all the answers.</p><p>Sure how can you when in the time it took to read this about 20 new frameworks are available. Better get on that :p</p><p><em>Originally published at </em><a href="http://www.tjfogarty.io/pace-yourself/"><em>www.tjfogarty.io</em></a><em> on June 27, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ad5683cfffd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started With WordPress and Unit Testing]]></title>
            <link>https://medium.com/@tj_fogarty/recently-i-ve-begun-working-on-a-project-built-with-wordpress-ed71ddd75cb0?source=rss-4c4483aed8bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed71ddd75cb0</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[T.J. Fogarty]]></dc:creator>
            <pubDate>Sat, 11 Jul 2015 16:35:54 GMT</pubDate>
            <atom:updated>2015-07-11T17:23:22.866Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I’ve begun working on a project built with WordPress. One of the requirements involves writing tests and outputting a report.</p><p>In this post, I hope to show how I’ve set up the project to utilise PHPUnit and WP_UnitTestCase. I’ve had minimal exposure to PHPUnit in the past, so I was delighted to start learning more.</p><p>Hey, you might read this and know a better way! Feel free to leave a comment.</p><h2>Setup</h2><p>You’ll need an install of WordPress. This might be an existing project, or a fresh install. <a href="http://wp-cli.org/">WP-CLI</a> is a very handy tool for quickly setting this up, but it’ll also do many, many other things for you that I won’t cover here e.g. <a href="http://wp-cli.org/commands/db/export/">exporting a database</a>, and even <a href="http://wp-cli.org/commands/plugin/install/">installing plugins</a>.</p><p>Next up, you’ll need <a href="https://getcomposer.org/">Composer</a> installed. I’m using this to install PHPUnit globally with the command composer global require “phpunit/phpunit=4.7.*. You can verify the successful installation with phpunit — version in your terminal provided you have Composer packages added to your path. (To do this, see this <a href="http://akrabat.com/global-installation-of-php-tools-with-composer/">useful post</a>.)</p><p>Within the root of your WordPress project you’ll need to run svn co <a href="http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/">http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/.</a> This integrates with PHPUnit to make writing our tests a little easier. Want to create a post? $this-&gt;factory-&gt;post-&gt;create(). Want to create 30 posts? $this-&gt;factory-&gt;post-&gt;create_many(30). This goes for posts, users, comments, categories… anything you might need to generate. You can <a href="https://core.trac.wordpress.org/browser/trunk/tests/phpunit/includes/factory.php">browse the source</a> to learn more about it.</p><p>This doesn’t <em>have</em> to be in the root of your project, but this just happens to be where I’ve set up mine. You should now see an includes folder in your project root.</p><p>You’ll need a phpunit.xml file in your root to specify some configuration. It’ll tell PHPUnit which files to use for it’s tests.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; <br>&lt;phpunit bootstrap=&quot;./tests/bootstrap.php&quot; backupGlobals=&quot;false&quot; colors=&quot;true&quot; convertErrorsToExceptions=&quot;true&quot; convertNoticesToExceptions=&quot;true&quot; convertWarningsToExceptions=&quot;true&quot;&gt; <br>  &lt;testsuites&gt; <br>    &lt;testsuite&gt; <br>      &lt;directory prefix=&quot;test-&quot; suffix=&quot;.php&quot;&gt;./tests/&lt;/directory&gt;     <br>    &lt;/testsuite&gt; <br>  &lt;/testsuites&gt; <br>&lt;/phpunit&gt;</pre><p>What this is saying is it’s looking for a folder called tests and a file called bootstrap.php. This is what will kick it all off, and &lt;directory prefix=”test-” suffix=”.php”&gt; says that test files begin with test- and have the extension of .php. So go ahead and create that tests folder and bootstrap.php.</p><p>For starters, here’s what your bootstrap file might look like -</p><pre>require_once dirname( dirname( __FILE__ ) ) . &#39;/includes/functions.php&#39;; </pre><pre>function _manually_load_environment() <br>{ <br>  // Add your theme  <br>  switch_theme(&#39;your-theme&#39;); </pre><pre>  // Update array with plugins to include ... <br>  $plugins_to_active = array( <br>                         &#39;some-plugin/some-plugin.php&#39;, <br>                         &#39;another-plugin/another-plugin.php&#39; <br>                       ); <br>  update_option( &#39;active_plugins&#39;, $plugins_to_active ); <br>} </pre><pre>tests_add_filter( &#39;muplugins_loaded&#39;, &#39;_manually_load_environment&#39; ); <br>require dirname( dirname( __FILE__ ) ) . &#39;/includes/bootstrap.php&#39;;</pre><p>What we’re doing here is setting up some initial state for our tests. I’m setting the theme and the plugins that I want to be active, and that’s about it.</p><p>Now, what are we going to test on? We’ll need to create an empty database in order to run our tests against. Create a file called wp-tests-config.php in the root of your project. It’ll contain information regarding your test database which you’ll need to create.</p><pre>&lt;?php <br>/* Path to the WordPress codebase you&#39;d like to test. Add a backslash in the end. */ <br>define( &#39;ABSPATH&#39;, dirname( __FILE__ ) . &#39;/&#39; ); <br>// Test with multisite enabled. <br>// Alternatively, use the tests/phpunit/multisite.xml configuration file. <br>// define( &#39;WP_TESTS_MULTISITE&#39;, true ); <br>// Force known bugs to be run. <br>// Tests with an associated Trac ticket that is still open are normally skipped. <br>// define( &#39;WP_TESTS_FORCE_KNOWN_BUGS&#39;, true ); <br>// Test with WordPress debug mode (default). define( &#39;WP_DEBUG&#39;, true );<br> <br>// ** MySQL settings ** // <br>// This configuration file will be used by the copy of WordPress being tested. <br>// wordpress/wp-config.php will be ignored. <br>// WARNING WARNING WARNING! <br>// These tests will DROP ALL TABLES in the database with the prefix named below. <br>// DO NOT use a production database or one that is shared with something else. <br>define( &#39;DB_NAME&#39;, &#39;test_db&#39; ); <br>define( &#39;DB_USER&#39;, &#39;user&#39; ); <br>define( &#39;DB_PASSWORD&#39;, &#39;password&#39; ); <br>define( &#39;DB_HOST&#39;, &#39;localhost&#39; ); <br>define( &#39;DB_CHARSET&#39;, &#39;utf8&#39; ); <br>define( &#39;DB_COLLATE&#39;, &#39;&#39; ); <br>$table_prefix = &#39;wptests_&#39;; <br>// Only numbers, letters, and underscores please! <br>define( &#39;WP_TESTS_DOMAIN&#39;, &#39;custom-domain.dev&#39; ); <br>define( &#39;WP_TESTS_EMAIL&#39;, &#39;test@domain.com&#39; ); <br>define( &#39;WP_TESTS_TITLE&#39;, &#39;Test Blog&#39; ); <br>define( &#39;WP_PHP_BINARY&#39;, &#39;php&#39; ); define( &#39;WPLANG&#39;, &#39;&#39; );</pre><p>No more set up, let’s start writing tests!</p><h2>Creating Tests</h2><p>So now you have this tests directory with a lonely bootstrap.php file sitting in it. Let’s give it some company with a simple test to see if the active theme is the one we set in that bootstrap file.</p><p>Create a new file called test-active-theme.php and put in the following:</p><pre>&lt;?php <br>class TestActiveTheme extends WP_UnitTestCase <br>{ <br>  /** * Test that the correct theme is active (set in bootstrap.php) */ <br>  function testCorrectActiveTheme() <br>  { <br>    $this-&gt;assertTrue(&#39;your-theme&#39; == wp_get_theme()); <br>  } <br>}</pre><p>Have a look there and you’ll see we’re extending WP_UnitTestCase. This affords us some useful perks in that when we run our tests it re-creates the database for a fresh WordPress install.</p><p>Finally! Within the root of your project, run phpunit and you should see something like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*Z4aFtxhEdZ8HTnDT9FWH7g.png" /></figure><p>Success! In your own tests, you can access your regular WordPress functions, and your active plugin classes/functions. You might even include some Composer packages to mock your data (like <a href="https://github.com/fzaninotto/Faker">Faker</a>).</p><p>See the <a href="https://phpunit.de/documentation.html">PHPUnit documentation</a> for more information on the tests you can run, and how you can <a href="https://phpunit.de/manual/current/en/textui.html">export</a> the results.</p><p>For further reading, have a look at the <a href="https://core.trac.wordpress.org/browser/trunk/tests/phpunit/tests">tests written for WordPress Core</a>.</p><p>Happy testing!</p><p><em>Originally published at </em><a href="http://www.tjfogarty.io/wordpress-and-unit-testing/"><em>www.tjfogarty.io</em></a><em> on July 10, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed71ddd75cb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quickly build a simple grid with Sass]]></title>
            <link>https://medium.com/@tj_fogarty/quickly-build-a-simple-grid-with-sass-15023ce97d61?source=rss-4c4483aed8bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/15023ce97d61</guid>
            <category><![CDATA[sass]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[T.J. Fogarty]]></dc:creator>
            <pubDate>Fri, 20 Mar 2015 22:32:32 GMT</pubDate>
            <atom:updated>2015-03-20T22:40:55.119Z</atom:updated>
            <content:encoded><![CDATA[<p>All you need are some variables and loops. Granted, some may argue for readability, but as long as what you’re doing is well documented, it can save you a lot of time. Especially if you want to add/remove breakpoints.</p><p>The end result should be a simple class list that is responsible for the width of your column. I’m using a separate class to take care of floats and padding.</p><p>For my purposes, I’m using .layout__item and .g-1–12, .g-2–12… etc</p><p>.layout__item will contain the following:</p><pre>.layout__item { <br>  padding-left: 15px; <br>  padding-right: 15px; <br>  float: left; <br>}</pre><p>Starting off, I need a formula for calculating width based off a fraction of how many columns I want.</p><p>Say I wanted a column to extend 4/12 of the page, I’d use:</p><p>(4 / 12) * 100%</p><p>In Sass, this would return 33.33333%. Happy days, so let’s keep that in a function.</p><pre>@function percentage-width($span, $columns) { <br>  @return ($span / $columns) * 100%; <br>}</pre><p>I’m then going to keep my colums in a variable.</p><pre>$grid-column: 12;</pre><p>Next, I’m going to use a for loop to iterate through my number of columns, and use the percentage-width function.</p><pre>@for $i from 1 through $grid-columns { <br>  .u-#{$i}-#{$grid-columns} { <br>    width: percentage-width($i, $grid-columns); <br>  } <br>}</pre><p>This yields the following:</p><pre>.u-1-12 { <br>  width: 8.33333%; <br>} </pre><pre>.u-2-12 { <br>  width: 16.66667%; <br>} </pre><pre>.u-3-12 { <br>  width: 25%; <br>}</pre><p>etc…</p><p>So what about breakpoints? The above example would surely serve well as a mobile-first starting point.</p><p>Let’s throw in another variable, a map:</p><pre>$grid-breakpoints: ( <br>  medium: 768px, <br>  large: 960px <br>);</pre><p>We can use the above loop again, but modify it slightly to include medium and large in the class name.</p><pre><em>// Loop breakpoints to generate screen-specific grids</em><br>@each $key, $val in $grid-breakpoints {<br>  @media (min-width: <em>#{$val}) {</em><br>    @for $i from 1 through $grid-columns {<br>      .u-#{$i}-#{$grid-columns}--#{$key} {<br>        width: percentage-width($i, $grid-columns);<br>      }<br>    }<br>  }<br>}</pre><p>It’s the same loop, but repeated for every breakpoint defined in $grid-breakpoints, resulting in:</p><pre>@media (min-width: 768px) {<br>  .u-1-12--medium {<br>    width: 8.33333%; }<br>  .u-2-12--medium {<br>    width: 16.66667%; }</pre><p>And so on.</p><p>See the Pen <a href="http://codepen.io/tjFogarty/pen/KwrRex/">Simple grid with Sass</a> on <a href="http://codepen.io/">CodePen</a>.</p><p><em>Originally published at </em><a href="http://www.tjfogarty.io/quickly-build-a-simple-grid-with-sass/"><em>www.tjfogarty.io</em></a><em> on March 17, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15023ce97d61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A revised front-end process with a hint of ExpressionEngine]]></title>
            <link>https://medium.com/@tj_fogarty/a-revised-front-end-process-with-a-hint-of-expressionengine-36dde519386?source=rss-4c4483aed8bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/36dde519386</guid>
            <dc:creator><![CDATA[T.J. Fogarty]]></dc:creator>
            <pubDate>Fri, 17 Oct 2014 11:55:29 GMT</pubDate>
            <atom:updated>2014-10-17T11:55:29.130Z</atom:updated>
            <content:encoded><![CDATA[<p>My aim in the past while has been pointed towards front-end development, and exploring the different ways in which to produce a tidy result.</p><p>These examples point to ExpressionEngine paths, but you can customise them to any project you’re working on. I’m relatively new to the ExpressionEngine game, and some of what I’m going to outline will be eventually replaced by Niall O’Brien’s <a href="https://github.com/niallobrien/generator-ee-foundation">EE Foundation</a> generator, so that’s definitely something to keep an eye on.</p><p>As with many things, we start with <a href="http://gulpjs.com/">Gulp</a>. This will handle our assets and do some nifty things such as generating our critical CSS and automatically injecting our Bower components whenever we update them. See below for an example setup:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bddcebfae2aeeaa9b5c91ea6fb13df8f/href">https://medium.com/media/bddcebfae2aeeaa9b5c91ea6fb13df8f/href</a></iframe><p>This is just the standard-fare Gulp setup. We’ve got tasks for watching and compiling our assets. It’s the structure of these assets that I want to talk about.</p><h3>Styles</h3><p>I’m using Sass (SCSS syntax), and I’m borrowing heavily from <a href="http://mvcss.github.io/">MVCSS</a> for the structure. It’s a simplified version (i.e. I’ve left things out) to a point where I find it easier to manage.</p><p>A typical folder structure would be :</p><h4>Core</h4><p>This is the foundation of the project, where we establish defaults on tag-level elements, define variables, layouts, mixins… The files in here might go as follows:</p><ul><li>_base.scss — our tag-level styles.</li><li>_config.scss — definition of our variables, fonts etc…</li><li>_helpers.scss — mixins, placeholders, utility classes.</li><li>_layout.scss — grid-type classes.</li><li>_reset.scss — I like to use <a href="https://github.com/kristerkari/normalize.scss">normalize.css</a></li></ul><h4>Modules</h4><p>These are the building blocks of our project, and each component gets it’s own file. This helps isolate styles so they don’t leak into other components — it’s about making a more reusable code-base. You might have files like _button.scss or _panel.scss.</p><h4>And the rest</h4><p>To tie this all together we have a main.scss file that imports all of the above, including, if you’re anything like me, a _shame.scss file. I’ve written some horrible, horrible things. Things I’d rather forget. Thanks to the shame file I don’t have an excuse any more.</p><p>I’m also a fan of the BEM naming convention for CSS. This <a href="http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/">great post</a> by Harry Roberts explains it better than I ever could.</p><h3>Scripts</h3><p>I’ve aimed to manage my JavaScript in the same way as my CSS. I have a main.js file that pulls in all my modules, and <a href="http://browserify.org/">Browserify</a> does the rest.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/220025bf88b2ebc90056e9c2eb5c9659/href">https://medium.com/media/220025bf88b2ebc90056e9c2eb5c9659/href</a></iframe><p>What I’m doing is using wiredep to insert my Bower components into the page, then including my main.js file. This ensures my custom scripts have access to the likes of jQuery, or Foundation.</p><p>I’ve also created a little script that lets you monitor what Foundation breakpoint you’re on.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3186944d0f324a9b4dbbfdf9bee1acb7/href">https://medium.com/media/3186944d0f324a9b4dbbfdf9bee1acb7/href</a></iframe><p>So you can run `MQ.isSmallOnly()` or `MQ.isMediumUp()`.</p><h3>ExpressionEngine</h3><p><a href="https://github.com/focuslabllc/ee-master-config">EE Master Config</a> has made optimising for different environments very simple. For example, I want to serve the critical CSS on a live site, but the standard unminifed version on my dev machine:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be7be64cb70846159b7d603de9c9333b/href">https://medium.com/media/be7be64cb70846159b7d603de9c9333b/href</a></iframe><p>I can do this with scripts as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9aa9ade14e9fb304e3b1f68006217043/href">https://medium.com/media/9aa9ade14e9fb304e3b1f68006217043/href</a></iframe><h3>I’m out</h3><p>That’s all I’ve got. This is my day off. There’s still a lot more to consider and refactor, but I think it’s a good starting point.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36dde519386" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let CSS do the work]]></title>
            <link>https://medium.com/@tj_fogarty/let-css-do-the-work-b2aa02104013?source=rss-4c4483aed8bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2aa02104013</guid>
            <dc:creator><![CDATA[T.J. Fogarty]]></dc:creator>
            <pubDate>Mon, 02 Sep 2013 09:28:13 GMT</pubDate>
            <atom:updated>2013-09-02T09:28:13.256Z</atom:updated>
            <content:encoded><![CDATA[<h4>There’s a time and a place for JavaScript.</h4><p>I&#39;ve been guilty of this many times, especially when I was first starting out with JavaScript.</p><p>Once the excitement died down, however, I realized I was just making more work for myself in the long run. I was mistaking stateless HTML with having no context until I could figure it out with JavaScript. An example I&#39;ve seen of this is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/0*BnYkghGzJcPQyBHG.png" /></figure><p>This isn&#39;t particularly flexible, and in the cases I&#39;ve seen ‘curPage’ isn&#39;t used for much more than setting the active navigation item. Instead, let’s use classes to set the context and CSS to figure the rest out. In these examples I’m using Sass, but I’ll show the compiled output as well.</p><p>Let’s begin with the markup. This works on the basis that there’s a wrapping element (the &lt;body&gt; tag in this case), and we target specific elements from that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/0*hfJ3UR4ciWQdB4Y1.png" /></figure><p>All you have to take notice of is the class “page—home”, and the class on the anchor tag (“nav—home”), so you can figure out the rule would be .page—home .nav-home { /* active nav styles */ }</p><p>In my Sass example, there’s a couple of extra things going on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/0*zuQafOvQcAO4wMbq.png" /></figure><p>We have an array which matches the second half of the classes on the page and anchor tag. I’m then looping through them and extending my active class. The output is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/0*iVeGhQ93iTLIsnpo.png" /></figure><p>You can see the <a href="http://codepen.io/tjFogarty/pen/HcyCj">working result here</a>. I had to use JavaScript here to simulate the changing pages.</p><p>You can easily create CSS-only drop downs as well with use of :hover to display the hidden child element. Maybe sprinkle some transitions to fade it in rather than using the animate(); method in jQuery :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2aa02104013" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Figuring out a build process]]></title>
            <link>https://medium.com/@tj_fogarty/figuring-out-a-build-process-a169f879d056?source=rss-4c4483aed8bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a169f879d056</guid>
            <dc:creator><![CDATA[T.J. Fogarty]]></dc:creator>
            <pubDate>Fri, 23 Aug 2013 11:13:44 GMT</pubDate>
            <atom:updated>2013-08-23T11:13:44.953Z</atom:updated>
            <content:encoded><![CDATA[<h4>An exercise in pulling the finger out</h4><p>These days it’s relatively easy to cobble together a website. All you need is some search-engine prowess and half an ounce of patience. Sprinkle (or pour, in some cases) some <a href="http://jquery.com/">jQuery</a> here, a dash of CSS there and you’re good to go.</p><p>This doesn&#39;t mean you’re going to have a <em>good </em>website, but at least you have some web presence, and for some that’s all they want to achieve.</p><p>I’m a web developer, and have been for a little over a year now so I’m still quite new to everything. I studied some aspects of it in college, mostly server-side programming, but it did little to prepare me for the experience of trying to work on an ever-changing landscape. My previous process was really straightforward: Develop locally with <a href="http://www.wampserver.com/">WAMP</a>/<a href="http://www.mamp.info/en/index.html">MAMP</a>, open up <a href="https://filezilla-project.org/">FileZilla </a>and drag and drop replacing the previous files. Simples!</p><p>Or tedious, rather. Especially when I started minifying and compressing code. For JavaScript I’d visit <a href="http://marijnhaverbeke.nl/uglifyjs">Uglify </a>and throw everything in there and paste the results into a new all.min.js file, and the same for CSS with something like <a href="http://cssminifier.com/">CSSMinifier</a>. I did this for <em>ages. </em>I was just stuck in a rut of the same old grind. That’s just how it was.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JE63XF-uQa0v9PzG.png" /></figure><p>Then one day I used <a href="http://sass-lang.com/">Sass</a> and I said to myself:</p><blockquote>I&#39;ve been a fucking idiot.</blockquote><p>I wasn&#39;t enjoying my work as I once did because I was slugging through the same old process of managing every aspect of the website when I really didn&#39;t have to, and this was every time an update was needed as well. So I escaped to the mountains and after several arduous months I returned as a new, heavily bearded man.</p><p>The use of <a href="http://gruntjs.com/">Grunt</a>, <a href="http://git-scm.com/">Git </a>and <a href="https://github.com/git-ftp">git-ftp</a> has made life worth living again. I just run something like <strong>grunt watch:scripts </strong>and now it automatically concatenates and minifies all my JavaScript files whenever something changes while Sass takes care of my CSS. Just gonna push this to the server now with <strong>git ftp push</strong>…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*NTO8PWCbdcKY0_Z-.png" /><figcaption>Look at how piss-easy this is!</figcaption></figure><p>All this saves time and effort, and lets me focus on the actual development of the website.</p><p>I’m sure I’m light-years behind most others on this, but for me this was a turning moment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a169f879d056" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>