Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

444 lines (252 sloc) 14.629 kb
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Mr. Casals</title>
<meta name="author" content="Marc Riera">
<meta name="description" content="I&#8217;m a big fan of Spotify. I use it everyday, I pay my monthly fee to get rid of
those annoying ads (I don&#8217;t know what ads do people get &hellip;">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://mrcasals.github.com">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="/javascripts/ender.js"></script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<link href="/atom.xml" rel="alternate" title="Mr. Casals" type="application/atom+xml">
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
</head>
<body >
<header role="banner"><hgroup>
<h1><a href="/">Mr. Casals</a></h1>
<h2>Probably the worst blog name ever</h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:mrcasals.github.com" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/04/11/my-first-octopress-plugin-spotify-play-button/">My First Octopress Plugin: Spotify Play Button</a></h1>
<p class="meta">
<time datetime="2012-04-11T18:02:00+02:00" pubdate data-updated="true">Apr 11<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p>I&#8217;m a big fan of Spotify. I use it everyday, I pay my monthly fee to get rid of
those annoying ads (I don&#8217;t know what ads do people get in other countries, but
Spanish ones are really annoying&#8230; <em>really</em>). I was really happy when they
launched their <a href="https://developer.spotify.com/technologies/web-api/">Metadata API</a>, but <a href="http://www.spotify.com/se/blog/archives/2012/04/11/introducing-the-spotify-play-button/">today&#8217;s
announcement</a> is even better.</p>
<h2>Embed Spotify everywhere&#8230; even Octopress!</h2>
<p>Spotify&#8217;s new feature <a href="https://developer.spotify.com/technologies/spotify-play-button/">Play Button</a> lets you embed a single track,
an album or a playlist to any web page, giving you the possibility to put a
soundtrack anywhere. So I decided to make an Octopress plugin for this. You can
find <a href="https://github.com/mrcasals/octopress_spotify_play_plugin">its source on GitHub</a>.</p>
<p>The plugin is pretty simple. You have to use the <code>spotify</code> liquid tag and, as
param, one of the following examples.</p>
<p>In the next release it will let you specify the height and the width of the
widget. I hope it won&#8217;t take very long :)</p>
<h3>A single track</h3>
<p>Example input:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>spotify spotify:track:4vVE8YDntxjT0gld4bdd4x</span></code></pre></td></tr></table></div></figure>
<p>Example output:</p>
<div class='spotify_play_button'>
<iframe src='https://embed.spotify.com/?uri=spotify:track:4vVE8YDntxjT0gld4bdd4x ' width='300' height='380' frameborder='0' allowtransparency='true'></iframe>
</div>
<h3>An album</h3>
<p>Example input:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>spotify spotify:album:2B9q4KPjOEYu885Keo9dfX</span></code></pre></td></tr></table></div></figure>
<p>Example output:</p>
<div class='spotify_play_button'>
<iframe src='https://embed.spotify.com/?uri=spotify:album:2B9q4KPjOEYu885Keo9dfX ' width='300' height='380' frameborder='0' allowtransparency='true'></iframe>
</div>
<h3>A playlist</h3>
<p>Example input:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>spotify spotify:user:mrc2407:playlist:1O9JUUKiMqA8LXahz61fCH</span></code></pre></td></tr></table></div></figure>
<p>Example output:</p>
<div class='spotify_play_button'>
<iframe src='https://embed.spotify.com/?uri=spotify:user:mrc2407:playlist:1O9JUUKiMqA8LXahz61fCH ' width='300' height='380' frameborder='0' allowtransparency='true'></iframe>
</div>
<h3>Some independent tracks</h3>
<p>Example input:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>spotify spotify:trackset:PREFEREDTITLE:5Z7ygHQo02SUrFmcgpwsKW,1x6ACsKV4UdWS2FMuPFUiT,4bi73jCM02fMpkI11Lqmfe</span></code></pre></td></tr></table></div></figure>
<p>Example output:</p>
<div class='spotify_play_button'>
<iframe src='https://embed.spotify.com/?uri=spotify:trackset:PREFEREDTITLE:2fdMAIsNH4wY7RRda8aCfL,4ik6sbfwyVd9QoU3nUHvKI ' width='300' height='380' frameborder='0' allowtransparency='true'></iframe>
</div>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/02/27/approach-to-datamapper/">An Approach to DataMapper, an Alternative to ActiveRecord</a></h1>
<p class="meta">
<time datetime="2012-02-27T17:47:00+01:00" pubdate data-updated="true">Feb 27<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p><strong>Note</strong>: <em>I published this post for the first time at the <a href="http://blog.codegram.com/2011/11/datamapper-an-alternative-to-activerecord">Codegram blog</a>, so this is just a repost :)</em></p>
<p>A few days ago we started a new project at Codegram. The project (which is still in development) is a good challenge for us and a real motivator: we all were tired of using always the same technologies, so we decided to use some tools we hadn&#8217;t had opportunity to use. One of them is <a href="http://datamapper.org"><strong>DataMapper</strong></a>.</p>
<h2>So what is DataMapper and why using it?</h2>
<blockquote><p>DataMapper is an Object Relational Mapper written in Ruby. The goal is to create an ORM which is fast, thread-safe and feature rich.</p><footer><strong>DataMapper.org</strong> <cite><a href='http://datamapper.org'>datamapper.org/&hellip;</a></cite></footer></blockquote>
<blockquote><p>Datamapper is an object-relational mapper library written in Ruby and commonly used with Merb. It was developed to address perceived shortcomings in Ruby on Rails&#8217; ActiveRecord library.</p><footer><strong>Wikipedia</strong> <cite><a href='http://en.wikipedia.org/wiki/Datamapper'>en.wikipedia.org/wiki/&hellip;</a></cite></footer></blockquote>
<p>So, as the Wikipedia article says, DataMapper is an alternative to ActiveRecord. So why using it instead of the default ActiveRecord?</p>
<ul>
<li>No need to write structural migrations</li>
<li>Scoped relations</li>
<li>Lazy loading on certain attribute types</li>
<li>Strategic eager loading</li>
<li>Default support for composite and natural keys</li>
</ul>
<p>As you can see, DataMapper has some really interesting features. This post will be a little introduction to this ORM, let&#8217;s see some of them.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2012/02/27/approach-to-datamapper/">Read on &rarr;</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2012/02/26/back-online/">Back Online!</a></h1>
<p class="meta">
<time datetime="2012-02-26T18:07:00+01:00" pubdate data-updated="true">Feb 26<span>th</span>, 2012</time>
</p>
</header>
<div class="entry-content"><p>It&#8217;s been really long since the last time I wrote a post. A lot of things have
happened since: I started the second semester at university, I got angry with
the educational model they&#8217;re using there and I&#8217;m trying to change it. I started
organizing the <a href="http://baruco.org/">Barcelona Ruby Conference 2012 (BaRuCo)</a> (which looks
amazing, I must say) with the people at <a href="http://codegram.com/">Codegram</a>. I improved my
VIm knowledge. I learned about design patterns and became kind of obsessed with
them. I got an Android smartphone. And I found myself with the need of a place
where to talk about all those things.</p>
<p>But sometimes it&#8217;s better to get rid of everything to start again instead of
trying to keep something alive. That&#8217;s what I did with the blog: I had one, but
I didn&#8217;t use it. Now I find myself with the need of a place to save my thoughts
and things I do&#8230; But I couldn&#8217;t use the older blog. It was too unupdated and I
screwed the repo at some point, so I just deleted it and created a new one.</p>
<p>I don&#8217;t need a change, I just need to start again. That&#8217;s why I&#8217;m still using
<a href="http://octopress.org/">Octopress</a>. Besides, Octopress has implemented some nice features
since the last time I took a look at it, such as separating plugins into their
own system or linked posts, which are still in beta (but I&#8217;d love to see them
merged in master). Oh, and I just love writing posts with Markdown and VIm :)</p>
<p>The only drawback I find using Octopress is the lack of themes. I just can&#8217;t
stand another blog with this layout. Too mainstream, I&#8217;d say. So I&#8217;ll try to
create my own layout for this blog, which will be a funny challenge because I&#8217;ll
have to design something useful <em>from zero to hero</em> and take a look at Octopress
templating system (about which I could not find any docs&#8230; shame on you!).</p>
<p>I&#8217;m also thinking about taking a look at Octopress&#8217; plugins system, which looks
quite nice and easy to work with. I&#8217;ve already got a plugin in mind related to
Spotify and it will take me to create a gem to work with its API, so three
things in one :)</p>
<p>PS: this reminds me that I have to do a cleanup to me GitHub account&#8230; So much
stupid repos there.</p>
</div>
</article>
<div class="pagination">
<a href="/blog/archives">Blog Archives</a>
</div>
</div>
<aside class="sidebar">
<section>
<h1>Recent Posts</h1>
<ul id="recent_posts">
<li class="post">
<a href="/blog/2012/04/11/my-first-octopress-plugin-spotify-play-button/">My first Octopress plugin: Spotify Play button</a>
</li>
<li class="post">
<a href="/blog/2012/02/27/approach-to-datamapper/">An approach to DataMapper, an alternative to ActiveRecord</a>
</li>
<li class="post">
<a href="/blog/2012/02/26/back-online/">Back online!</a>
</li>
</ul>
</section>
<section>
<h1>GitHub Repos</h1>
<ul id="gh_repos">
<li class="loading">Status updating&#8230;</li>
</ul>
<a href="https://github.com/mrcasals">@mrcasals</a> on GitHub
<script type="text/javascript">
$.domReady(function(){
if (!window.jXHR){
var jxhr = document.createElement('script');
jxhr.type = 'text/javascript';
jxhr.src = '/javascripts/libs/jXHR.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(jxhr, s);
}
github.showRepos({
user: 'mrcasals',
count: 0,
skip_forks: true,
target: '#gh_repos'
});
});
</script>
<script src="/javascripts/github.js" type="text/javascript"> </script>
</section>
<section>
<h1>Latest Tweets</h1>
<ul id="tweets">
<li class="loading">Status updating&#8230;</li>
</ul>
<script type="text/javascript">
$.domReady(function(){
getTwitterFeed("mrcasals", 4, false);
});
</script>
<script src="/javascripts/twitter.js" type="text/javascript"> </script>
<a href="http://twitter.com/mrcasals" class="twitter-follow-button" data-show-count="false">Follow @mrcasals</a>
</section>
</aside>
</div>
</div>
<footer role="contentinfo"><p>
Copyright &copy; 2012 - Marc Riera -
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
</p>
</footer>
<script type="text/javascript">
var disqus_shortname = 'mrcasalsoctopressgithub';
var disqus_script = 'count.js';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
<script type="text/javascript">
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.