<?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>Johan Brook</title>
	<atom:link href="http://johanbrook.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://johanbrook.com</link>
	<description>is a designer and developer with taste</description>
	<lastBuildDate>Thu, 23 Feb 2012 06:00:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>I can&#8217;t design in the browser either</title>
		<link>http://www.sazzy.co.uk/2012/02/why-i-cant-design-in-the-browser/</link>
		<comments>http://johanbrook.com/design/designing-in-the-browser/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 06:00:12 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[prototyping]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1150</guid>
		<description><![CDATA[Sarah Parmenter on how she can&#8217;t design in the browser: For some projects, a hybrid method of producing a type of scratch file, with a general overview of the style and colours of the app/website, then going straight into HTML/CSS &#8230; <p class="right"><a class="read-more" href="http://johanbrook.com/design/designing-in-the-browser/">Read more →</a></p><p><a href='http://johanbrook.com/design/designing-in-the-browser/' title='permalink'>★ Permalink</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Sarah Parmenter on how she can&#8217;t design in the browser:</p>
<blockquote><p>
For some projects, a hybrid method of producing a type of scratch file, with a general overview of the style and colours of the app/website, then going straight into HTML/CSS has worked, in others, I still need to produce full-scale visuals.
</p></blockquote>
<p><strong>I recognize the things</strong> she brings up in her post. Everytime I&#8217;ve gone straight to the browser to create something quick for myself, the result is an incomprehensible mess. Perhaps I&#8217;m not good enough yet, but my brain just isn&#8217;t in &#8220;creative mode&#8221; when I&#8217;m coding. Everything gets more bulky when you&#8217;re doing major changes (that is, not subtle colour changes, but numerous layout experiments, for instance). Doing layout changes in Photoshop? Just drag that box over there. Doing it in HTML/CSS? Um, just make that box <code>float: left;</code>, and clear that container, then  .. < and so on >.</p>
<p>I&#8217;ve seen a couple of web designers writing about this before (can&#8217;t find the blog posts right now …). Someone suggested creating a mockup in Photoshop, but without any text, and then putting the mockup as a <code>background-image</code> for the <code>body</code> tag and adding text in the browser with absolute positioning.</p>
<p><a href="http://www.stuffandnonsense.co.uk/">Andy Clarke</a> brought up the idea consisting of that initially showing the client a browser mockup is like lying – the client get the impression of that his/her website will look <em>exactly</em> like that in all browsers. That&#8217;s not the case – websites don&#8217;t need to look exactly the same in all browsers. By quickly iterating in code and perhaps showing the website in Internet Explorer from the beginning, the client might think &#8220;Wow, the design looks so much better in Chrome/Firefox/Safari than in Explorer!&#8221;. We let the <em>weakest link</em> set the bar – not a static mockup.</p>
<p><strong>Personally, I prefer a hybrid solution,</strong> where I mockup the overall visual style in Photoshop in order to develop a colour scheme that works, contrasts in typography, and other elements. I then begin very early iterating the mockup in HTML and CSS, and jump back and forth between the browser and Photoshop. It&#8217;s much easier than doing the whole thing in code, only to realize that the design isn&#8217;t cutting it, and then having to start over coding a new design. It&#8217;s the same in Photoshop though: you can throw countless of hours into a static mockup only to recreate everything in code later on. I say a hybrid solution is most effective.</p>
<p><a href='http://johanbrook.com/design/designing-in-the-browser/' title='permalink'>★ Permalink</a></p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/design/designing-in-the-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I set up my web development environment on OS X Lion</title>
		<link>http://johanbrook.com/development/web-dev-environment/</link>
		<comments>http://johanbrook.com/development/web-dev-environment/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 07:00:41 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Compass]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Homebrew]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[SCSS]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1132</guid>
		<description><![CDATA[I recently wiped my Macbook Pro&#8217;s hard drive and installed OS X Lion. It was nice with a clean, fresh start again, and I had for a couple of weeks looked forward to set up my dev environment from the &#8230; <p class="right"><a class="read-more" href="http://johanbrook.com/development/web-dev-environment/">Read more →</a></p>]]></description>
			<content:encoded><![CDATA[<p>I recently wiped my Macbook Pro&#8217;s hard drive and installed OS X Lion. It was nice with a clean, fresh start again, and I had for a couple of weeks looked forward to set up my dev environment from the ground up (nerd alert). Ever since I got my Mac, things had been piling up, and it felt very fragile.</p>
<p>So this time I did everything right. During my journeys through the internets I picked up nifty tools and techniques, as well as other blog posts describing pitfalls and other general tips. Google around for something like <em>&#8220;setting up web development environment os x&#8221;. </em>Two gems are <a href="http://intridea.com/2011/7/26/setting-up-ruby-dev-on-lion?blog=company">Setting Up a Ruby Development Machine From Scratch With OS X Lion</a> and <a href="http://www.stuartellis.eu/articles/mac-setup/">Setting Up an Apple Mac for Ruby Development</a> (just skip the parts about RVM, I&#8217;ll get to that further down). I also made a list of every technology/tool/language I needed:</p>
<p><a href="http://cl.ly/CpSu" class="button">Johan&#8217;s Checklist</a></p>
<p>They are ordered by importance and dependency.</p>
<h2>Xcode or the GCC/LLVM compilers</h2>
<p>Compilers are vital if you need to build dev tools and/or languages. Both you and I would like to do that. Some time ago, the only way to get the GCC and LLVM compilers up and running on a Mac was through Xcode. If you&#8217;re a web developer, chances are big that you won&#8217;t touch Xcode.app at all, and on top of that the installation footprint is quite large. Then a smart guy came along and made GCC/LLVM/other important tools available as standalone files, and put it up on GitHub!</p>
<ul>
<li><a href="https://github.com/kennethreitz/osx-gcc-installer">osx-gcc-installer on GitHub</a></li>
<li><a href="http://www.kennethreitz.com/xcode-gcc-and-homebrew.html">Blog post</a></li>
</ul>
<p>The instructions on GitHub is all you need to set it up. However, I decided to download and install Xcode 4 anyway, since I suspected I likely wanted to deal with building iOS apps later on.</p>
<h2 id="homebrew">Homebrew</h2>
<p><a href="http://mxcl.github.com/homebrew/">The awesome package manager for OS X</a>. <strong>Don&#8217;t</strong> go dabble with installing tools manually, go through Homebrew. You can pull of stuff like <code>brew install mysql</code> or <code>brew install git</code> without having to download tarballs, building, managing binaries on the <code>PATH</code>, and &#8230; arrgghhh. </p>
<p>To get Homebrew started:</p>
<pre class="bash"><code>$ /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
$ brew update
</code></pre>
<p>Get to know the tool with the bin command <code>brew</code>.</p>
<h2 id="git">git</h2>
<pre class="bash"><code>$ brew install git
</code></pre>
<p>That is all. My .gitconfig is included in my dotfiles (linked further down).</p>
<h2 id="ruby">Ruby</h2>
<p>Ruby is a must-have, with all its great gems (Sass! Compass! Sinatra! Rake!). Ruby is indeed included in OS X, but we want to manage versions ourselves and stay up to date. You could download and build Ruby from the <a href="http://www.ruby-lang.org/en/">website</a>, but instead I used a Ruby version manager to do it for me.</p>
<p>I used <a href="https://rvm.beginrescueend.com/" title="Ruby Version Manager">RVM</a> before, and it worked well. However, Sam Stephenson convinced me to switch to his tool <strong>rbenv</strong>. Read more in the <a href="https://github.com/sstephenson/rbenv#readme">rbenv Readme</a>. rbenv works just like RVM, but feels more lightweight.</p>
<p>Everything you need to know is explained in the Readme. Note that you&#8217;ll need <strong>ruby-build</strong> to actually build the Ruby versions (<a href="https://github.com/sstephenson/ruby-build">GitHub project</a>).</p>
<pre class="bash"><code>$ brew install rbenv
$ brew install ruby-build

# Install Ruby 1.9.3
$ rbenv install 1.9.3-p0

# Check that everything works
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
</code></pre>
<h2 id="rubygems">RubyGems</h2>
<p><a href="http://rubygems.org/">RubyGems</a> manages all Ruby gems, and is included in OS X. But remember to update it to the latest version before you do anything.</p>
<pre class="bash"><code>$ gem update --system
</code></pre>
<p>Then I installed some handy gems.</p>
<pre class="bash"><code>$ gem update rake
$ gem update rails
$ gem install rack
$ gem install sass
$ gem install compass
$ gem install sinatra
$ gem install bundler
</code></pre>
<h2 id="other">Other</h2>
<p>If there&#8217;s anything else you need, it&#8217;s probably in Homebrew:</p>
<pre class="bash"><code>$ brew install wget mysql node mongodb

# NPM
$ curl http://npmjs.org/install.sh | sh
</code></pre>
<p>And <a href="http://www.mamp.info/en/index.html">MAMP</a> for local PHP/MySQL development in an .app.</p>
<h2 id="dotfiles">Dotfiles</h2>
<p>I&#8217;ve forked some neat dotfiles to keep in the home folder. You can find them in <a href="https://github.com/johanbrook/dotfiles">my GitHub project</a>. Just do:</p>
<pre class="bash"><code>$ git clone git://github.com/johanbrook/dotfiles.git
$ rake install
</code></pre>
<p>The dotfiles include:</p>
<ul>
<li>gitignore</li>
<li>gitconfig (with aliases and settings)</li>
<li>custom bash prompt</li>
<li>git and Rake completion scripts</li>
<li>irbrc (for irb)</li>
<li>railsrc</li>
<li>gemrc</li>
</ul>
<figure><a class="block" href="http://f.cl.ly/items/1m1R3T160U1J361w3U3K/Terminal%20Bright.png"><img src="http://f.cl.ly/items/1m1R3T160U1J361w3U3K/Terminal%20Bright.png" alt="Terminal Bright" title="Terminal Bright" /></a></p>
<figcaption>My bash prompt and Terminal colour theme.</figcaption>
</figure>
<h2 id="outro">Outro</h2>
<p>And there we go! We&#8217;re done! Wasn&#8217;t so bad, eh? I suppose you can put an enormous amount of hours into configuring your setup, but this is enough for me. It&#8217;s a solid foundation with few unnecessary dependencies, which is important to me.</p>
<p>Don&#8217;t hesitate to give me shout if anything is wrong, outdated, or simply suck.</p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/development/web-dev-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java and beginner programming courses at universities</title>
		<link>http://johanbrook.com/development/java-universities/</link>
		<comments>http://johanbrook.com/development/java-universities/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 08:22:22 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[university]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1053</guid>
		<description><![CDATA[I&#8217;ve been interested in programming since beginning of high school, and have freelanced in web design and development during the past years. This fall I went to university for a major in software engineering. Of course we were going to &#8230; <p class="right"><a class="read-more" href="http://johanbrook.com/development/java-universities/">Read more →</a></p>]]></description>
			<content:encoded><![CDATA[<p class="ingress"><strong>I&#8217;ve been interested in programming</strong> since beginning of high school, and have freelanced in web design and development during the past years. This fall I went to university for a major in software engineering. Of course we were going to learn to program, but in the beginning it was a huge turnoff for me – we were doing it in Java. Why?</p>
<p><small><strong>Disclaimer:</strong> I&#8217;m by no means an experienced software engineer or programmer. I focus on front-end web development, and this is only my opinions on learning to program from a student&#8217;s perspective.</small></p>
<p>How do you really learn to program? Not just in a specific language, but the general idea – the logic, the ability to think in abstractions, algorithms, to see the flows of a program? There are freshmen at software engineering and computer science university programs who have never programmed before, and it&#8217;s not a simple and quick task to teach these students the idioms and thoughts behind programming. What&#8217;s the most <strong>efficient, student friendly, and most pedagogical way of teaching how to think in code?</strong></p>
<p>As mentioned, I went to university this fall. I considered myself lucky, since I had programmed before. I.e., I had taken a couple of courses in high school and after that worked with web technologies as a freelancer. I had been exposed to both the academical and practical side of programming.</p>
<p>The three courses I took in high school taught us Java. We were first supposed to study C++ during the first two courses, and take Java last, but the school decided to go for Java for all three, in a way to let us get a firm grasp of programming and general OO principles. Java was hence the first real programming language I actively used. During the senior year I began studying other languages lightly. PHP seemed like heaven with dynamic typing in all its glory, and Javascript was a nice buddy I could see myself hang out with. Later Ruby and Python lured (but I haven&#8217;t to this day begun learning them seriously). </p>
<p>I had heard from other students that Java was the language tutored at this university program I was to apply for. My heart sank a bit since I had begun to grasp code minimalism, &#8220;beautiful code&#8221;, and DRY. According to me, Java isn&#8217;t really embracing those teachings. </p>
<p>I had a couple of theories about why, oh why, the university chose Java to teach new students:</p>
<ul>
<li><strong>It&#8217;s cross-platform.</strong> Students run OS X, Linux, or Windows, and you can get Java up and running effortlessly on these platforms.</li>
<li><strong>It&#8217;s object oriented.</strong> The two programming courses we had during the past fall were actually titles <cite>Object Oriented Development (beginner and intermediate)</cite>. Java was built with many solid object oriented ideologies in regard: inheritance, interfaces, polymorphism, dynamic binding, etc. If you have a solid understanding of the OO in Java, there&#8217;s a good change you&#8217;ll grasp any other OO language in very short time.</li>
<li>It&#8217;s widely used in the <strong>enterprise</strong> sector (or my <em>&#8220;Who&#8217;s waiting for the fresh students after they graduate?&#8221;</em> theory).</li>
<li><strong>It&#8217;s quite versatile.</strong> The university can use Java to teach full blown desktop applications, database programming, GUI design, web server programming, and in recent years mobile app development (Android).</li>
</ul>
<h2>But what about the cons of teaching Java to new students?</h2>
<ul>
<li>Its bloated syntax might be an obstacle when learning how to program. Why should a beginner care about curly braces? Why should he or she even have to ponder over what <code>static</code> is? As soon as the teacher states: <cite>Don&#8217;t worry about <insert complicated idiom here>, we&#8217;ll get to that in course X</cite> and leaves the students dumb-founded, there&#8217;s something rotten going on. </li>
<li>The lack of simplicity, and need for boilerplate code. Tasks you pull off in Ruby in a line of code can take up several lines in Java. The question is: should the students be forced to write a lot of code by themselves, or should the language serve convenience methods for even the simplest tasks? Or both?</li>
<li>Overly complicated and sometimes utterly useless design patterns. <code>AbstractModelFactory</code>, I&#8217;m looking at you.</li>
</ul>
<p>I think it all boils down to: <em>Is the possible pain and frustration associated with Java worth getting a solid foundation in object orientation, scanning through documentation, diving deep into Swing, and worrying about semicolons?</em> Perhaps. </p>
<p>What&#8217;s the focus? Learn to program in general, or learn a single language? Sometimes I think my university focus a bit too much on Java. They should branch out and bring in examples from other languages once in a while. In the end, I think universities often use Java since it&#8217;s the shotgun solution: You can squeeze in quite a large curriculum with Java, it&#8217;s widely used in the industry, it teaches basic OO concepts. </p>
<p>If it was up to me, I&#8217;d teach Ruby to new students. Just to get a hang of basic program flows, printing and reading data to a console (I/O), calculations, string manipulations, and then move on to methods, classes, objects, et al. It would only serve as a intro tool to programming. Sure, you can&#8217;t create an Android app with Ruby, but I think it would be godsent for the totally new students. The downside? These students would have to learn Java later on instead. </p>
<p>One could debate wether it&#8217;s good or bad for new students to learn two programming languages in a short period of time. But when I see students struggling with why they can&#8217;t call methods on an <code>int</code> in Java – like they can on a <code>String</code> – and other things, I wonder if Java is the right choice to start out with.</p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/development/java-universities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Realigning Johanbrook.com</title>
		<link>http://johanbrook.com/this-site/realigning-johanbrook-com/</link>
		<comments>http://johanbrook.com/this-site/realigning-johanbrook-com/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 19:21:44 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[This site]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[golden ratio]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[Redesign]]></category>
		<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1104</guid>
		<description><![CDATA[Today I pushed a new theme to this site. It&#8217;s a lot cleaner and to me more readable than the previous one. Some points to bring up: Layout I still go with the two-column layout. This time, I fully ditched &#8230; <p class="right"><a class="read-more" href="http://johanbrook.com/this-site/realigning-johanbrook-com/">Read more →</a></p>]]></description>
			<content:encoded><![CDATA[<p>Today I pushed a new theme to this site. It&#8217;s a lot cleaner and to me more readable than the previous one. Some points to bring up:</p>
<h2>Layout</h2>
<p>I still go with the two-column layout. This time, I fully ditched any 12 or 16 column grids, and went fluid all the way, i.e. I&#8217;ve made all measures relative to each other, and the Golden Ratio. I&#8217;ve used a 6pt baseline grid, and a <a href="http://modularscale.com/">modular scale</a>. It was actually quite relaxing &#8216;letting go&#8217; of the old grids and start fresh.</p>
<figure>
<a href="http://f.cl.ly/items/1Y0L3g0l1K2y3u2A2t3Q/Slammer.png"><br />
<img src="http://f.cl.ly/items/1Y0L3g0l1K2y3u2A2t3Q/Slammer.png" alt="Grid" /><br />
</a></p>
<figcaption>Frontpage with Golden Ratio, module, and baseline overlay</figcaption>
</figure>
<p>Try adding <code>?dev=1</code> to any URL on the site, and press and hold <kbd>G</kbd> on your keyboard to view the baseline grid.</p>
<h2>Typography and Colours</h2>
<p>Switched the somewhat boring Georgia for <strong>PT Serif</strong>, and Helvetica for <strong>Lato</strong>. Both are served via Google Webfonts Directory. The goal with the realignment was to create more whitespace to focus on the typography, and for that great typefaces were needed. </p>
<p>This is also the first time I use the new-ish <code>rem</code> unit (with a fallback). There are almost no pixel values as far as the eyes can see.</p>
<p>The colour palette is quite sparse: just plain white, kinda-black, and cerise red. </p>
<h2>Under the Hood</h2>
<p>I have for once not used Compass for this project. Don&#8217;t know why, just felt for a change – trying out something new. That &#8216;new&#8217; is <a href="http://thoughtbot.com/bourbon/">Bourbon</a> by Thoughtbot. A lightweight collection of Sass mixins. Might as well, right?</p>
<p>The very small amount of Javascript I&#8217;ve included is written in CoffeeScript, which I&#8217;ve been dabbling with recently.</p>
<h2>Responsiveness</h2>
<p>No need to explain anything here. I believe every web designer and developer with self-respect should create responsive websites for themselves and clients these days. For this one I have two breakpoints set in ems. There is no max-width of the container.</p>
<h2>Javascript?</h2>
<p>Nope, almost none. I don&#8217;t need jQuery for anything, so it felt good getting rid of all that fat.</p>
<h2>More writing?</h2>
<p>Hopefully this will encourage me to blog more often :) (as I and many before me have said – all the time).</p>
<p>Thanks for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/this-site/realigning-johanbrook-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Songs to code by</title>
		<link>http://johanbrook.com/music/songs-to-code-by/</link>
		<comments>http://johanbrook.com/music/songs-to-code-by/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 19:09:20 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[playlist]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Spotify]]></category>
		<category><![CDATA[techno]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1080</guid>
		<description><![CDATA[Music has a strong influence on a myriad of things. Art, writing, exercise, studying. It might help you focus, relax, cheer up. And most important: it could help you write badass code. Music I program to I&#8217;ve set up a &#8230; <p class="right"><a class="read-more" href="http://johanbrook.com/music/songs-to-code-by/">Read more →</a></p>]]></description>
			<content:encoded><![CDATA[<p>Music has a strong influence on a myriad of things. Art, writing, exercise, studying. It might help you focus, relax, cheer up. And most important: it could help you write badass code.</p>
<h2>Music I program to</h2>
<p>I&#8217;ve set up a Spotify playlist where I collect great programming tunes. Mostly techno and other computer related genres.</p>
<p class="center">
<a class="button accent" href="http://open.spotify.com/user/johanbrook/playlist/2mtlhuFVOFMn6Ho3JmrLc2">Programming playlist by Johan</a><br />
<small>Opens Spotify</small>
</p>
<p>I especially like the Tron soundtrack (who doesn&#8217;t), Nine Inch Nails and Daft Punk. It&#8217;s hard not to feel the kick when these epic melodies are doing their thing.</p>
<p>Also check out the site who inspired this post: <a href="http://musicforprogramming.net/">Musicforprogramming();</a>. Free MP3 downloads. The <a href="http://www.thinkwithportals.com/music.php">official Portal soundtrack</a> is also really, really cool.</p>
<p>Other notable playlists to check out:</p>
<ul>
<li><a href="http://open.spotify.com/user/johnyboy991/playlist/3dWfwjPXtnPIykpe67pmL4">&#8220;Coding&#8221;, by John Barbero Unenge</a></li>
<li><a href="http://open.spotify.com/user/caliform/playlist/2jFlbUqxF3wFt6G1Q2zr9S">&#8220;Work playlist&#8221;, by Sebastiaan de With</a></li>
</ul>
<p>More suggestions on great programming songs are welcomed!</p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/music/songs-to-code-by/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding custom URL endpoints in WordPress</title>
		<link>http://johanbrook.com/development/wordpress/custom-endpoints/</link>
		<comments>http://johanbrook.com/development/wordpress/custom-endpoints/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 10:00:10 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Custom]]></category>
		<category><![CDATA[endpoint]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[URL]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1070</guid>
		<description><![CDATA[In a current WordPress project, we wanted to have a permalink to a photo gallery filled with images (attachments) for a post. WordPress supports permalinks to single attachments, such as site.com/single-post/attachment/flower That&#8217;s cool. However, we wanted something like this: site.com/single-post/photos &#8230; <p class="right"><a class="read-more" href="http://johanbrook.com/development/wordpress/custom-endpoints/">Read more →</a></p>]]></description>
			<content:encoded><![CDATA[<p>In a current WordPress project, we wanted to have a permalink to a photo gallery filled with images (attachments) for a post. WordPress supports permalinks to single attachments, such as </p>
<pre><code>site.com/single-post/attachment/flower</code></pre>
<p>That&#8217;s cool. However, we wanted something like this:</p>
<pre><code>site.com/single-post/photos</code></pre>
<p>&#8230; where all attachments would be listed. The <code>/photos</code> part is called an <em>endpoint</em>. So how do you add them in WordPress? And how do you assign this endpoint to render a specific template file?</p>
<h2>Relevant APIs</h2>
<p>After some quick googling to find out if this was possible and worth a try, I found the <a href="http://codex.wordpress.org/Rewrite_API">Rewrite API</a> in the Codex. Neat stuff. </p>
<p>Other resources I found during my quest:</p>
<ul>
<li><a href="http://johnbeales.com/20090824/endpoints-a-little-secret-for-url-manipulation-in-wordpress/">http://johnbeales.com/20090824/endpoints-a-little-secret-for-url-manipulation-in-wordpress/</a></li>
<li><a href="http://wordpress.org/support/topic/custom-rewrite-approach-with-add_rewrite_endpoint">http://wordpress.org/support/topic/custom-rewrite-approach-with-add_rewrite_endpoint</a></li>
<li><a href="http://www.rlmseo.com/blog/passing-get-query-string-parameters-in-wordpress-url/">http://www.rlmseo.com/blog/passing-get-query-string-parameters-in-wordpress-url/</a></li>
<li><a href="http://wordpress.stackexchange.com/questions/1033/url-design-for-sub-posts">URL Design for Sub-Posts?</a></li>
<li><a href="http://codex.wordpress.org/Template_Hierarchy">http://codex.wordpress.org/Template_Hierarchy</a></li>
</ul>
<h2>The code</h2>
<p>After reading through these, I simply implemented the necessary filters and callbacks in the <code>functions.php</code> file.</p>
<p>I began with this:</p>
<pre class="php"><code>add_filter( 'query_vars', 'add_query_vars');

/**
*   Add the 'photos' query variable so WordPress
*   won't mangle it.
*/
function add_query_vars($vars){
    $vars[] = "photos";
    return $vars;
}</code></pre>
<p>As you can see, I&#8217;m working with my <code>/photos</code> endpoint. I have to tell WordPress&#8217; rewrite engine to take our special query variable (&#8220;photos&#8221;) into account when rewriting URLs, so I used the <code>query_vars</code> filter for this (see the <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference">Filter Reference</a>).</p>
<p>Next, I registered the actual endpoint with the built-in function <code class="php">add_rewrite_endpoint()</code> (<a href="http://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint">Docs</a>). It takes a string (the endpoint) and a <code>place</code>. &#8220;Place&#8221; is where the endpoint will be active, and the docs only specify a couple: &#8220;EP_PERMALINK, EP_PAGES, EP_ATTACHMENT, etc&#8221;. From other examples I&#8217;ve spotted <code>EP_ALL</code> as well. I used <code>EP_PERMALINK</code>:</p>
<pre class="php"><code>add_rewrite_endpoint('photos', EP_PERMALINK);</code></pre>
<p>Right. The endpoint is up and running, but as I said at the top, I wanted a specific template to render when this URL is visited. It&#8217;s doable! Check out the <a href="http://codex.wordpress.org/Plugin_API/Filter_Reference/_single_template">single_template filter</a>. </p>
<pre class="php"><code>add_filter( 'single_template', 'project_attachments_template' );

/**
*	From http://codex.wordpress.org/Template_Hierarchy
*
*	Adds a custom template to the query queue.
*/
function project_attachments_template($templates = ""){
	global $wp_query;

	// If the 'photos' endpoint isn't appended to the URL,
	// don't do anything and return
	if(!isset( $wp_query->query['photos'] ))
		return $templates;

	// .. otherwise, go ahead and add the 'photos.php' template
	// instead of 'single-{$type}.php'.
	if(!is_array($templates) &#038;&#038; !empty($templates)) {
		$templates = locate_template(array("photos.php", $templates),false);
	}
	elseif(empty($templates)) {
		$templates = locate_template("photos.php",false);
	}
	else {
		$new_template = locate_template(array("photos.php"));
		if(!empty($new_template)) array_unshift($templates,$new_template);
	}

	return $templates;
}</code></pre>
<p>I&#8217;ve hard coded the file <code>photos.php</code> above. Create this file in the theme folder, and you&#8217;re all set! In this template you&#8217;ve got access to the global <code class="php">$post</code> variable, so you&#8217;re able to pull in all kinds of post data into it.</p>
<h2>Outro</h2>
<p>Pretty cool to bend WordPress to your will, eh? I can imagine this functionality is pretty nifty to have when doing more advanced things in WordPress.</p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/development/wordpress/custom-endpoints/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Can you make the logo smaller?&#8221;</title>
		<link>http://www.impressivewebs.com/things-we-wish-clients-would-say/</link>
		<comments>http://johanbrook.com/freelancing/can-you-make-the-logo-smaller/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 11:57:38 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Freelancing]]></category>
		<category><![CDATA[Clients]]></category>
		<category><![CDATA[requests]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1066</guid>
		<description><![CDATA[&#8220;Things we wish clients would say&#8221; include some gems which would be like sweet, soft conditioner to designer and developer&#8217;s ears. ★ Permalink<p><a href='http://johanbrook.com/freelancing/can-you-make-the-logo-smaller/' title='permalink'>★ Permalink</a></p>
]]></description>
			<content:encoded><![CDATA[<p><em>&#8220;Things we wish clients would say&#8221;</em> include some gems which would be like sweet, soft conditioner to designer and developer&#8217;s ears. </p>
<p><a href='http://johanbrook.com/freelancing/can-you-make-the-logo-smaller/' title='permalink'>★ Permalink</a></p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/freelancing/can-you-make-the-logo-smaller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hiring developers 2012 style</title>
		<link>http://37signals.com/svn/posts/3071-why-we-dont-hire-programmers-based-on-puzzles-api-quizzes-math-riddles-or-other-parlor-tricks</link>
		<comments>http://johanbrook.com/development/hiring-developers-2012-style/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 15:39:32 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[37signals]]></category>
		<category><![CDATA[hiring]]></category>
		<category><![CDATA[interviews]]></category>
		<category><![CDATA[Jobs]]></category>
		<category><![CDATA[positions]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1063</guid>
		<description><![CDATA[David Heinemeier Hansson from 37signals on hiring developers. I’ve known fabulous programmers flame out in the quizzing cage and terrible ones excel. So unless you’re specifically hiring someone to design you the next sorting algorithm, making them do so on &#8230; <p class="right"><a class="read-more" href="http://johanbrook.com/development/hiring-developers-2012-style/">Read more →</a></p><p><a href='http://johanbrook.com/development/hiring-developers-2012-style/' title='permalink'>★ Permalink</a></p>
]]></description>
			<content:encoded><![CDATA[<p>David Heinemeier Hansson from 37signals on hiring developers.</p>
<blockquote><p>I’ve known fabulous programmers flame out in the quizzing cage and terrible ones excel. So unless you’re specifically hiring someone to design you the next sorting algorithm, making them do so on the white board is a poor gauge of future success.</p></blockquote>
<p>I&#8217;ve read many articles on this subject: how to ace an interview for a developer position. Even for front-end positions, questions about algorithms and similar &#8220;puzzles&#8221; arise. Sorry, but I actually think you have to tailor the interview material for the practical assignments the interviewee will receive.</p>
<p>Today, most developers (at least web developers) don&#8217;t write computer science-y stuff all day long. We solve real world problems, read documentation, build scalable systems, cooperate (social skills are vital!), implementing other people&#8217;s code, and more. Quizzes are fine, as long as they are relevant for the actual work I am going to do.</p>
<p>(Also: see 37signals job listing for an interface designer position some time ago, <a title="What Matters" href="http://johanbrook.com/life/37signals-what-matters/">I wrote about and linked to it</a>).</p>
<p><a href='http://johanbrook.com/development/hiring-developers-2012-style/' title='permalink'>★ Permalink</a></p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/development/hiring-developers-2012-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advice for university students: &#8220;I&#8217;m not as smart as I thought I was&#8221;</title>
		<link>http://www.reddit.com/r/confession/comments/nxdzz/im_not_as_smart_as_i_thought_i_was/c3d91jl</link>
		<comments>http://johanbrook.com/life/im-not-smart/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 12:54:31 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1059</guid>
		<description><![CDATA[The students that are successful look at that challenge, wrestle with feelings of inadequacy and stupidity, and begin to take steps hiking that mountain, knowing that bruised pride is a small price to pay for getting to see the view &#8230; <p class="right"><a class="read-more" href="http://johanbrook.com/life/im-not-smart/">Read more →</a></p><p><a href='http://johanbrook.com/life/im-not-smart/' title='permalink'>★ Permalink</a></p>
]]></description>
			<content:encoded><![CDATA[<blockquote><p>The students that are successful look at that challenge, wrestle with feelings of inadequacy and stupidity, and begin to take steps hiking that mountain, knowing that bruised pride is a small price to pay for getting to see the view from the top. They ask for help, they acknowledge their inadequacies. They don&#8217;t blame their lack of intelligence, they blame their lack of motivation.</p></blockquote>
<p>Great text from an MIT grad about the challenges and feelings during his freshman year at MIT. Many wise quotes.</p>
<p><a href='http://johanbrook.com/life/im-not-smart/' title='permalink'>★ Permalink</a></p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/life/im-not-smart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Measuring and sizing UIs, 2011-style</title>
		<link>http://csswizardry.com/2011/12/measuring-and-sizing-uis-2011-style/</link>
		<comments>http://johanbrook.com/design/css/measuring-sizing-uis-2011/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 18:00:28 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[em]]></category>
		<category><![CDATA[fluid]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[measures]]></category>
		<category><![CDATA[percentage]]></category>
		<category><![CDATA[px]]></category>
		<category><![CDATA[rem]]></category>
		<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://johanbrook.com/?p=1050</guid>
		<description><![CDATA[Harry Roberts (&#8220;CSS Wizardry&#8221;) wraps up the current state of measuring on the web, which I personally enjoyed reading about. I often dabble between doctrines when setting measures and sizes of type, margins, paddings, widths, etc. etc., and a concluding &#8230; <p class="right"><a class="read-more" href="http://johanbrook.com/design/css/measuring-sizing-uis-2011/">Read more →</a></p><p><a href='http://johanbrook.com/design/css/measuring-sizing-uis-2011/' title='permalink'>★ Permalink</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Harry Roberts (&#8220;CSS Wizardry&#8221;) wraps up the current state of measuring on the web, which I personally enjoyed reading about. I often dabble between doctrines when setting measures and sizes of type, margins, paddings, widths, etc. etc., and a concluding write-up was welcomed.</p>
<p><a href='http://johanbrook.com/design/css/measuring-sizing-uis-2011/' title='permalink'>★ Permalink</a></p>
]]></content:encoded>
			<wfw:commentRss>http://johanbrook.com/design/css/measuring-sizing-uis-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  johanbrook.com/feed/ ) in 0.25641 seconds, on Feb 24th, 2012 at 5:21 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 24th, 2012 at 6:21 am UTC -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- Quick Cache Is Fully Functional :-) ... A Quick Cache file was just served for (  johanbrook.com/feed/ ) in 0.00037 seconds, on Feb 24th, 2012 at 5:21 am UTC. -->
