<?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>digitalize.ca &#187; HackIt</title>
	<atom:link href="http://digitalize.ca/cat/blog/hackit/feed/" rel="self" type="application/rss+xml" />
	<link>http://digitalize.ca</link>
	<description>Owned, operated, and obliterated by Mohammad Jangda</description>
	<lastBuildDate>Tue, 27 Dec 2011 17:17:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19672</generator>
		<item>
		<title>Dogfooding Edit Flow</title>
		<link>http://digitalize.ca/2010/11/dogfooding-edit-flow/</link>
		<comments>http://digitalize.ca/2010/11/dogfooding-edit-flow/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 22:38:50 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Edit Flow]]></category>
		<category><![CDATA[HackIt]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[cronjob]]></category>
		<category><![CDATA[dogfooding]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[remote repos]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://digitalize.ca/?p=1327</guid>
		<description><![CDATA[Note: Most of the code here is specific to my environment on Webfaction, github and for use with WordPress plugins. You can make it work for other setups (i.e. different hosts, local gits, or even SVN) but will involve some tweaking. Scott recently had a great idea to run the bleeding edge release of Edit [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Note:</strong> Most of the code here is specific to my environment on Webfaction, github and for use with WordPress plugins. You can make it work for other setups (i.e. different hosts, local gits, or even SVN) but will involve some tweaking.</em></p>
<hr />
<p><a href="http://www.scottbressler.com/blog/">Scott</a> recently had <a href="http://groups.google.com/group/editflow/browse_thread/thread/d7ef176adaf6e22">a great idea</a> to run the bleeding edge release of <a href="http://editflow.org">Edit Flow</a> on our official site. I usually do this for most of my plugins before releasing, though, it&#8217;s a manual process: FTP up the latest code and give it a test run. That&#8217;s not fun.</p>
<p>Here&#8217;s a far better, automatized way to keep your repo up-to-date. You can either use cron or githooks. Pick your poison.</p>
<p><span id="more-1327"></span></p>
<h3>Step #1: Clone-ify</h3>
<p>On the server, where Edit Flow would be installed, delete it (if it exists), and clone the github repo. (You have to <a href="http://docs.webfaction.com/software/git.html">install a git instance</a>, if you don&#8217;t already have one.)</p>
<p><script src="https://gist.github.com/701846.js?file=clone-edit-flow.sh"></script><br />
<noscript>
<pre>
cd /home/username/webapps/wordpress/wp-content/plugins/
git clone <a href="mailto:git@github.com">git@github.com</a>:danielbachhuber/Edit-Flow.git
</pre>
<p></noscript></p>
<h3>Step #2: Cron-ify</h3>
<p>Set up a <a href="http://docs.webfaction.com/software/general.html#scheduling-tasks-with-cron">cron job</a> to run every so often so that you don&#8217;t have to manually run &#8220;git pull&#8221; to stay up-to-date.</p>
<p><script src="https://gist.github.com/701846.js?file=git-cron"></script><br />
<noscript>
<pre>
1 1 * * * cd /home/username/webapps/wordpress/wp-content/plugins/edit-flow &#038;&#038; /home/username/webapps/git/bin/git pull
</pre>
<p></noscript></p>
<p>This job runs daily at 1:01am and does a git pull on the repo. On my site, the cron job is set to run daily; the Edit Flow site is set to update every couple of hours. Go with what works for you. Check out other <a href="http://www.linuxhelp.net/guides/cron/">options for cron jobs</a>.</p>
<h3>(Alternate) Step #2: Hook-ify</h3>
<div id="attachment_1331" class="wp-caption aligncenter" style="width: 310px"><a href="http://digitalize.ca/media/post-receive-url.png"><img src="http://digitalize.ca/media/post-receive-url-300x128.png" alt="github gets POSTy" title="" width="300" height="128" class="size-medium wp-image-1331" /></a><p class="wp-caption-text">github gets POSTy</p></div>
<p>If you&#8217;re really adventurous, an update once (or even several) times a day isn&#8217;t enough for you. You want to live on the bleeding edge and update as soon changs are made! Thanks to <a href="http://www.kernel.org/pub/software/scm/git/docs/githooks.html">githooks</a>, you can do this fairly easily. Github takes it a step further and makes it even easier with <a href="http://help.github.com/post-receive-hooks/">Post-Receive URLs</a>:</p>
<blockquote><p>We’ll hit these URLs with POST requests when you push to us, passing along information about the push.</p></blockquote>
<p>Here&#8217;s a quick-and-dirty PHP script I cooked up that works with github&#8217;s Post-Recieve URLs.</p>
<p><script src="https://gist.github.com/701537.js?file=github-post-receive-pull.php"></script><br />
<noscript>
<pre>
<?php

// Edit these to match your environment settings
define( 'BASE_PATH', '/home/username/webapps' );
// This is the path to the git executable
define( 'GIT_PATH', get_full_path( '/git/bin/git' ) );

// Edit this array so the key matches the github repo name and the value is path of the repo relative to the BASE_PATH
$repository_paths = array(
	'test' => '/git-test'
);

if( isset( $_POST['payload'] ) ) {
	$payload = json_decode( stripslashes( $_POST['payload'] ) );

	if( isset( $repository_paths[ $payload->repository->name ] ) ) {
		$path = get_full_path( $repository_paths[ $payload->repository->name ] );

		$cmd = sprintf( 'cd %s; ', $path );
		$cmd .= sprintf( '%s pull', GIT_PATH );
		shell_exec( $cmd );

		die( "Executed: $cmd!" );
	}
}

die( 'Dont\'t think you\'re sposed to be here...' );

function get_full_path( $path ) {
	return BASE_PATH . $path;
}
</pre>
<p></noscript></p>
<p>Upload this to your server and change the BASE_PATH, GIT_PATH, and $repository_paths to match your environment. On github, go to your Repo > Admin > Service Hooks > Post-Receive URLs and add the URL to the script. You can click on &#8220;Test Hook&#8221; to have github send you a test payload.</p>
<p>And you&#8217;ll probably want to delete the cron job, as that&#8217;s now redundant.</p>
<h3>Log-ify</h3>
<p>If you want to keep a log of what these scripts are doing behind-the-scenes for troubleshooting, just append the following to the cron job or Post-Receive script after the &#8220;git pull&#8221; call. This appends all output (errors and all) to a git.log file. Keep in mind that this file will grow over time, so prune early, prune often.</p>
<p><script src="https://gist.github.com/701846.js?file=git-log"></script><br />
<noscript>
<pre>
>> /home/username/git.log 2>&#038;1
</pre>
<p></noscript></p>
<hr />
<p><em><strong>Closing Caveat:</strong> I am, by no means, an expert on this topic. I&#8217;ve cooked up something that works for me, and it may or may not be The Right Way. Use at your own discretion.</em></p>]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2010/11/dogfooding-edit-flow/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HackIt: How to add Smart Playlists to your iPod</title>
		<link>http://digitalize.ca/2009/01/hackit-ipod-smart-playlists/</link>
		<comments>http://digitalize.ca/2009/01/hackit-ipod-smart-playlists/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 21:17:20 +0000</pubDate>
		<dc:creator>Mohammad Jangda</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[HackIt]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[smart playlists]]></category>

		<guid isPermaLink="false">http://batmoo.com/?p=121</guid>
		<description><![CDATA[One of the greatest things about iTunes is the Smart Playlists feature. One of the worst things about iTunes is figuring out how to do things. One thing I always had difficulty with was figuring out how to create Smart Playlists for the music on my iPod. Sure, I could create Smart Playlists and sync [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align:center"><div id="attachment_150" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-150" title="Holy Smart Playlists, Batman!" src="http://digitalize.ca/media/ipod-smart-playlists-300x212.jpg" alt="Holy Smart Playlists, Batman!" width="300" height="212" /><p class="wp-caption-text">Holy Smart Playlists, Batman!</p></div></p>
<p>One of the greatest things about iTunes is the Smart Playlists feature. One of the worst things about iTunes is figuring out how to do things.</p>
<p>One thing I always had difficulty with was figuring out how to create Smart Playlists for the music on my iPod. Sure, I could create Smart Playlists and sync them directly with my iPod, but sometimes that ends up throwing in music I don&#8217;t want. And when you&#8217;re dealing with limited storage capacity, you have to be ruthless about what gets on your iPod.</p>
<p>So, I looked everywhere, but didn&#8217;t really have much luck (not even through Apple&#8217;s Support site). After many hours of fussing, I finally hit jackpot and figured out how. Detailed instructions after the jump.</p>
<p><strong>Note: </strong>for this trick to work, you need your iPod set up for automatic sync to a playlist.</p>
<h3><span id="more-121"></span></h3>
<hr />
<h3><strong>Things you need:</strong></h3>
<ul>
<li>iPod (and data cable)</li>
<li>iTunes</li>
</ul>
<hr />
<h3><strong>Things you need to do:</strong></h3>
<h4><em>Part 1<strong>:</strong> Setting the stage</em></h4>
<p><strong>Note:<em> </em></strong>if your iPod already syncs to a single playlist, you can skip this step. If you sync to multiple playlists, you need to unify all those playlists together. To do that, simply create a Smart Playlist that combines all the playlists (call it &#8220;iPod Music&#8221;)¬† and skip to Part 2. (<a href="http://digitalize.ca/media/unified-playlist.jpg" target="_blank">Pictorial Help</a>)</p>
<ol>
<li>Connect your iPod.</li>
<li>Create a new playlist (<strong>File</strong> &gt; <strong>New Playlist</strong>). Let&#8217;s call it &#8220;iPod Music&#8221;.</li>
<li>Add the music you want to sync to the iPod to this new playlist.</li>
<li>Set up the iPod to Automatically Sync with the &#8220;iPod Music&#8221; playlist.</li>
</ol>
<h4><em>Part 2: Getting on stage</em></h4>
<ol>
<li>Create a new smart playlist (<strong>File </strong>&gt; <strong>New Smart Playlist</strong>).</li>
<li>Set the following rules (pictorial help below):
<ul>
<li>Enable &#8220;<em>Match <strong>all</strong> of the following rule</em>s&#8221;</li>
<li>Set the following rule: <em>Rating </em>&gt;&gt; <em>is greater than </em>&gt;&gt; <em>3 stars</em></li>
<li>Add another rule by clicking on the little plus sign</li>
<li>Set the following rule: <em>Playlist</em> &gt;&gt; <em>is</em> &gt;&gt; <em>iPod Music</em></li>
<li>Enable &#8220;<em>Live Updating</em>&#8220;</li>
</ul>
<p><div id="attachment_155" class="wp-caption alignnone" style="width: 310px"><a href="http://digitalize.ca/media/top-played1.jpg"><img class="size-medium wp-image-155" title="iPod Top Rated Smart Playlist" src="http://digitalize.ca/media/top-played1-300x135.jpg" alt="Rules for the iPod Top Rated Smart Playlist" width="300" height="135" /></a><p class="wp-caption-text">Rules for the iPod Top Rated Smart Playlist</p></div></li>
<li>Click Ok and give your new playlist a name. Let&#8217;s call it &#8220;iPod Top Rated&#8221;.</li>
<li>Now, set your iPod to sync with the new &#8220;iPod Top Rated&#8221; Smart Playlist.</li>
<li><em>Apply </em>and <em>Sync</em>, and now iTunes will do its thing.</li>
</ol>
<h4><em>Part 3: Rocking out!</em></h4>
<ol>
<li>Rinse and repeat Part 2 for any and all additional Smart Playlists.</li>
<li>Rock on!</li>
</ol>
<hr />
<h3><em>Tips</em></h3>
<p>Just a few handy tips that may help:</p>
<ul>
<li>I&#8217;d recommend creating a folder for all your iPod Smart Playlists &#8212; that way, you can group them all together.</li>
<li>More to come as I think of them&#8230;</li>
</ul>
<hr />
Questions? Praise? Confused looks? Email me at <a href="mailto:mo@digitalize.ca">mo@digitalize.ca</a> or leave me a sweet comment.</p>]]></content:encoded>
			<wfw:commentRss>http://digitalize.ca/2009/01/hackit-ipod-smart-playlists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

