<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Mike Ball</title>
	<atom:link href="http://www.mikeball.us/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mikeball.us</link>
	<description>Graphic Design &#38; Web Development</description>
	<lastBuildDate>Fri, 09 Sep 2011 17:52:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>TEDxPhilly</title>
		<link>http://www.mikeball.us/work/tedxphilly</link>
		<comments>http://www.mikeball.us/work/tedxphilly#comments</comments>
		<pubDate>Fri, 09 Sep 2011 17:50:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[illustration]]></category>
		<category><![CDATA[tedxphilly]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=479</guid>
		<description><![CDATA[A seem-less, infinitely tiling illustration for TEDxPhilly.]]></description>
			<content:encoded><![CDATA[<p>The organizers of <a href="http://tedxphilly.com/">TEDxPhilly</a> contacted me to create a seem-less, infinitely tiling illustration to be used as a background image throughout the conference&#8217;s web collateral. The illustration is type-based and inspired by &#8220;the city,&#8221; the 2011 conference theme.</p>
<p><a href="http://dump.mikeball.us/tedx/">View a demo page &raquo;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/work/tedxphilly/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic Command Line Tools</title>
		<link>http://www.mikeball.us/blog/basic-command-line-tools</link>
		<comments>http://www.mikeball.us/blog/basic-command-line-tools#comments</comments>
		<pubDate>Tue, 30 Aug 2011 14:57:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=462</guid>
		<description><![CDATA[A collection of basic command line tools and operations. Curated for a curious co-worker.]]></description>
			<content:encoded><![CDATA[<p>A co-worker expressed interest in learning more Unix command line operations. This collection seeks to supplement his basic knowledge with some additional tips and tools.</p>
<h4>Searching Source Code</h4>
<ul>
<li><a href="http://betterthangrep.com">ack</a> can be downloaded at <a href="http://betterthangrep.com">betterthangrep.com</a> and is a great, free tool for searching a project&#8217;s source code. Usage: <code>ack string</code> will return the relative paths to all the files containing the matched string, the line on which the string is found with the match highlighted, and the line number on which the match lives, all while ignoring those files contained within <code>.git</code> or <code>.svn</code> directories.</li>
<li><code>ack --js searchtext</code> will perform a search on all <code>*.js</code> files.</li>
<li>If you still prefer <code>grep</code>, the following would return the relative paths to all the files in which the text &#8220;string&#8221; is found: <code>grep -rl string . | grep -v \.svn</code>, excluding files in <code>.svn</code> directories.</li>
</ul>
<h4>Diffing</h4>
<ul>
<li><code>diff -rq some_directory some_other_directory</code> will recursively diff all files in <code>some_directory</code> and <code>some_other_directory</code>, printing the files containing any descrepencies to the terminal.</li>
<li><code>diff file_one file_two</code> will output to the terminal all instances of descrepencies between file_one and file_two, as well as outputing the line/column number in which the differences exist.</li>
<li>Alternatively, <a href="http://colordiff.darwinports.com/">colordiff</a> is a tool which provides colorized ouput to diff. If you&#8217;re using <a href="">homebrew</a>, colordiff can be installed with <code>brew install colordiff</code>. See <code>colordiff man</code> for usage.</li>
</ul>
<h4>Miscellaneous Operations on Files</h4>
<ul>
<li><code>cat filename</code> will output the contents of <code>filename</code> to the terminal.</li>
<li><code>less filename</code> provides a much better way to inspect large files from the command line. It outputs only a full screen view of a file&#8217;s contents. Use <code>j</code> and <code>k</code> to scroll up and down. <code>b</code> and <code>f</code> navigate a full screen up and down. Use <code>/pattern</code> to search for the text <code>pattern</code>.</li>
<li><code>cat file1 &gt;&gt; file2</code> will write the contents of <code>file1</code> to <code>file2</code>.</li>
<li><code>touch filename</code> will create a file named <code>filname</code> within the current directory.</li>
<li>Once installed, <code>tree</code> produces a depth-indented listing of files.</li>
<li><code>chmod 760 filename</code> changes the permissions on <code>filename</code> to 760.</li>
</ul>
<h4>Maintainenance, Monitoring, and Debugging</h4>
<ul>
<li><code>ps xa</code> lists all the running processes on your machine.</li>
<li><code>ps xa | grep java</code> will will check if a process named <code>java</code> is running. <code>kill -9 xxxx</code>, where xxxxx is the process id, will kill the java process. This is useful if something has frozen.</li>
<li><code>top</code> is a system monitor tool that produces a frequently-updated list of processes. By default, the processes are ordered by percentage of CPU usage.</li>
<li><code>tail -f log_file_name</code> outputs the log file&#8217;s content to the terminal, which is helpful when troubleshooting code such as PHP or Apache.</li>
<li><a href="http://cheat.errtheblog.com/">Cheat</a> is a <a href="http://rubygems.org/">RubyGem</a> that provides command-line access to simple cheat sheets, not unlike a simplified, user-edited <code>man</code> page. An out-of-the-box Cheat installation provides a few basic starter cheat sheets which can be edited and extended easily. It&#8217;s also relatively easy to add your own additional cheat sheets. Example Usage: <code>cheat html</code>.</li>
<li>Most commands have a <code>-help</code> option which will list a command&#8217;s arguments and options. Example: <code>cd -help</code>.</li>
<li>Similarly, <code>man</code> provides more detailed documentation. Example: <code>man mysqldump</code>.</li>
</ul>
<h4>Working With a Server</h4>
<ul>
<li><code>ssh username@hostname.com</code> provides <code>ssh</code> acess.</li>
<li>Similarly, <code>ftp username@hostname.com</code> and <code>sftp username@hostname.com</code> provide <code>ftp</code> and <code>sftp</code> access.</li>
<li><code>scp /path/to/local/file username@hostname:path/to/copy/to</code> can be used to copy files to a server over <code>ssh</code>.</li>
<li>Similarly, <code>scp username@hostname:/path/to/remote/file /local/path/to/copy/to/</code> copies a file from a server to your local machine.</li>
<li><code>wget</code> can be used to retrieve content from a web server. Example: <code>wget http://hostname.com/somefile.zip</code> will download <code>somefile.zip</code> from <code>http://hostname.com</code>.</li>
<li>Similarly, <code>curl -O http://hostname.com/download.tar.gz</code> will download <code>download.tar.gz</code></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/basic-command-line-tools/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3: An All-CSS, Image-less Play Button</title>
		<link>http://www.mikeball.us/blog/css3-an-all-css-image-less-play-button</link>
		<comments>http://www.mikeball.us/blog/css3-an-all-css-image-less-play-button#comments</comments>
		<pubDate>Sat, 16 Jul 2011 16:45:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[play button]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=450</guid>
		<description><![CDATA[How to make an all-CSS play button without the use of images or sprites. ]]></description>
			<content:encoded><![CDATA[<h4>Example</h4>
<p><img src="/wp-content/uploads/2011/07/play-button-content.jpg" alt="Example play button"/></p>
<h4>The HTML</h4>
<pre><code>&lt;a class="thumb" href="/some-url"&gt;
    &lt;img src="some-image.jpg" alt="Image" /&gt;
    &lt;b class="play"&gt;
        &lt;i class="wave"&gt;&lt;/i>
        &lt;i class="arrow"&gt;Play now&lt;/i&gt;
    &lt;/b&gt;
&lt;/a&gt;
</code></pre>
<h4>The CSS</h4>
<pre><code>/* the anchor tag containing everything */
a.thumb {
    position:relative;
    width:300px;
    height:225px;
    display:block;
}

/* the black box */
b.play {
    display:block;
    position:absolute;
    width:80px;
    height:75px;
    bottom:0;
    right:0;
    background:#1a1a1a;
    text-indent:-5000px;
    overflow:hidden;
}

/* the arrow's container */
i.arrow {
    display: block;
    width: 40px;
    height: 45px;
    overflow:hidden;
    position:relative;
    margin:-30px 0 0 25px;
}

/* the arrow */
i.arrow:after {
    content:'';
    display:block;
    background:#fff;
    width:60px;
    height:65px;
    -moz-transform:
        rotate(-60deg)
        skewY(30deg);
    -webkit-transform:
        rotate(-60deg)
        skewY(30deg);
    -o-transform:
        rotate(-60deg)
        skewY(30deg);
    -ms-transform:
        rotate(-60deg)
        skewY(30deg);
    transform:
        rotate(-60deg)
        skewY(30deg);
    position:absolute;
    left:-52px;
    top:-10px;
}

/* the gradiated and curved background behind the arrow */
i.wave {
    content:'';
    display:block;
    background:-moz-linear-gradient(center top, #000000, #272727 83%, #3D3D3D 100%) repeat scroll 0 0 transparent;
    background-image:-ms-linear-gradient(center top, #000000, #272727 83%, #3D3D3D 100%) repeat scroll 0 0 transparent;
    background:-webkit-gradient(linear, center top, center bottom, from(#000), color-stop(83%, #272727), color-stop(100%, #3d3d3d));
    border-radius:80px;
    display:block;
    height:160px;
    margin-left:-45px;
    margin-top:-110px;
    width:170px;
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/css3-an-all-css-image-less-play-button/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3: Using Transform to Make a Cube</title>
		<link>http://www.mikeball.us/blog/using-css3-transform-to-make-a-cube</link>
		<comments>http://www.mikeball.us/blog/using-css3-transform-to-make-a-cube#comments</comments>
		<pubDate>Fri, 15 Jul 2011 02:20:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Sketches]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[transform]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=443</guid>
		<description><![CDATA[A simple example demonstrating how to leverage CSS3 transforms to draw a cube.]]></description>
			<content:encoded><![CDATA[<p>CSS transforms! The following works in IE9 and above, as well as modern versions of Firefox, Safari, Chrome, and Opera.</p>
<h4>Example:</h4>
<p><img alt="cube example" src="http://www.mikeball.us/wp-content/uploads/2011/07/content_cube.png"/></p>
<h4>The HTML</h4>
<pre><code>&lt;div class="cube"&gt;
    &lt;div class="cube-side top"&gt;&lt;/div&gt;
    &lt;div class="cube-side left"&gt;&lt;/div&gt;
    &lt;div class="cube-side right"&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>
<h4>The CSS</h4>
<pre><code>/* a container div */
div.cube {
    position:relative;
    width:200px;
    height:220px;
}

/* styles for all the cube's sides (top, left, and right) */
div.cube-side {
    width:100px;
    height:100px;
    position:absolute;
}

/* the cube's top side */
div.top {
    left:50px;
    top:10px;
    background:#612d2d;
    -moz-transform:
        rotate(60deg)
        skew(0deg, -30deg)
        scale(1, 1.15);
    -webkit-transform:
        rotate(60deg)
        skew(0deg, -30deg)
        scale(1, 1.15);
    -o-transform:
        rotate(60deg)
        skew(0deg, -30deg)
        scale(1, 1.15);
    -ie-transform:
        rotate(60deg)
        skew(0deg, -30deg)
        scale(1, 1.15);
    transform:
        rotate(60deg)
        skew(0deg, -30deg)
        scale(1, 1.15);
}

/* the cube's left side */
div.left {
    background:#b06969;
    top:90px;
    left:0px;
    -moz-transform:skew(0deg, 30deg);
    -webkit-transform:skew(0deg, 30deg);
    -o-transform:skew(0deg, 30deg);
    -ie-transform:skew(0deg, 30deg);
    transform:skew(0deg, 30deg);
}

/* the cube's right side */
div.right {
   background:#b07c7c;
   top:90px;
   right:0;
   -moz-transform:skew(0deg, -30deg);
   -webkit-transform:skew(0deg, -30deg);
   -o-transform:skew(0deg, -30deg);
   -ie-transform:skew(0deg, -30deg);
   transform:skew(0deg, -30deg);
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/using-css3-transform-to-make-a-cube/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Contribute to a Project Hosted on GitHub</title>
		<link>http://www.mikeball.us/blog/how-to-contribute-to-a-project-hosted-on-github</link>
		<comments>http://www.mikeball.us/blog/how-to-contribute-to-a-project-hosted-on-github#comments</comments>
		<pubDate>Mon, 23 May 2011 19:24:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[notes]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=422</guid>
		<description><![CDATA[Some quick instructions on how to contribute to a project hosted on GitHub.]]></description>
			<content:encoded><![CDATA[<p>A quick overview of the steps required in contributing back to an open source project hosted on GitHub. Note that these instructions assume you&#8217;ve already created a <a href="https://github.com/plans">GitHub account</a> and properly <a href="http://help.github.com/mac-set-up-git/">set up your machine</a>. For more details, GitHub also publishes <a href="http://help.github.com/fork-a-repo/">similar instructions</a>.</p>
<h4>Set Up Your Repository</h4>
<ol>
<li>Fork a project by visiting its URL on GitHub and clicking the &#8220;Fork&#8221; button</li>
<li>Clone your fork to your local machine:
<pre><code>git clone git@github.com:yourUsername/projectName.git</code></pre>
</li>
<li>Assign the original repository to a remote called &#8220;upstream&#8221; to retrieve updates from the original repository you forked:
<pre><code>cd projectName
git remote add upstream git://github.com/originalUsername/projectName.git</code></pre>
</li>
<li>Routinely pull all the &#8220;upstream&#8221; updates to your local repository:
<pre><code>git fetch upstream</code></pre>
<p>And merge them to your forked master:</p>
<pre><code>git merge upstream/master</code></pre>
</li>
</ol>
<h4>Develop Features</h4>
<ol>
<li>Create and check out a feature branch to house your edits:
<pre><code>git branch branchName
git checkout branchName</code></pre>
<p>This can be shortened to:</p>
<pre><code>git checkout -b branchName</code></pre>
</li>
<li>Make edits and commit them:
<pre><code>git add someFile.js
git commit -m "Your commit message."</code></pre>
</li>
<li>Push your branch to GitHub:
<pre><code>git push origin branchName</code></pre>
</li>
<li>Visit your forked project on GitHub and switch to your <code>branchName</code> branch.</li>
<li>Click &#8220;Pull Request&#8221; to request that your features be merged to the &#8220;upstream&#8221; master.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/how-to-contribute-to-a-project-hosted-on-github/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Make Testable Private Functions in JavaScript</title>
		<link>http://www.mikeball.us/blog/how-to-make-testable-private-functions-in-javascript</link>
		<comments>http://www.mikeball.us/blog/how-to-make-testable-private-functions-in-javascript#comments</comments>
		<pubDate>Wed, 11 May 2011 13:41:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tdd]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=415</guid>
		<description><![CDATA[A controversial trick to publicly expose private functions to unit tests.]]></description>
			<content:encoded><![CDATA[<p>The problem: how to write <a href="https://github.com/trevmex/EnvJasmine">EnvJasmine</a> unit tests for private functions?</p>
<p>As my co-worker Trevor <a href="http://trevmex.com/post/5365259743/a-javascript-template-for-making-testable-private">suggests in more detail</a>, one solution is to create a class with 3 internal objects:</p>
<dl>
<dt>settings:</dt>
<dd>this object houses configuration options, such as a <code>debug</code> option</dd>
<dt>private:</dt>
<dd>this object houses private functions</dd>
<dt>public:</dt>
<dd>this object houses all public functions</dd>
</dl>
<p>Then, in writing unit tests, a developer can instantiate the class by passing <code>{debug: true}</code> to adjust the class&#8217;s settings such that the private and public objects are merged, in effect exposing the previously private functions housed in the <code>private</code> object.</p>
<p>Note that this technique is a bit controversial amongst those who argue that the need to test private functions hints at larger code problems, specifically that the private functions are too complex. Also note that it requires jQuery.</p>
<h4>Example Code</h4>
<pre><code>
    if (typeof NS === 'undefined' || !NS) {
        var NS = {};
    }
    (function ($) {
        NS.Klass = function(options) {
            var settings = {
                    debug: false
                },
                private = {
                    // Private Functions
                },
                public = {
                    // Public Functions
                };
            if (options) {
                $.extend(settings, options);
            }
            if (settings.debug) {
                return $.extend({}, private, public);
            } else {
                return public;
            }
        };
    }(jQuery));
    var myClass = new NS.Klass(); // Regular usage
    var myDebugClass = new NS.Klass({debug: true}); // Debug usage
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/how-to-make-testable-private-functions-in-javascript/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Challenges and Innovations in Nonprofit Web Design</title>
		<link>http://www.mikeball.us/blog/challenges-and-innovations-in-nonprofit-web-design</link>
		<comments>http://www.mikeball.us/blog/challenges-and-innovations-in-nonprofit-web-design#comments</comments>
		<pubDate>Wed, 04 May 2011 00:55:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[nonprofits]]></category>
		<category><![CDATA[strategy]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=404</guid>
		<description><![CDATA[A quick overview of the Philly Tech Week panel regarding nonprofits' unique online needs and the challenges.]]></description>
			<content:encoded><![CDATA[<p>While the demands of work kept me a way from most Philly Tech Week events, I did catch <em>Challenges and Innovations in Nonprofit Web Design</em>, a quick lunchtime panel hosted at <a href="http://www.whyy.org">WHYY&#8217;s studios</a>. Greg Hoy, President of <a href="http://www.happycog.com">Happy Cog</a>, moderated the discussion, which featured panelists representing technology leadership within The National Constitution Center, Teach for America, and Philly&#8217;s GPTMC, each of whom fielded questions and relayed anecodotes regarding his or her own organization&#8217;s struggles and triumphs in online media. Much of the discussion addressed issues I try and emphasize to my own nonprofit clients.</p>
<h4>A Few Salient Takeaways</h4>
<ul>
<li>A well-developed content strategy designed to serve clearly-defined organizational goals is essential to online success. An organization&#8217;s web presence is only as strong as the value of its content, and content development requires consistent and on-going effort.</li>
<li>Tools like <a href="http://www.google.com/analytics/">Google Analytics</a> and techniques such as <a href="http://en.wikipedia.org/wiki/A/B_testing">A/B Testing</a> can help measure success, as well as inform strategy and design. Again, always bear in mind your organization&#8217;s goals, how your web presence can serve such goals, and how success can be measured via <a href="http://www.google.com/support/analytics/bin/answer.py?answer=55515">conversions</a>.</li>
<li>If leveraged thoughtfully, platforms such as Facebook and Twitter provide free and simple means through which an organization can engage the public in meaningful messaging, build community, or even poll its markets or constituency. If executed poorly, such social media can irritate people and damage an organization&#8217;s brand stature. Again, good content strategy is key.</li>
<li>Often, an existing platform &mdash; something like the <a href="https://docs.google.com/">Google Docs</a> suite, <a href="http://www.flickr.com">Flickr</a>, or <a href="https://foursquare.com/">FourSquare</a> &mdash; can better serve an organization&#8217;s needs than could a custom solution.</li>
<li>Healthy open source technology &mdash; projects like <a href="http://wordpress.org/">WordPress</a>, <a href="http://drupal.org/">Drupal</a>, <a href="http://www.djangoproject.com/">Django</a>, and <a href="http://rubyonrails.org/">Rails</a> &mdash; are extremely affordable, surrounded by active development and user communities, robust documentation and resources, and large support networks. Such factors may justify the abandonment of legacy technologies within an organization in favor of open source solutions. Mindfully assess the pros and cons of such a technology decision, but don&#8217;t throw good money after bad.</li>
<li>Good <a href="http://en.wikipedia.org/wiki/Search_engine_optimization">SEO</a>, or Search Engine Optimization, is largely the product of thoughtful content, an active online presence, and <a href="http://www.webstandards.org/">Web Standards</a> such as semantic and accessible HTML.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/challenges-and-innovations-in-nonprofit-web-design/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Design Patterns</title>
		<link>http://www.mikeball.us/blog/javascript-design-patterns</link>
		<comments>http://www.mikeball.us/blog/javascript-design-patterns#comments</comments>
		<pubDate>Sat, 19 Mar 2011 18:21:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=318</guid>
		<description><![CDATA[My notes on Addy Osmani's <em>Essential JavaScript &#38; jQuery Design Patterns</em>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://addyosmani.com/blog/">Addy Osmani</a> offers <em><a href="http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/">Essential JavaScript &amp; jQuery Design Patterns For Beginners</a></em> as a free guide to some solutions &#8220;that can be applied to commonly occurring problems&#8221; throughout JavaScript. Here are a few of my notes on Osmani&#8217;s book, mostly for my own reference:</p>
<h4>The Creational Pattern</h4>
<ul>
<li>used in creating objects within in application</li>
<li>define a class and instantiate it later when you need it</li>
</ul>
<pre>
  <code>var newObject = new MyClass();</code>
</pre>
<h4>The Constructor Function</h4>
<ul>
<li>used to create specific types of objects</li>
<li>native constructors in JavaScript include Array and Object</li>
<li>constructor functions often capitalized to distinguish them from normal functions</li>
</ul>
<pre>
  <code>
  function Car(model, year, miles){
    this.model = model;
    this.year = year;
    this.miles = miles;
    this.whatCar = function(){
      console.log(this.model);
    };
  }
  </code>
</pre>
<pre>
  <code>
  var civic = new Car("Honda Civic", 2009, 20000);
  var mondeo = new Car("Ford Mondeo", 2010, 5000);
  </code>
</pre>
<h4>The Singleton Pattern</h4>
<ul>
<li>can be implemented by creating a class with a method that creates a new instance of the class if one doesn&#8217;t exist</li>
<li>if an instance exists, it returns a reference to that object</li>
<li>traditionally, restricts instantiation of a class to a single object</li>
<li>doesn&#8217;t provide a way for code that doesn&#8217;t know about a previous reference to the singleton to easily retrieve it</li>
<li>it is not the object or class that&#8217;s returned by a singleton, it&#8217;s a structure</li>
<li>useful when exactly one object is needed to coordinate patterns across the system</li>
</ul>
<pre>
  <code>
  var SingletonTester = (function(){

    //args: an object containing arguments for the singleton
    function Singleton(args) {

     //set args variable to args passed or empty object if none provided.
      var args = args || {};
      //set the name parameter
      this.name = 'SingletonTester';
      //set the value of pointX
      this.pointX = args.pointX || 6; //get parameter from arguments or set default
      //set the value of pointY
      this.pointY = args.pointY || 10;  

    }

   //this is our instance holder
    var instance;

   //this is an emulation of static variables and methods
    var _static = {
      name: 'SingletonTester',
     //This is a method for getting an instance

     //It returns a singleton instance of a singleton object
      getInstance: function (args){
        if (instance === undefined) {
          instance = new Singleton(args);
        }
        return instance;
      }
    };
    return _static;
  })();

  var singletonTest = SingletonTester.getInstance({pointX: 5});
  console.log(singletonTest.pointX); // outputs 5
  </code>
</pre>
<h4>The Module Pattern</h4>
<ul>
<li>way to provide both private and public encapsulation for the idea of JavaScript &#8216;classes&#8217;</li>
<li>work under the premise of a &#8216;class&#8217; actually being defined as a function</li>
<li>parameters that you decide to use for this class are actually the parameters for the constructor</li>
<li>local variables and functions defined inside your class become private members</li>
<li>return method for your class (ie. still a function) returns an object that contains your public methods and variables</li>
</ul>
<h4>Advantages</h4>
<ul>
<li>cleaner than true encapsulation for developers coming from an object-oriented background</li>
<li>public parts of your code are able to touch the private parts</li>
<li>outside world is unable to touch the class&#8217;s private parts </li>
</ul>
<h4>Disadvantages</h4>
<ul>
<li>as you access both public and private members differently, when you wish to change visibility, you actually have to make changes to each place the member was used</li>
<li>You also can&#8217;t access private members in methods that are added to the object at a later point.</li>
</ul>
<pre>
  <code>
  var someModule = (function() {

    //private attributes
    var privateVar = 5;

    //private methods
    var privateMethod = function() {
      return 'Private Test';
    };

    return {
      //public attributes
      publicVar : 10,
      //public methods
      publicMethod : function() {
        return ' Followed By Public Test ';
    }, 

    //let's access the private members
    getData : function() {
      return privateMethod() + this.publicMethod() + privateVar;
     }
   }
  })(); //the parens here cause the anonymous function to execute and return

  someModule.getData();
  </code>
</pre>
<h4>The Revealing Module Pattern</h4>
<ul>
<li>improvement to Module pattern by Christian Heilmann</li>
<li>define all of your functions and variables in the private scope and return an anonymous object at the end of the module along with pointers to both the private variables and functions you wish to reveal as public</li>
<li>allows the syntax of your script to be fairly consistent</li>
<li>makes it very clear at the end which of your functions and variables may be accessed publicly</li>
<li>provides ability to reveal private functions with more specific names if you wish</li>
</ul>
<pre>
  <code>
  /*
   The idea here is that you have private methods which you want to expose as public methods.

   Below we are defining we a self-executing function and immediately returning the object.
   */
   var myRevealingModule = function() {
     var name = 'John Smith';
     var age = 40;

     function updatePerson() {
       name = 'John Smith Updated';
     }
     function setPerson () {
       name = 'John Smith Set';
     }
     function getPerson () {
       return name;
     }

     return {
       set: setPerson,
       get: getPerson
    }
  }();

  // Sample usage:
  myRevealingModule.get();
  </code>
</pre>
<h4>The Prototype Pattern</h4>
<ul>
<li>based on the concept of prototypal inheritance where we create objects which act as prototypes for other objects</li>
<li>prototype object itself is effectively used a blueprint for each object the constructor creates.</li>
<li>easy way to implement inheritance</li>
<li>performance boost</li>
</ul>
<pre>
  <code>
  // No need for capitalization as it's not a constructor
  var someCar = {
    drive: function() {};
    name: 'Mazda 3'
  };

  // Use Object.create to generate a new car
  var anotherCar = Object.create(someCar);
  anotherCar.name = 'Toyota Camry';
  </code>
</pre>
<h4>The Facade Pattern</h4>
<ul>
<li>simplifies the interface of a class and it also decouples the class from the code that utilizes it</li>
<li>provide us with an ability to indirectly interact with subsystems in a way that may be less prone to error than accessing the subsystem directly</li>
</ul>
<pre>
  <code>
  //simplifying an interface for attaching events
  var addMyEvent = function(el,ev,fn) {
    if (el.addEventListener) {
     el.addEventListener(ev,fn, false);
    } else if (el.attachEvent) {
     el.attachEvent('on'+ev, fn);
    } else {
     el['on' + ev] = fn;
    }
  };
  </code>
</pre>
<h4>The Factory Pattern</h4>
<ul>
<li>deals with the problem of creating objects without need to specify the exact class of object being created</li>
<li>suggests defining an interface for creating an object where you allow the subclasses to decide which class to instantiate</li>
<li>defines a completely separate method for the creation of objects and which sub-classes are able to override so they can specify &#8216;type&#8217; of factory product created</li>
</ul>
<pre>
  <code>
  var Car = (function() {
    var Car = function (model, year, miles){
     this.model = model;
     this.year   = year;
     this.miles = miles;
    };
    return function (model, year, miles) {
      return new Car(model, year, miles);
    }
  })();

  var civic = new Car("Honda Civic", 2009, 20000);
  var mondeo = new Car("Ford Mondeo", 2010, 5000);
  </code>
</pre>
<h4>The Decorator Pattern</h4>
<ul>
<li>alternative to creating subclasses</li>
<li>can be used to wrap objects within another object of the same interface and allows you to both add behaviour to methods and also pass the method call to the original object (ie the constructor of the decorator)</li>
<li>used when you need to keeping adding new functionality to overridden methods</li>
<li>subclassing adds behaviour that affects all the instances of the original class, whilst decorating can add new behavior for individual objects</li>
</ul>
<pre>
  <code>
  //The class we're going to decorate
  function Macbook(){
    this.cost = function() {
      return 1000;
    };
  }

  function Memory(macbook) {
    this.cost = function() {
      return macbook.cost() + 75;
    };
  }

  function BlurayDrive(macbook) {
    this.cost = function() {
      return macbook.cost() + 300;
    };
  }

  function Insurance(macbook) {
    this.cost = function(){
      return macbook.cost() + 250;
    };
  }

  // Sample usage
  var myMacbook = new Insurance(new BlurayDrive(new Memory(new Macbook())));
  console.log( myMacbook.cost() );
  </code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/javascript-design-patterns/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing phpsh on Mac OS X</title>
		<link>http://www.mikeball.us/blog/installing-phpsh-on-mac-os-x</link>
		<comments>http://www.mikeball.us/blog/installing-phpsh-on-mac-os-x#comments</comments>
		<pubDate>Mon, 14 Feb 2011 14:33:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpsh]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=379</guid>
		<description><![CDATA[My notes and instructions on installing Facebook's phpsh on Mac OS X.]]></description>
			<content:encoded><![CDATA[<p>Facebook&#8217;s <a href="http://www.phpsh.org/">phpsh</a> is an interactive shell for PHP development. Features include:</p>
<ul>
<li>full commands history</li>
<li>tab completion for functions</li>
<li>simple output highlighting</li>
<li>documentation for commands</li>
</ul>
<p>In an attempt to install the tool, I initially followed <a href="http://blog.everzet.com/post/1007878331">Konstantin Kudryashov&#8217;s instructions</a> Mac OS X installation instructions, but encountered a few problems. Most noteably, after installation, the <code>phpsh</code> command was still not recognized, resulting in <code>-bash: phpsh: command not found</code>. After digging around, I discovered that, per Konstantin Kudryashov&#8217;s step 3.6, my <code>/usr/local/bin/phpsh</code> was symlinked to a non-existent <code>phpsh</code> in <code>/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/phpsh</code>. I&#8217;m not sure how this happened, but seems most likely related to how <code>setup.py</code> installed it.</p>
<h3>Update</h3>
<p>Since posting this, I discovered Jeff Stieler&#8217;s <a href="http://vocecommunications.com/blog/2010/12/how-to-setup-an-interactive-wordpress-shell/">excellent instructions</a> on installing phpsh, including some tips for getting the tool running with WordPress Multisite. Jeff&#8217;s instructions are probably worth a try before resorting to mine.</p>
<h4>How I Got it Working</h4>
<p>Note that I&#8217;m using Mac OS X 10.6.6, and that these instructions assume you have <a href="http://git-scm.com/">git</a>, <a href="http://www.macports.org/">MacPorts</a>, and <a href="http://mxcl.github.com/homebrew/">Homebrew</a> installed.</p>
<ol>
<li>Set up Python to utilize Python 2.6 and to utilize Python&#8217;s select.poll library:
<ol>
<li>Install Python 2.6 if you haven&#8217;t already done so. To determine which version of Python you&#8217;re running, open <code>Terminal.app</code> and enter <code>python</code>. This will open the Python interactive shell and report which version of Python you&#8217;re running. The shell can be quit with <code>Ctrl + d</code>. If you&#8217;re running a Python version &lt; 2.6, quit the interactive shell and enter:
<pre>
    <code>sudo port install python26</code></pre>
</li>
<li>Install Python&#8217;s select.poll library:
<pre>
    <code>sudo port install python_select</code></pre>
</li>
</ol>
</li>
<li>Install pysqlite for autocompletion:
<ol>
<li>Install wget if you haven&#8217;t already done so:
<pre>
    <code>sudo brew install wget</code></pre>
</li>
<li>Untar the file you&#8217;ve downloaded with <code>wget</code> and <code>cd</code> into the directory:
<pre>
    <code>tar -xvf pysqlite-2.5.6.tar.gz &#038;&#038; cd pysqlite-2.5.6</code></pre>
</li>
<li>Build pysqlite:
<pre>
    <code>python setup.py build</code></pre>
</li>
<li>Install it:
<pre>
    <code>sudo python setup.py install</code></pre>
</li>
</ol>
</li>
<li>Set up phpsh on your machine:
<ol>
<li>Download the <a href="http://www.phpsh.org/">phpsh package</a> or clone the <a href="https://github.com/facebook/phpsh">phpsh git repository</a>:
<pre>
    <code>git clone git://github.com/facebook/phpsh.git</code></pre>
</li>
<li><code>cd</code> to the phpsh directory:
<pre>
    <code>cd phpsh</code></pre>
</li>
<li>Install phpsh locally:
<pre>
    <code>python setup.py install --prefix=~</code></pre>
</li>
<li>Set your <code>PYTHONPATH</code>
<pre>
    <code>export PYTHONPATH=~/lib/python2.6/site-packages</code></pre>
</li>
<li>And run phpsh from <code>Terminal.app</code>:
<pre>
    <code>~/bin/phpsh</code></pre>
</li>
</ol>
</li>
<li>Additionally, you may want to set up your machine so that you can simply enter <code>phpsh</code> to start the phpsh interactive shell, rather than having to enter <code>~/bin/phpsh</code> To do this, you&#8217;ll need to put the PYTHONPATH line in your <code>.bashrc</code> or <code>.bash_profile</code> and add ~/bin to your PATH. For example, I added the following lines to my <code>~/.bash_profile</code>:
<pre>
  <code>export PATH=~/bin::$PATH
  export PYTHONPATH=~/lib/python2.6/site-packages</code></pre>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/installing-phpsh-on-mac-os-x/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simplified Find/Replace From the Command Line</title>
		<link>http://www.mikeball.us/blog/357</link>
		<comments>http://www.mikeball.us/blog/357#comments</comments>
		<pubDate>Thu, 03 Feb 2011 21:55:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=357</guid>
		<description><![CDATA[A simple bash function to execute a find/replace on multiple files from the command line.]]></description>
			<content:encoded><![CDATA[<p>I recently needed to change all instances of the text <code>/layout/</code> to <code>/layout_xds/</code> in a large collection of css files housed throughout multiple levels of subdirectories.</p>
<p>To deal with the problem, I created a bash function to serve as a shortcut wrapping my usage of <a href="http://en.wikipedia.org/wiki/Grep">grep</a>, <a href="http://en.wikipedia.org/wiki/Sed">sed</a>, and <a href="http://en.wikipedia.org/wiki/Uniq">uniq</a>. Note that I&#8217;m using Mac OS X 10.6.6.</p>
<pre><code>
  function rep() {
    for i in `grep -R --exclude="*.svn*" "$1" * | sed s/:.*$//g | uniq`; do
      sed -i ".bak" -e "s#$1#$2#g" $i
    done
  }
</pre>
<p></code></p>
<h4>How to Use the Function</h4>
<ol>
<li>Paste the above function into your <code>~/.bash_profile</code>.</li>
<li>Open Terminal.app or, if it's already open, enter <code>source ~/.bash_profile</code> to reload your profile settings.</li>
<li><code>cd</code> to the directory where you'd like to perform the recursive find/replace.</li>
<li>Enter <code>rep textofind texttoreplace</code>. For example, to executive my above-mentioned find/replace, I entered <code>rep /layout/ /layout_xds/</code></li>
<li>Note that the function backs up the original files with a <code>*.bak</code> file extension. After verifying that the find/replace has successfully executed, delete the <code>*.bak</code> files by running <code>find . -name "*.bak" -exec rm "{}" \;</code> from the directory where the <code>rep</code> command was run.</li>
</ol>
<p>Props to <a href="http://www.twitter.com/javallone">Jeff</a> for helping me on some syntax specifics.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/357/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails: Setting Up a Dev Environment</title>
		<link>http://www.mikeball.us/blog/rails-setting-up-a-dev-environment</link>
		<comments>http://www.mikeball.us/blog/rails-setting-up-a-dev-environment#comments</comments>
		<pubDate>Tue, 18 Jan 2011 19:13:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=337</guid>
		<description><![CDATA[My notes on the first session in Trevor Lesh-Menagh's Introduction to Rails workshop series. ]]></description>
			<content:encoded><![CDATA[<p>The following notes are based on <a href="http://trevmex.com">Trevor Lesh-Menagh</a>&rsquo;s Ruby on Rails workshops. At CIM, Trevor hosts lunchtime Rails workshops each Tuesday.</p>
<p>Note that the following instructions apply to <strong>Mac OS X 10.6.5</strong>.</p>
<ol>
<li>Install <a href="http://developer.apple.com/technologies/tools/xcode.html">XCode</a></li>
<li>Install <a href="http://git-scm.com/">Git</a></li>
<li>Open Terminal.app</li>
<li>Install the latest <a href="http://rvm.beginrescueend.com">Ruby Version Manager (RVM)</a> code from the github repository by entering this command: <code>
<pre>   bash &lt; &lt;( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) </pre>
<p></code> </li>
<li>When the installation finishes, open your <code>~/.bash_profile</code> and add the following line:
<pre><code>   # This loads RVM into a shell session.
  [[ -s "$HOME/.rvm/scripts/rvm" ]] &#038;&#038; source "$HOME/.rvm/scripts/rvm" </pre>
<p></code> </li>
<li>Reload your <code>~/.bash_profile</code>:
<pre><code>   source .bash_profile </pre>
<p></code> </li>
<li>Confirm that RVM installed correctly:
<pre><code>   which rvm </pre>
<p></code> If RVM installed correctly, the above command should return something like the following:
<pre><code>   /Users/your_username/.rvm/bin/rvm </pre>
<p></code> </li>
<li>Install the proper version of Ruby. We&rsquo;ll be Ruby 1.8.7:
<pre><code>   rvm install 1.8.7 </pre>
<p></code> </li>
<li>Set Ruby 1.8.7 as your default Ruby:
<pre><code>   rvm --default 1.8.7 </pre>
<p></code> </li>
<li>Confirm that Ruby 1.8.7 installed and is set to be your default Ruby:
<pre><code>   which ruby </pre>
<p></code> If all is well, this should return something like the following:
<pre><code>   /Users/your_username/.rvm/rubies/ruby-1.8.7-p330/bin/ruby </pre>
<p></code> </li>
<li>Install Rails:
<pre><code>   gem install rails </pre>
<p></code> Note that Rails can be installed without its documentation like so:
<pre><code>   gem install rails --no-rdoc --no-ri </pre>
<p></code> </li>
<li>Confirm that Rails installed correctly and is using Ruby 1.8.7:
<pre><code>   which rails </pre>
<p></code> If all is well, this should return something like:
<pre><code>   /Users/your_username/.rvm/gems/ruby-1.8.7-p330/bin/rail </pre>
<p></code> </li>
<li><code>cd</code> to the directory of your choosing and make a new Rails app:
<pre><code>   rails new your_app_name </pre>
<p></code> </li>
<li><code>cd</code> to <code>your_app_name</code></li>
<li>Install all the dependencies specified in your Rails app&rsquo;s <code>Gemfile</code>
<pre><code>   bundle install </pre>
<p></code> </li>
<li>Run the Rails server:
<pre><code>   rails s </pre>
<p></code> </li>
<li>Visit your Rails app in your browser at <code>http://localhost:3000/</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/rails-setting-up-a-dev-environment/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Exclude Files from SVN commits</title>
		<link>http://www.mikeball.us/blog/how-exclude-files-from-svn-commits</link>
		<comments>http://www.mikeball.us/blog/how-exclude-files-from-svn-commits#comments</comments>
		<pubDate>Thu, 09 Dec 2010 18:14:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=326</guid>
		<description><![CDATA[I made a bash function that provides a quick and easy way to include/exclude files from a Subversion commit.]]></description>
			<content:encoded><![CDATA[<p>In Subversion, <code>svn commit</code> will commit all edited files to the central repository. In the event that I want to selectively commit only a few of my edited files, it&#8217;s necessary to specify the full path to each file with <code>svn commit /full/path/to/filename1 /full/path/to/filename2 /full/path/to/filename3</code>. This can be time consuming. Plus, it&#8217;s often easier to selectively <em>exclude</em> files from a given commit, but Subversion doesn&#8217;t offer this feature.</p>
<h4>The solution</h4>
<p>I made a bash function that provides a quick way to include/exclude files from an <code>svn commit</code>.</p>
<pre>
<code>
  function smartcommit() {
    svn stat > /tmp/svn_commits.tmp
    vim /tmp/svn_commits.tmp
    svn commit `cat /tmp/svn_commits.tmp | cut -d' ' -f2- | xargs`
    rm /tmp/svn_commits.tmp
  }
</code>
</pre>
<h4>How to Use It</h4>
<ol>
<li>Paste the above function into your <code>~/.bash_profile</code></li>
<li>Enter <code>smartcommit</code> at the command line from within a Subversion project&#8217;s directory.</li>
<li>The output of <code>svn stat</code> is printed to a new file called <code>svn_commits.tmp</code>.</li>
<li><code>svn_commits.tmp</code> is opened in Vim.</li>
<li>Remove any lines specifiying files you DO NOT want to commit.</li>
<li>Enter <code>:wq</code> to save and quit the temporary file.</li>
<li>Proceed with the commit as normal, noting that only those files left listed in the aforementioned <code>svn_commits.tmp</code> file will be committed.</li>
<li>The <code>svn_commits.tmp</code> file is deleted.</li>
</ol>
<p>A self-contained script can also be downloaded from <a href="https://gist.github.com/732362">GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/how-exclude-files-from-svn-commits/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Basic Overview of the Surround Plugin for Vim</title>
		<link>http://www.mikeball.us/blog/a-basic-overview-of-the-surround-plugin-for-vim</link>
		<comments>http://www.mikeball.us/blog/a-basic-overview-of-the-surround-plugin-for-vim#comments</comments>
		<pubDate>Mon, 01 Nov 2010 21:23:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=292</guid>
		<description><![CDATA[I've been using this recently at work and finding it pretty helpful when hand-editing HTML and XML.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vim.org/scripts/script.php?script_id=1697">Surround</a> is a useful Vim plugin when hand-editing HTML or XML. The plugin can be downloaded via <a href="http://github.com/tpope/vim-surround/tree/master/plugin/">Github</a> or the <a href="http://www.vim.org/scripts/script.php?script_id=1697">Vim website</a> and installed by copying the <code>/plugin/surround.vim</code> file to your <code>~/.vim/plugin/</code> directory. A few of its basic commands are as follows. Note that each command is entered from within the text to be surrounded:</p>
<h4>Adding Surroundings</h4>
<p>Generally, the <code>cs</code> or <code>ys</code> commands can be used to add surroundings.</p>
<p>Add Surrounding &lt;tag&gt; or Puncation to Word:</p>
<pre>
  <code>ysiw&lt;tag&gt;</code>
  <code>csw&lt;tag&gt;</code>
</pre>
<p>Add Surrounding to Highlighted Text From Within Visual Mode:</p>
<pre>
  <code>VS&lt;tag&gt;</code>
</pre>
<p>Add Surrounding &lt;tag&gt; or Punctuation to Line:</p>
<pre>
  <code>yss&lt;tag&gt;</code>
</pre>
<p>Add Surrounding to Line, Place it on a New Line, and Indent It:</p>
<pre>
  <code>ySs&lt;tag&gt;</code>
  <code>ySS&lt;tag&gt;</code>
</pre>
<h4>Changing Surroundings</h4>
<p>Surroundings can be changed with the <code>cs</code> command.</p>
<p>Change Surrounding &lt;tag&gt;:</p>
<pre>
  <code>cst&lt;newtag&gt;</code>
</pre>
<p>Change Surrounding Puncuation, in this Case Changing a Double Quote to a Single Quote:</p>
<pre>
  <code>cs"'</code>
</pre>
<h4>Deleting Surroundings</h4>
<p>Delete Innermost Surrounding &lt;tag&gt;:</p>
<pre>
  <code>dst</code>
</pre>
<p>Delete Surrounding Quotes (Also works with parentheses, brackets, etc.):</p>
<pre>
  <code>ds"</code>
</pre>
<h4>Delete Text Within a &lt;tag&gt;</h4>
<p>While this isn&#8217;t a function of Surround.vim, I find it somewhat relevant to the above operations. Luckily, it&#8217;s built into Vim.</p>
<pre>
  <code>dit</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/a-basic-overview-of-the-surround-plugin-for-vim/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Set Up a Git Repository on Webfaction</title>
		<link>http://www.mikeball.us/blog/how-to-set-up-a-git-repository-on-webfaction</link>
		<comments>http://www.mikeball.us/blog/how-to-set-up-a-git-repository-on-webfaction#comments</comments>
		<pubDate>Tue, 26 Oct 2010 15:53:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[notes]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=285</guid>
		<description><![CDATA[A few notes on how I install Git and set up a repository on my Webfaction account.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.github.com">GitHub</a> is great for Git-based version control of public projects, but I recently needed to set up a private Git repostiory on my <a href="http://www.webfaction.com/">Webfaction</a> account. This is simple to do, although not initially clear. Here&#8217;s a few notes on how to do it, mostly for my own reference:</p>
<h4>How to Install Git on Webfaction</h4>
<ol>
<li>Log into your Webfaction Control Panel</li>
<li>Navigate to <strong>Domains/Websites &raquo; Applications</strong></li>
<li>Click <strong>Add New</strong></li>
<li>Enter <em>git</em> as the application name in the <strong>Name</strong> field</li>
<li>Select <em>git</em> from the <strong>App category</strong> menu</li>
<li>Enter a password for the default user in the <strong>Extra Info</strong> field</li>
<li>Click the <strong>Create</strong> button</li>
</ol>
<p>Git should now be installed. The installation creates a directory at <code>~/webapps/git</code>. A directory at <code>~/webapps/git/bin</code> contains the Git executables. A directory at <code>~/webapps/git/repos</code> provides a place to store your repositories, pre-populated with <code>~/webapps/git/repos/proj.git</code> serving as an example.</p>
<h4>How to Create a new Git Repository</h4>
<ol>
<li>Open an SSH session to your webfaction account: <code>ssh username@username.webfactional.com</code></li>
<li><code>cd ~/webapps/git/</code></li>
<li>Enter <code>./bin/git init --bare ./repos/<em>reponame</em>.git</code> to create a new repository, where <em>reponame</em> is the name of yorur repository</li>
<li><code>cd repos/<em>repo</em>.git</code></li>
<li>Enable HTTP push with <code>../../bin/git config http.receivepack true</code></li>
</ol>
<h4>Connect it to Your Local Work</h4>
<ol>
<li><code>cd /path/to/your/local/repository/</code></li>
<li>Assuming it&#8217;s not already under version control, enter <code>git init</code></li>
<li><code>git add .</code></li>
<li><code>git commit -a -m 'Initial commit.'</code></li>
<li><code>git remote add origin ssh://username@username.webfactional.com/~/webapps/git/repos/reponame.git</code></li>
<li><code>git push origin master</code></li>
<li><code>git push</code></li>
</ol>
<h4>Clone Your Repository Somewhere New</h4>
<p><code>git clone username@username.webfactional.com:webapps/git/repos/reponame.git</code></p>
<h4>Based On:</h4>
<ul>
<li><a href="http://docs.webfaction.com/software/git.html">Webfaction&#8217;s Git Documentation</a></li>
<li><a href="http://munkymorgy.blogspot.com/2010/03/git-setup-on-webfaction.html">Git Setup on Webfaction</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/how-to-set-up-a-git-repository-on-webfaction/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improved Terminal Color Scheme on Snow Leopard</title>
		<link>http://www.mikeball.us/blog/improved-terminal-color-scheme-on-snow-leopard</link>
		<comments>http://www.mikeball.us/blog/improved-terminal-color-scheme-on-snow-leopard#comments</comments>
		<pubDate>Sun, 11 Jul 2010 02:10:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=272</guid>
		<description><![CDATA[How to customize Snow Leopard's Terminal to use the IR Black color scheme&#8212;something I seem to forget with each new Mac.]]></description>
			<content:encoded><![CDATA[<p>A few notes on how I customize Snow Leopard Terminal colors to use the IR Black color scheme &mdash; something I seem to forget with each new Mac setup. Most recently, I did this on Snow Leopard 10.6.4.</p>
<ul>
<li>Install <a href="http://www.culater.net/software/SIMBL/SIMBL.php">SIMBL</a></li>
<li>Download and install <a href="http://ciaranwal.sh/2007/11/01/customising-colours-in-leopard-terminal">Ciaran Walsh&#8217;s SIMBL plugin</a>.</li>
<li>In the Finder, navigate to Applications &#187; Utilities &#187; Terminal. Press <code>&#x2318;I</code> to &ldquo;Get Info.&rdquo; Tick &ldquo;Open in 32-bit mode.&rdquo;</li>
<li>Confirm that the SIMBL plugin was installed correctly by restarting Terminal and verifying that a &#8220;More&#8221; button appears in Preferences &#187; Text.</li>
<li>Download Todd Werth&#8217;s <a href="http://blog.infinitered.com/entries/show/6">IR Black</a> color scheme.</li>
<li>Install the color scheme by double clicking the <code>IR_Black.terminal</code> file.</li>
<li>Navigate to Terminal &#187; Preferences to set IR Black as your default color scheme.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/improved-terminal-color-scheme-on-snow-leopard/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quiet Logger: HTML5 WordPress Theme</title>
		<link>http://www.mikeball.us/blog/quiet-logger-html5-wordpress-theme</link>
		<comments>http://www.mikeball.us/blog/quiet-logger-html5-wordpress-theme#comments</comments>
		<pubDate>Fri, 26 Mar 2010 19:53:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=257</guid>
		<description><![CDATA[A simple HTML5 Wordpress theme typeset in Baskerville.]]></description>
			<content:encoded><![CDATA[<p>Given increasing enthusiasm for HTML5, as well as my own interest in contributing to the growing library of open source resources, I&#8217;ve released Quiet Logger, a minimal WordPress theme typeset in <a href="http://en.wikipedia.org/wiki/Baskerville">Baskerville</a> and coded with HTML5.</p>
<h4>Features</h4>
<ul>
<li>Semantically sound and valid HTML5</li>
<li>Minimal, clean, and valid CSS 2.1</li>
<li>HTML5 support to versions of Internet Explorer prior to IE 9 provided via Remy Sharp&#8217;s <a href="http://code.google.com/p/html5shiv/">HTML5 Shiv</a></li>
<li>A minimal, typographically strong design based on Baskerville</li>
<li>Free and licensed under GPL</li>
</ul>
<p>A demo can be viewed at <a href="http://quietlogger.mikeball.us">quietlogger.mikeball.us</a>. The source code can be forked on <a href="http://github.com/mdb/QuietLogger">GitHub</a>, or <a href="http://www.mikeball.us/wp-content/uploads/2010/03/quiet-logger.zip">downloaded here</a>.</p>
<p class="take-action"><a href="http://quietlogger.mikeball.us">View demo &raquo;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/quiet-logger-html5-wordpress-theme/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GPCC News</title>
		<link>http://www.mikeball.us/work/gpcc-news</link>
		<comments>http://www.mikeball.us/work/gpcc-news#comments</comments>
		<pubDate>Wed, 24 Mar 2010 20:56:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[UI design]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=243</guid>
		<description><![CDATA[In the fall of 2009, I worked to conceptualize, design, and develop a platform through which the Greater Philadelphia Chamber of Commerce could more effectively publish its online content. News.GPCC.com integrates the previously disparate and isolated elements of the GPCC&#8217;s web presence &#8212; Youtube videos, Twitter content, Flickr photos, blog posts, press releases, and HTML [...]]]></description>
			<content:encoded><![CDATA[<p>In the fall of 2009, I worked to conceptualize, design, and develop a platform through which the Greater Philadelphia Chamber of Commerce could more effectively publish its online content. <a href="http://news.gpcc.com">News.GPCC.com</a> integrates the previously disparate and isolated elements of the GPCC&#8217;s web presence &mdash; Youtube videos, Twitter content, Flickr photos, blog posts, press releases, and HTML newsletters &mdash; in a centralized platform. News.gpcc.com also helps streamline content developers&#8217; work flow and affords the GPCC&#8217;s Communications staff increased editorial control over messaging. Additionally, the site offers automated archiving, improved navigation and information architecture, and integrates fluidly with the GPCC&#8217;s primary site, greaterphilachamber.com.</p>
<p>News.gpcc.com is built on a custom WordPress theme. It shares JSON-powered advertising and featured events modules with greaterphilachamber.com and aggregates feed content from Twitter, Flickr, and the GPCC&#8217;s event calendar.</p>
<p>GPCC graphic designer <a href="http://www.natejohnsondesign.com">Nate Johnson</a> took the lead type photo used in the banner.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/work/gpcc-news/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Typeface Design</title>
		<link>http://www.mikeball.us/blog/typeface-design</link>
		<comments>http://www.mikeball.us/blog/typeface-design#comments</comments>
		<pubDate>Fri, 19 Mar 2010 14:56:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Sketches]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=237</guid>
		<description><![CDATA[A home-made typeface. ]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mikeball.us/wp-content/uploads/2010/03/hometown.gif" alt="Homemade Typeface" /><br />
I&#8217;ve been playing around with some typeface design ideas. Stay tuned for numerals.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/typeface-design/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Muscle Crap</title>
		<link>http://www.mikeball.us/work/muscle-crap</link>
		<comments>http://www.mikeball.us/work/muscle-crap#comments</comments>
		<pubDate>Fri, 05 Mar 2010 02:38:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Print]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[illustration]]></category>

		<guid isPermaLink="false">http://www.mikeball.us/?p=225</guid>
		<description><![CDATA[A few of my illustrations were featured in Muscle Crap, a small book published by Salt Tooth Press in 2004.]]></description>
			<content:encoded><![CDATA[<p>A few of my illustrations were featured in <em>Muscle Crap</em>, a small book published by Salt Tooth Press in 2004.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/work/muscle-crap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OurPhiladelphia.org Launched</title>
		<link>http://www.mikeball.us/blog/ourphiladelphia-org-launched</link>
		<comments>http://www.mikeball.us/blog/ourphiladelphia-org-launched#comments</comments>
		<pubDate>Sun, 28 Feb 2010 17:28:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://mikeball.us/?p=198</guid>
		<description><![CDATA[Gabriel Farrell, Cecily Anderson, and I launched Our Philadelphia for our client, Common Cause.]]></description>
			<content:encoded><![CDATA[<p>Last month, Gabriel Farrell, Cecily Anderson, and I launched <a href="http://www.ourphiladelphia.org">OurPhiladelphia.org</a> for our client, Common Cause, a nonprofit, nonpartisan citizen’s lobbying organization working to promote open, honest, and accountable government. While we plan to enhance and grow its functionality in the future, we hope this initial iteration of the site proves useful in helping Philadelphians access information about local politics. Our goal is to help create an open, honest, and accountable local government that serves the public interest.</p>
<h4>Functionality Overview for Philadelphians</h4>
<ul>
<li>Find a complete list of legislative representatives based on a home address search</li>
<li>Access representatives&#8217; photos, contact information, and campaign donor data</li>
<li>Read in-depth reports about the campaign money behind local issues that matter to Philadelphians</li>
<li>Follow the site&#8217;s blog for articles, events, and Philadelphia news related to how campaign money works in Philadelphia politics</li>
<li>Register to create a profile, comment on reports and blog posts, and get a personalized news feed</li>
</ul>
<p>Our Philadelphia was made possible by the Samuel S. Fels Fund. Its representative search tool is powered by Cicero&#8217;s API. The site is built on Django and is an open source project. Feel free to download its <a title="OurCity on Google Code" href="http://code.google.com/p/ourcity/">source code</a> or <a title="Email Mike Ball" href="mailto:mikedball@gmail.com">contact me</a> about using this software in your own city.</p>
<p>Read more about the project in <a href="2010/02/our-philadelphia">my portfolio entry</a>, follow <a href="http://twitter.com/ourphiladelphia">Our Philadelphia on Twitter</a>, or join <a href="http://www.facebook.com/pages/Our-Philadelphia/249786217235?ref=search&#038;sid=7501318.1266558211..1">Our Philadelphia on Facebook</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeball.us/blog/ourphiladelphia-org-launched/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

