<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Kenton Glass</title>
	
	<link>http://kenton.me</link>
	<description />
	<lastBuildDate>Wed, 14 Nov 2012 19:11:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/hellokenton" /><feedburner:info uri="hellokenton" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Emma</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/3MrihqwJC3k/</link>
		<comments>http://kenton.me/2012/11/emma/#comments</comments>
		<pubDate>Sat, 10 Nov 2012 00:20:12 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://kenton.me/?p=145</guid>
		<description><![CDATA[Today I made a decision to pivot my life in a new direction. I&#8217;m moving to Nashville, Tennessee and joining the Emma family as a Front End Developer. I couldn&#8217;t be more excited. Two years ago, I had the privilege of having my print portfolio reviewed by some designers at Emma as well as getting [...]]]></description>
			<content:encoded><![CDATA[<p>Today I made a decision to pivot my life in a new direction. I&#8217;m moving to Nashville, Tennessee and joining the <a href="http://myemma.com">Emma</a> family as a Front End Developer. I couldn&#8217;t be more excited.</p>
<p>Two years ago, I had the privilege of having my print portfolio reviewed by some designers at Emma as well as getting a tour of their awesome office space (which by the way, <a href="https://maps.google.com/maps?q=9+Lea+Avenue,+Nashville,+TN&#038;hl=en&#038;hnear=9+Lea+Ave,+Nashville,+Tennessee+37210&#038;gl=us&#038;t=h&#038;z=16">they&#8217;ve moved</a> and their new space is tops). I left that night with the thought of how fun and interesting it would be to work there. I would have never thought that in Fall 2012, I&#8217;d find myself joining the crew with much excitement and eagerness to push the company even further.</p>
<p>I can&#8217;t wait to get down to Nashville and get to work.</p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/3MrihqwJC3k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2012/11/emma/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2012/11/emma/</feedburner:origLink></item>
		<item>
		<title>Tools of the Trade</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/9CLQa1Rg4UY/</link>
		<comments>http://kenton.me/2012/10/tools/#comments</comments>
		<pubDate>Wed, 24 Oct 2012 14:41:57 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://kenton.me/?p=128</guid>
		<description><![CDATA[I&#8217;ve recently reevaluated the tools and services I use to accomplish the different tasks I&#8217;m faced with on a daily basis. I thought it might be helpful to some if I listed everything I use, in both apps, configurations and web services. Let&#8217;s get started. AppsAs part of my reevaluation, a few of my daily [...]]]></description>
			<content:encoded><![CDATA[<p>I&rsquo;ve recently reevaluated the tools and services I use to accomplish the different tasks I&rsquo;m faced with on a daily basis. I thought it might be helpful to some if I listed everything I use, in both apps, configurations and web services. Let&rsquo;s get started.</p>
<p><strong>Apps</strong><br />As part of my reevaluation, a few of my daily apps have changed or become more heavily used:</p>
<ul>
	<li><a href="http://sublimetext.com/2">Sublime Text 2</a> &#8211; The newest addition, I am amazed as the configuration and add-ons available. It took me a while to get on board with the initial setup, but I&rsquo;m loving this app and it really is speeding up my work rate. <em>$59</em> | <a href="#st-config">Configuration</a></li>
	<li><a href="http://en.wikipedia.org/wiki/Terminal_(OS_X)">Terminal</a> &#8211; I&rsquo;m spending more and more of my time in the command line because it&rsquo;s simply faster moving around my files and folders and actively versioning my assets. <em>Free</em> | <a href="#t-config">Configuration</a></li>
	<li><a href="http://www.adobe.com/products/photoshop.html">Photoshop CS6</a> &#8211; Who doesn&rsquo;t, right? <em>$699</em></li>
	<li><a href="http://google.com/chrome">Google Chrome</a> &#8211; The Web Inspector is constantly improving and in my opinion is <a href="http://www.youtube.com/watch?v=rf1GSjo4zSY">streets ahead</a> of Safari or Firefox. <em>Free</em></li>
	<li><a href="http://panic.com/transmit">Transmit</a> &#8211; When I need to access a server via FTP, this is my choice. Always been the best. <em>$34</em></li>
	<li><a href="http://incident57.com/codekit">CodeKit</a> &#8211; A nice app that does all sorts of things: compiling, image optimizing and browser reloads to name a few. <em>$25</em></li>
	<li><strong>Cost:</strong> $817 (though CS6 cost me less since I work in higher education)</li>
</ul>
<p><strong>Configurations</strong><br />As I&rsquo;m sure everyone does, I&rsquo;m very particular on how my apps are setup, not only for better work production, but a more enjoyable experience while working.</p>
<p id="st-config"><em>Sublime Text 2</em></p>
<ul>
	<li><a href="http://wbond.net/sublime_packages/package_control">Package Control</a></li>
	<li><a href="https://github.com/buymeasoda/soda-theme">Soda Theme</a> &#8211; Dark</li>
	<li><a href="https://github.com/chriskempson/tomorrow-theme">Tomorrow Color Scheme</a> &#8211; Eighties</li>
	<li><a href="https://github.com/SublimeText/Tag">Tag</a></li>
	<li><a href="https://github.com/dmatarazzo/Sublime-Text-2-Icon">A New Icon</a></li>
	<li><a href="http://wbond.net/sublime_packages/terminal">Terminal</a></li>
	<li>My Settings &#8211; Admittely I haven&rsquo;t customized it much since I&rsquo;m still exploring all of the features:</li>
</ul>
<pre class="prettyprint linenums">
{
	"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Eighties.tmTheme",
	"theme": "Soda Dark.sublime-theme",
	"draw_indent_guides": false,
	"open_files_in_new_window": false
}
</pre>
<p id="t-config"><em>Terminal</em></p>
<ul>
		<li><a href="https://github.com/robbyrussell/oh-my-zsh">Oh My Zsh</a></li>
		<li><a href="https://github.com/chriskempson/tomorrow-theme">Tomorrow Theme</a></li>
		<li><a href="http://mxcl.github.com/homebrew/">Homebrew</a></li>
		<li><a href="http://git-scm.com/">Git</a></li>
		<li><a href="https://rvm.io/">RVM</a></li>
		<li>My Zsh Theme:</li>
</ul>
<pre class="prettyprint linenums">
function git_prompt_info() {
  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
}

PROMPT='$fg[magenta]⌘ $fg[blue]${PWD/#$HOME/~} $(git_prompt_info)'

ZSH_THEME_GIT_PROMPT_PREFIX="[git:"
ZSH_THEME_GIT_PROMPT_SUFFIX="] $reset_color"
ZSH_THEME_GIT_PROMPT_DIRTY="$fg[red]+"
ZSH_THEME_GIT_PROMPT_CLEAN="$fg[green]"
</pre>
<p><strong>Web Services</strong><br />I use a handful of web services in my daily workflow, some free and some paid:</p>
<ul>
	<li><a href="http://webfaction.com?affiliate=kenton">WebFaction</a> &#8211; My hosting provider of choice. My clients and my own personal projects usually don&rsquo;t garner large amounts of traffic so a shared hosting environment isn&rsquo;t a big deal. WebFaction allows you to host any type of site, platform or application under one account, which is really nice. As example, in one site you could run a Rails app, WordPress and a third Django app all under domain, with very simple configuration. <em>Starts at $9.50/m</em></li>
	<li><a href="http://typekit.com">Typekit</a> &#8211; If necessary and the desired font is available, I use Typekit to serve my fonts. This site is currently serving <a href="https://typekit.com/colophons/shr3foc">a few fonts</a>. <em>Starts free with limitations</em></li>
	<li><a href="http://db.tt/jxnyrKO">Dropbox</a> &#8211; I&rsquo;m not sure I know anyone that doesn&rsquo;t use Dropbox, but it&rsquo;s vital for my daily work with clients all over the map. <em>Starts free</em></li>
	<li><a href="http://bitbucket.org">Bitbucket</a> &#8211; Yes, I know the cool kids use GitHub, and while I&rsquo;m on there as well, Bitbucket hosts all of my private Git repos without cost and some public as well. <em>Free for 5 users</em></li>
	<li><a href="http://browserstack.com">BrowserStack</a> &#8211; Gone are the days of multiple VMs on Parallels, Sign in and test in any browser you want. <em>Starts at $19/m</em></li>
	<li><a href="http://getballparkapp.com">Ballpark</a> &#8211; I&rsquo;m not a huge fan of the business side of life, but Ballpark makes it easy to track time, invoice clients and get paid. They just relaunched a completely new version not long ago and have even integrated <a href="http://stripe.com">Stripe</a> for online payments. <em>Starts free</em></li>
	<li><strong>Cost per month:</strong> $39.16</li>
</ul>
<p>So these are the apps and services I used on a daily basis to create websites. I like to reevaulate from time to time because a tool or service is only good if it&rsquo;s making you work in a way where you produce better work. I&rsquo;m excited to dive deeper into Sublime Text 2 and really tune it to be the workhorse that I&rsquo;ve heard about.</p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/9CLQa1Rg4UY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2012/10/tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2012/10/tools/</feedburner:origLink></item>
		<item>
		<title>That Was Fun</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/qPM199V4H84/</link>
		<comments>http://kenton.me/2012/10/that-was-fun/#comments</comments>
		<pubDate>Sun, 14 Oct 2012 04:14:48 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kenton.me/?p=103</guid>
		<description><![CDATA[It&#8217;s been nearly a year since I&#8217;ve taught formally. I quickly remembered how tiring it is to project your voice over a classroom for nearly two hours. And I almost forgot how refreshing and inspiring it was to listen to and answer questions that my students had. Sure, it isn&#8217;t a for-credit class, but it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>It&rsquo;s been nearly a year since I&rsquo;ve taught formally. I quickly remembered how tiring it is to project your voice over a classroom for nearly two hours. And I almost forgot how refreshing and inspiring it was to listen to and answer questions that my students had. Sure, it isn&rsquo;t a for-credit class, but <a href="http://louisville.edu/lifelonglearning/classes/webtechnologies">it&rsquo;s a class</a> where students will immediately take what they&rsquo;ve learned home and put their new knowledge to work on their personal projects, their business ideas, or as a stepping stone to learning something even greater. And for me&hellip;well, it was a chance to try to pass on things I&rsquo;ve picked up in my short career and hopefully that knowledge transfer will impact one of my students.</p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/qPM199V4H84" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2012/10/that-was-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2012/10/that-was-fun/</feedburner:origLink></item>
		<item>
		<title>Simple</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/QdX3x1fRjBY/</link>
		<comments>http://kenton.me/2012/10/simple/#comments</comments>
		<pubDate>Mon, 08 Oct 2012 16:07:22 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://kenton.me/new/?p=3</guid>
		<description><![CDATA[The last iteration of my site last nearly two years, which I will proudly claim as a personal record. I had known for a while that I wanted to simplify it even further and of course, add support for all devices instead of my poor 1,000px viewport hack I had before. So I set out [...]]]></description>
			<content:encoded><![CDATA[<p>The last iteration of my site last nearly two years, which I will proudly claim as a personal record. I had known for a while that I wanted to simplify it even further and of course, add support for all devices instead of my poor 1,000px viewport hack I had before. So I set out this past weekend to refresh my personal site. I ended up moving from static files and Tumblr to WordPress. I&rsquo;ve been using WordPress a lot lately for clients, and now that I&rsquo;m teaching another class on the platform, I thought it made sense to build my own site on it. I also hope having these posts on my home page will force me to write more frequently. I&rsquo;m happy with how everything ended  up and it should allow me to focus on some exciting things coming down the pipe.</p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/QdX3x1fRjBY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2012/10/simple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2012/10/simple/</feedburner:origLink></item>
		<item>
		<title>Let’s Start Here</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/HN58_6pAbqA/</link>
		<comments>http://kenton.me/2012/10/lets-start-here/#comments</comments>
		<pubDate>Sun, 07 Oct 2012 00:08:12 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://kenton.me/new/?p=58</guid>
		<description><![CDATA[I&#8217;m not sure where to start so I&#8217;ll start here: a new post for a refreshed site for a renewed spirit. The last few months, I had lost the drive to create. Every night when it was time for bed, I wasn&#8217;t satisfied with anything I had done that day. I thought new relationships could [...]]]></description>
			<content:encoded><![CDATA[<p>I&rsquo;m not sure where to start so I&rsquo;ll start here: <em>a new post for a refreshed site for a renewed spirit</em>.</p>
<p>The last few months, I had lost the drive to create. Every night when it was time for bed, I wasn&rsquo;t satisfied with anything I had done that day. I thought new relationships could solve it. I thought new work projects could solve it. Hell, I thought eating a different cereal for breakfast would get me out of this rut. Nope. I longed for the feeling of creating something and being honestly giddy at the final product, and the excitement I&rsquo;ve come to known with so many great projects I&rsquo;ve been lucky enough to work on. But, with every change nothing changed.</p>
<p>The more I thought about it, the more I tried to rationalize that it was something that would pass in time. But I slowly began to realize it was something that I needed to be proactive about and continously work on. So, I&rsquo;ve decided to force myself to do a few things.</p>
<p><strong>1. Eat 3 Meals a Day</strong><br />For far too long, I&rsquo;ve made it on lunch and dinner skipping arguably the most important meal of the day. Last weekend, I picked up a compact fridge to put in my office to make eating breakfast as easy as possible.</p>
<p><strong>2. Pray and Reflect</strong><br />I need to stop praying only for the things <em>I want</em>. And while I&rsquo;m at it, I need to make time for daily reflection, not just when things are extraordinarly good or bad.</p>
<p><strong>3. Read</strong><br />My stack of books to read has been growing taller and taller (Thanks <a href="http://twitter.com/sesoeder">Scott</a>!) and I need to be reading them instead of dumbing out in front of the television.</p>
<p><strong>4. Create</strong><br />Whether it&rsquo;s a personal or client project, writing here, or taking a few hours to mess around on the banjo, I need to express myself.</p>
<p>These may seem silly and insignificant to most, but I think being proactive with a few changes can&rsquo;t hurt&hellip;maybe it&rsquo;ll put me right back on track.</p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/HN58_6pAbqA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2012/10/lets-start-here/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2012/10/lets-start-here/</feedburner:origLink></item>
		<item>
		<title>Rolling My Own Ad Platform</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/aa78Zm7ReHE/</link>
		<comments>http://kenton.me/2012/02/ad-platform/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 21:56:52 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://kenton.me/new/?p=50</guid>
		<description><![CDATA[Over the last few months, I&#8217;ve been working on a complete overhaul of our different websites in my division at UofL. Part of the design I landed on in the fall, incorporated an internal ad spot, where we could either advertise programs and offerings, or cross-sell them. I knew that I wanted to make this [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last few months, I&#8217;ve been working on a complete overhaul of our different websites in <a href="http://louisville.edu/delphi">my division</a> at <a href="http://louisville.edu/">UofL</a>. Part of the design I landed on in the fall, incorporated an internal ad spot, where we could either advertise programs and offerings, or cross-sell them. I knew that I wanted to make this platform robust, but easy to use since people managing ads aren&#8217;t web developers. I landed on a solution that uses PHP/MySQL on an different server and JavaScript to serve ad.</p>

<!-- more -->

<p>Here&#8217;s how I&#8217;ve got it setup:</p>
<p>Using jQuery, on <code>document.ready()</code>, I append my script from the remove server and pass the current URL:</p>

<pre class="prettyprint linenums">
$(&#x27;body&#x27;).append(&#x27;&lt;script type=&quot;text/javascript&quot; src=&quot;http://remoteserver.com/ad.php?js&amp;u=&#x27; + location.href + &#x27;&quot;&gt;&lt;/script&gt;&#x27;);
</pre>

<p>I could simply add this script to the <code>&lt;head&gt;</code> or just before <code>&lt;/body&gt;</code> but due to the way the university&#8217;s system is setup, this is the best way. Since I&#8217;m using PHP/MySQL to manage the indiviual ads, you&#8217;ll notice that the script is actually a PHP file. So what does this script do?</p>
<p>After reading this <a href="http://24ways.org/2011/defending-the-perimeter-against-web-widgets">article on 24 ways</a> about not hurting a page when an external script was not available, I decided to set my script up the same way. So my script gathers ad based on the URL and some other details and runs a simple function that writes out HTML:</p>

<pre class="prettyprint linenums">
...database lookup and logic...
publishAd(&#x27;&lt;div class=&quot;ad&quot;&gt;&#x27; + title + media + body + &#x27;&lt;/div&gt;&#x27;);
</pre>

<p>I know you&#8217;re asking yourself how is he running a function that doesn&#8217;t exist. Typically, this is when you see an undefined error in your console. It just so happens that I have the publishAd function defined in the same file as the append above. Here it is:</p>

<pre class="prettyprint linenums">
function publishAd(content){
	if(content.length &gt; 0){
		$(&#x27;#ad-block&#x27;).html(content).show();
		$(&#x27;#ad-block&#x27;).fitVids();
		$(&#x27;#ad-block a&#x27;).attr(&#x27;target&#x27;,&#x27;_blank&#x27;);
	}
}
</pre>

<p>A couple of things going on here: passing the HTML from above and only continuing if something exists; inserting the HTML into a predefined div on the webpage; binding the helpful <a href="http://fitvidsjs.com">fitVids</a> plugin to make videos responsive; and adding a target attribute to have all links in the ad open a new window.</p>

<p>What I won&#8217;t go into detail here is the administration side of this platform. I&#8217;ve built a simple webform for my colleagues to create text, image and video ads that they can set to start and end at specific times, only show on certain pages and other types of customization. That form saves their ad data to a database which the above ad.php reads from the print the ad.</p>

<p>This was a neat piece of our redesign that I had a lot of fun experimenting with.</p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/aa78Zm7ReHE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2012/02/ad-platform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2012/02/ad-platform/</feedburner:origLink></item>
		<item>
		<title>Updating a Menu Based on Page Location</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/exf0u6rsau8/</link>
		<comments>http://kenton.me/2011/07/updating-a-menu-based-on-page-location/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 21:54:31 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://kenton.me/new/?p=48</guid>
		<description><![CDATA[There are plenty of sites that have sectioned pages which use an anchored link menu system to jump to each section. If you look back at my smooth anchor post, you can easily adapt that to make the jump behave a little bit nicer. But how about updating the menu so the user is reminded [...]]]></description>
			<content:encoded><![CDATA[<p>There are plenty of sites that have sectioned pages which use an anchored link menu system to jump to each section. If you look back at <a href="http://kenton.me/2011/02/smooth-anchors/">my smooth anchor post</a>, you can easily adapt that to make the jump behave a little bit nicer. But how about updating the menu so the user is reminded what section they&#8217;re on as they scroll down the page? It&#8217;s just a few lines of JavaScript+jQuery and you&#8217;ll be updating your menu on-the-fly. Let&#8217;s get started.</p>
<!-- more -->
<p><a href="http://kenton.me/-/files/demos/scroll.html">Feel free to try out the demo first.</a></p>
<p><em>Note: Be sure to include a copy of jQuery or this won&#8217;t work.</em></p>
<p>First, let&#8217;s setup our menu&#8217;s HTML:</p>
<pre class="prettyprint linenums">
&lt;ul id="menu"&gt;
	&lt;li&gt;&lt;a href="#part-1" class="active"&gt;Part 1&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#part-2"&gt;Part 2&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#part-3"&gt;Part 3&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#part-4"&gt;Part 4&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="#part-5"&gt;Part 5&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>Here&#8217;s the function that checks the user&#8217;s current position from the top of the window. Then updates some classes in our menu. Based on different pixel counts, we&#8217;ll remove the .active class and add it to the appropriate list item.</p>
<pre class="prettyprint linenums">
function scroll_update(){

	// Get the current window position
	var position = $(window).scrollTop();

	// Remove the active state
	$('#menu li a.active').removeClass('active');

	// Set li to active based on position
	if(position &lt;= 500){
		$('#menu li:eq(0) a').addClass('active');
	} else if(position &lt;= 1000){
		$('#menu li:eq(1) a').addClass('active');
	} else if(position &lt;= 1500){
		$('#menu li:eq(2) a').addClass('active');
	} else if(position &lt;= 2000){
		$('#menu li:eq(3) a').addClass('active');
	} else{
		$('#menu li:eq(4) a').addClass('active');
	}
}
</pre>
<p>Now, we just need to tie this function to the window&#8217;s scroll event:</p>
<pre class="prettyprint linenums">
$(window).scroll(scroll_update);
</pre>
<p>That&#8217;s it. Now when the user scrolls, your menu will be updated to reflect the current position. We can take this a little further for the sake of preventing the browser from firing our code on every vertical pixel.</p>
<p>Using <a href="http://benalman.com/">Ben Alman&#8217;s</a> <a href="http://benalman.com/projects/jquery-throttle-debounce-plugin/">Throttle plugin</a>, we can limit the amount of times our code is fired. Since we&#8217;re only checking for change every 500 pixels, we can safely use this approach. First, include the <a href="http://benalman.com/projects/jquery-throttle-debounce-plugin/">Throttle plugin</a>, then you&#8217;ll just need to update the scroll event:</p>
<pre class="prettyprint linenums">
$(window).scroll($.throttle(500,scroll_update));
</pre>
<p>And that&#8217;s it. Now our event is only called every 500 milliseconds. This should help performance of your page, even if it may seem insignificant.</p>
<p><a href="http://kenton.me/-/files/demos/scroll.html">Feel free to try out the demo.</a></p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/exf0u6rsau8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2011/07/updating-a-menu-based-on-page-location/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2011/07/updating-a-menu-based-on-page-location/</feedburner:origLink></item>
		<item>
		<title>setVersion() – Automate Your Caching Process</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/wb9tROmt6ag/</link>
		<comments>http://kenton.me/2011/04/setversion-automate-your-caching-process/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 21:52:58 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://kenton.me/new/?p=46</guid>
		<description><![CDATA[Caching your assets is a great and easy way to speed up your site&#8217;s load times. However, it can be time consuming to rename files and messy to keep several versions of files on your server. A lot of sites have used query strings, styles.css?v=1, to accomplish this cache. I believe it&#8217;s better to use [...]]]></description>
			<content:encoded><![CDATA[<p>Caching your assets is a great and easy way to speed up your site&rsquo;s load times. However, it can be time consuming to rename files and messy to keep several versions of files on your server. A lot of sites have used query strings, <code class="inline">styles.css?v=1</code>, to accomplish this cache. I believe it&rsquo;s better to use a full, versioned filename like <code class="inline">styles.1.css</code>, so that the user&rsquo;s browsers pulls a distinct file. It&rsquo;s a fairly simple process and I&rsquo;ll show you how to automate the numbering.</p>
<p>First we need to turn on expiration for the files you want to have a long-lasting cache. This goes in your <code class="inline">.htaccess</code> file:</p>
<pre class="prettyprint linenums">
<;FilesMatch "\.(css|js|jpg|gif|png)$">;
	ExpiresActive On
	ExpiresDefault "access plus 10 years"
<;/FilesMatch>;
</pre>
<p>In the above snippet, we are searching for stylesheets, scripts and images and setting their expiration date to 10 years from now.</p>
<p>Now, we need to setup a <code class="inline">RewriteRule</code> to handle the new file names. This also goes in the <code class="inline">.htaccess</code> file:</p>
<pre class="prettyprint linenums">
RewriteEngine On
RewriteRule ^(.*)\.[0-9]+\.(css|js|jpg|gif|png)$ $1.$2 [L]
</pre>
<p>Please note that you must turn the <code class="inline">RewriteEngine</code> on. In this snippet, the server searches for the same asset extensions as above and applies a rule to them: read file <code class="inline">styles.12345.css</code> as <code class="inline">styles.css</code>. Using this rule, you only have to keep one version of each file on your server, <code class="inline">styles.css</code>.</p>
<p>So you could stick with what we&rsquo;ve done so far and be set. Each time you wanted to update the cache, you&rsquo;d simply change the number where you&rsquo;re linking the asset. But, if you&rsquo;re like me, that&rsquo;s going to get really old, fairly quickly. Let&rsquo;s bring in some server-side scripting to automate this process for you. Here&rsquo;s a PHP function to rename the file on the fly:</p>
<pre class="prettyprint linenums">
<;?php
	function setVersion($url){
		$path       = pathinfo($url);
		$version    = '.'.filemtime($_SERVER['DOCUMENT_ROOT'].$url).'.';
		$cache_file = str_replace('.', $version, $path['basename']);
		print $path['dirname'].'/'.$cache_file;
	}
?>;
</pre>
<p>This function is pretty straight forward. First, <code class="inline">pathinfo()</code> returns an array containing various parts of the file. Then creates a string containing the last modified time of the asset file using <code class="inline">filemtime()</code>. Next up is replacing the dot in the original file with our timestamp string. Lastly, we print out the new filename.</p>
<p>Once you include that function on your page, it&rsquo;s really simple to use. Just replace:</p>
<pre class="prettyprint linenums">
/-/css/default.css
</pre>
<p>with:</p>
<pre class="prettyprint linenums">
<;?php setVersion('/-/css/default.css'); ?>;
</pre>
<p>and you&rsquo;ll get:</p>
<pre class="prettyprint linenums">
/-/css/default.1298645866.css
</pre>
<p>Together, with your <code class="inline">.htaccess</code> rule and PHP function, you&rsquo;ve fully automated the caching process. Next time you save or upload an asset, the timestamp will be automatically updated.</p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/wb9tROmt6ag" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2011/04/setversion-automate-your-caching-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2011/04/setversion-automate-your-caching-process/</feedburner:origLink></item>
		<item>
		<title>An Archive</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/i_GZczAjafk/</link>
		<comments>http://kenton.me/2011/04/archive/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 21:47:35 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Archive]]></category>
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://kenton.me/new/?p=44</guid>
		<description><![CDATA[It&#8217;s always nice to look back. A few weeks ago, I stopped and took the time to remind myself of some old websites I&#8217;ve done that have helped me get to where I am today. Then I thought I might as well share some old things. Here&#8217;s a list of projects that didn&#8217;t make it [...]]]></description>
			<content:encoded><![CDATA[<p>It&rsquo;s always nice to look back. A few weeks ago, I stopped and took the time to remind myself of some old websites I&rsquo;ve done that have helped me get to where I am today. Then I thought I might as well share some old things. Here&rsquo;s a list of projects that didn&rsquo;t make it or sites that have been replaced, ordered by their last edit.</p>
<ul class="list">
	<li><a href="http://kenton.me/-/archive/v3">Personal Site [v3]</a></li>
	<li><a href="http://kenton.me/-/archive/v2">Personal Site [v2]</a></li>
	<li><a href="http://kenton.me/-/archive/metrosoiree">MetroSoiree</a></li>
	<li><a href="http://kenton.me/-/archive/v1">Personal Site [v1]</a></li>
</ul>
<p>For an updated list, I&rsquo;ve setup an <a href="http://kenton.me/archive">archive</a>.</p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/i_GZczAjafk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2011/04/archive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2011/04/archive/</feedburner:origLink></item>
		<item>
		<title>MyDVDShelf Gets an Update</title>
		<link>http://feedproxy.google.com/~r/hellokenton/~3/jz1CPyZl0so/</link>
		<comments>http://kenton.me/2011/04/mydvdshelf-spring-2011-update/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 21:40:45 +0000</pubDate>
		<dc:creator>Kenton</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://kenton.me/new/?p=38</guid>
		<description><![CDATA[I created MyDVDShelf.com for the sole purpose of keeping track of all of my DVDs. Three years later, I&#8217;m still spending a fair amount of time on it. Last night, I wrapped up the most substantial update since I relaunched the service nearly a year ago. I&#8217;m happy to finally finish some neat features that [...]]]></description>
			<content:encoded><![CDATA[<p>I created <a href="http://mydvdshelf.com" rel="external">MyDVDShelf.com</a> for the sole purpose of keeping track of all of my DVDs. Three years later, I&rsquo;m still spending a fair amount of time on it. Last night, I wrapped up the most substantial update since I relaunched the service nearly a year ago. I&rsquo;m happy to finally finish some neat features that were on my mind before the wild months of moving and starting a new job. Here are some insights on the update</p>
<p><strong>Tags</strong><br />Probably the number one requested feature was a way to categorize your DVDs. Specifically, users wanted the ability to separate their Blu-Rays from regular DVDs. This feature had been on my todo list for well over a year and I&rsquo;m glad to finally push it out for everyone to use. When approaching the problem, I first thought it would be easy to let users check whether it was a Blu-Ray or a DVD and that would be it. However, as development went on and I kept thinking back to the experience of cataloging DVDs, I knew it wasn&rsquo;t that simple. I decided to roll out a tagging system similar to those found in blogging platforms. With a generic tagging system in place, a user can define any tag they want to categorize their DVDs. If they want to only use Blu-Ray and DVD, that&rsquo;s fine. But for the hardcore organizers like myself, we can tag our DVDs by genre, director, anything. I&rsquo;m very happy with the way it turned out and I believe users are as well. There were over 400 tagged DVDs shortly after the update.</p>
<p><strong>Loan Reminders</strong><br />It&rsquo;s so easy to forget who has borrowed a DVD. With MyDVDShelf, it&rsquo;s always been easy to keep track of those loaned DVDs. But, there seemed to be something missing. A way to be automatically reminded that, &ldquo;Hey, Devin borrowed <em>Primer</em> 3 months ago!&rdquo; With the latest update, that reminder is now available. Users can subscribe to weekly reminder emails in their account settings and once a week, they&rsquo;ll receive an email that contains all of their current loans.</p>
<p><strong>iPad</strong><br />I love my iPad. So does everyone I know that owns one. I know I would love to access MyDVDShelf in a native way on it. However, I do not have the time nor the knowledge to develop such an app. But, I have spent some time developing an optimized web app that can be placed on the home screen. Currently, it&rsquo;s not feature complete, but it&rsquo;s definitely usable and a new, unique way to browse your DVD collection. <a href="http://ipad.mydvdshelf.com">Head on over</a> to play around with it.</p>
<p>And yes, an iPhone version is on the way.</p>
<p><strong>Process</strong><br />The biggest complaint I received was how inconvenient it was to add a series of DVDs, think multiple TV seasons. Say, for example, you own every season of <em>LOST</em> and want to put them on your shelf. In the past, you would search for <em>LOST</em>, then click Add next to the season you wanted to put on your shelf. You would then be directed to the page for that DVD. Now, for most movies that process is perfectly acceptable, and it would be fine if you only owned one season of <em>The Office</em>, but you don&rsquo;t. Most people that own DVDs of TV seasons own multiple seasons. With that complaint in mind, I rewrote the entire process so that now a user can use every available DVD feature without leaving or refreshing the page. Technically, someone can wish for a DVD, add it, tag it, loan it to a friend, return it, and finally remove it without every reloading the page. It makes for a vast speed improvement when adding DVDs, especially if you&rsquo;re just getting started.</p>
<p>These are the major points of the update, but there are many, many smaller pieces that have greatly improved the service. With each new idea, several others spawn and there are many new things coming down the pipe. Stay tuned&hellip;</p>
<p>Don&rsquo;t have a shelf yet? <a href="http://mydvdshelf.com" rel="external">Get started now!</a></p><img src="http://feeds.feedburner.com/~r/hellokenton/~4/jz1CPyZl0so" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kenton.me/2011/04/mydvdshelf-spring-2011-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kenton.me/2011/04/mydvdshelf-spring-2011-update/</feedburner:origLink></item>
	</channel>
</rss>
