<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>I’m a 21 year old web and app developer from the Netherlands.</description><title>Jacob Steringa</title><generator>Tumblr (3.0; @jacobsteringa)</generator><link>http://jacobsteringa.nl/</link><item><title>CSS layout gets smarter with calc()</title><description>&lt;a href="http://updates.html5rocks.com/2012/03/CSS-layout-gets-smarter-with-calc"&gt;CSS layout gets smarter with calc()&lt;/a&gt;: &lt;p&gt;&lt;a class="tumblr_blog" href="http://www.webkitbits.com/post/22263499449/css-layout-gets-smarter-with-calc"&gt;webkitbits&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Didn’t even know about this feature, but it’s brilliant. A quick idea of what you can do:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#bar { height: calc(10em + 3px); } &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And regarding current support:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The calc() property for lengths is available now in Chrome 19 (Dev channel build) by use of the ‘-webkit-calc’ property, in Firefox since version 8 using the ‘-moz-calc’ property and in Internet Explorer since version 9 unprefixed.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;</description><link>http://jacobsteringa.nl/post/22318785763</link><guid>http://jacobsteringa.nl/post/22318785763</guid><pubDate>Thu, 03 May 2012 09:22:39 -0400</pubDate></item><item><title>9-bits:

Verge forum user, Sputnik8, has posted a series of...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_m0mvcbdWZX1qz7ywoo1_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m0mvcbdWZX1qz7ywoo2_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://24.media.tumblr.com/tumblr_m0mvcbdWZX1qz7ywoo3_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;p&gt;&lt;a class="tumblr_blog" href="http://9-bits.com/post/19012928959/metro-windows-desktop-ui-concept"&gt;9-bits&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Verge forum user, &lt;a href="http://www.theverge.com/users/Sputnik8"&gt;Sputnik8&lt;/a&gt;, has posted a series of gorgeous UI concepts showing a &lt;a href="http://www.theverge.com/2012/2/24/2822891/windows-desktop-ui-concept"&gt;Metro-inspired Windows desktop&lt;/a&gt;. I’d be reaching out to this guy in a heartbeat if I were Microsoft.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If only Microsoft took this approach, I like it a lot more then Microsofts own Metro interface&lt;/p&gt;</description><link>http://jacobsteringa.nl/post/20167643330</link><guid>http://jacobsteringa.nl/post/20167643330</guid><pubDate>Fri, 30 Mar 2012 08:45:05 -0400</pubDate></item><item><title>Content-type mapping with Lithium</title><description>&lt;p&gt;Recently I started experimenting with Lithium, an awesome PHP framework. I really like it&amp;#8217;s style, as it uses many new features of PHP 5.3 which really can make your code a lot leaner.&lt;/p&gt;
&lt;p&gt;I wanted to return JSON in some occasions and Lithium has a neat feature on collections where you can call &lt;em&gt;-&amp;gt;to(&amp;#8216;json&amp;#8217;)&lt;/em&gt; on an result set. It works out of the box, but there is a problem with the formatting of the JSON. It looks like this:&lt;/p&gt;
&lt;pre&gt;{"1":{"id":"1","family_id":"2","family_position":"0","na....},{"id":"2","fami....}}&lt;/pre&gt;
&lt;p&gt;As you see, it is an object with objects in it. The desired result in my case is an array of objects, like this:&lt;/p&gt;
&lt;pre&gt;[{"id":"1","family_id":"2","family_position":"0","na....},{"id":"2","fami....}]&lt;/pre&gt;
&lt;p&gt;I started looking around the interwebs to find a solution. But I didn&amp;#8217;t find a satisfying answer in the Li3 manual, so I started to browse the API docs. The docs for the Media class, the class responsible for almost everything what has to do with content-types, gave me the answer right away.&lt;/p&gt;
&lt;p&gt;Within the file &lt;em&gt;config/bootstrap/media.php&lt;/em&gt; you can declare custom content-types and assign custom handlers. With that knowledge things got really easy. I knew that I could get the desired result if I manually altered the results in the controller, but that doesn&amp;#8217;t really adhere to the DRY principle. Declaring my own handler for the JSON format was the solution.&lt;/p&gt;
&lt;pre&gt;Media::type('json', 'application/json', array(
	'encode' =&amp;gt; function($data) {
		$result = array();
		
		foreach($data as $object) {
			$result[] = $object;
		}
		
		return json_encode($result);
	}
));
&lt;/pre&gt;
&lt;p&gt;This small snippet fixed my problem! I can now render JSON like this:&lt;/p&gt;
&lt;pre&gt;$this-&amp;gt;render(array('json' =&amp;gt; Projects::all()));&lt;/pre&gt;
&lt;p&gt;The cool thing about this feature is that it works for many more content-types, for instance &lt;em&gt;csv&lt;/em&gt;, like in the example in the Li3 API docs.&lt;/p&gt;</description><link>http://jacobsteringa.nl/post/15308434688</link><guid>http://jacobsteringa.nl/post/15308434688</guid><pubDate>Wed, 04 Jan 2012 16:25:00 -0500</pubDate><category>php</category><category>json</category></item><item><title>The el property in Backbone.js and events</title><description>&lt;p&gt;Today I found myself struggling with Backbone.js events. In this particular case I wanted a span element with the class &lt;em&gt;use&lt;/em&gt; to point to a router url. That shouldn&amp;#8217;t be that hard to do, but I couldn&amp;#8217;t get it to work.&lt;/p&gt;
&lt;p&gt;After a while I realized that I overwrote the el property with the template I used instead of adding it to the el property.&lt;/p&gt;
&lt;pre class="brush-javascript"&gt;render : function() {
	this.el = this.template( this.model.toJSON() );
	return this;
},
&lt;/pre&gt;
&lt;p&gt;When I added the the template to the &lt;em&gt;el&lt;/em&gt; property instead of making it the element, all of the sudden it worked.&lt;/p&gt;
&lt;pre class="brush-javascript"&gt;render : function() {
	$( this.el ).html( this.template( this.model.toJSON() ) );
	return this;
},
&lt;/pre&gt;
&lt;p&gt;Lesson learned: do not overwrite the &lt;em&gt;el&lt;/em&gt; property in your render method!&lt;/p&gt;</description><link>http://jacobsteringa.nl/post/14530272940</link><guid>http://jacobsteringa.nl/post/14530272940</guid><pubDate>Tue, 20 Dec 2011 17:49:00 -0500</pubDate><category>backbone.js</category><category>javascript</category></item></channel></rss>

