<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Some notes]]></title>
  <link href="http://yoursite.com/atom.xml" rel="self"/>
  <link href="http://yoursite.com/"/>
  <updated>2012-01-08T22:52:39+01:00</updated>
  <id>http://yoursite.com/</id>
  <author>
    <name><![CDATA[fer]]></name>
    <email><![CDATA[fer@ferqwerty.com]]></email>
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Missing keybindings in Mac OS X Lion]]></title>
    <link href="http://yoursite.com/blog/2012/01/08/where-are-my-textmate-keybindings-in-lion/"/>
    <updated>2012-01-08T22:45:00+01:00</updated>
    <id>http://yoursite.com/blog/2012/01/08/where-are-my-textmate-keybindings-in-lion</id>
    <content type="html"><![CDATA[<p>I was used to have these keybindings in my Textmate installation in Snow Leopard and I was missing them in Lion.</p>

<p>Put this in /Users/<your_user>/Library/KeyBindings/DefaultKeyBinding.dict</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># cat /Users/fer/Library/KeyBindings/DefaultKeyBinding.dict 
</span><span class='line'>{
</span><span class='line'>/* home */
</span><span class='line'>"\UF729" = "moveToBeginningOfLine:";
</span><span class='line'>"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
</span><span class='line'>
</span><span class='line'>/* Cmd-Left */
</span><span class='line'>"@\UF702" = "moveToBeginningOfLine:";
</span><span class='line'>"$@\UF702" = "moveToBeginningOfLineAndModifySelection:";
</span><span class='line'>
</span><span class='line'>/* Cmd-Right */
</span><span class='line'>"@\UF703" = "moveToEndOfLine:";
</span><span class='line'>"$@\UF703" = "moveToEndOfLineAndModifySelection:";
</span><span class='line'>
</span><span class='line'>/* end */
</span><span class='line'>"\UF72B" = "moveToEndOfLine:";
</span><span class='line'>"$\UF72B" = "moveToEndOfLineAndModifySelection:";
</span><span class='line'>
</span><span class='line'>/* page up/down */
</span><span class='line'>"\UF72C" = "pageUp:";
</span><span class='line'>"\UF72D" = "pageDown:";
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Installing OctoPress]]></title>
    <link href="http://yoursite.com/blog/2011/11/24/installing-octopress/"/>
    <updated>2011-11-24T00:34:00+01:00</updated>
    <id>http://yoursite.com/blog/2011/11/24/installing-octopress</id>
    <content type="html"><![CDATA[<h3>Installing Octopress</h3>

<p>Octopress is a framework designed by Brandon Mathis for Jekyll, the blog aware static site generator powering Github Pages. To start blogging with Jekyll, you have to write your own HTML templates, CSS, Javascripts and set up your configuration. But with Octopress All of that is already taken care of. Simply clone or fork Octopress, install dependencies and the theme, and you’re set.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git clone git://github.com/imathis/octopress.git ; cd octopress
</span><span class='line'>gem install bundler rake --no-rdoc --no-ri
</span><span class='line'>bundle install
</span><span class='line'>bundle exec rake install</span></code></pre></td></tr></table></div></figure>


<p>Here you have some clues to start blogging:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>bundle exec rake new_post["title"]
</span><span class='line'>bundle exec rake new_page["title"]
</span><span class='line'>bundle exec rake generate
</span><span class='line'>bundle exec rake watch
</span><span class='line'>bundle exec rake preview</span></code></pre></td></tr></table></div></figure>




<!--
* Remove public folder
* Point DNS
- Add pic
-->


<!--
Migrate also de DB by adding this in your 

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># In your Gemfile
</span><span class='line'>group :production do
</span><span class='line'>  gem 'pg'
</span><span class='line'>end
</span><span class='line'>group :development, :test do
</span><span class='line'>  gem 'sqlite3'
</span><span class='line'>end</span></code></pre></td></tr></table></div></figure>

And run this afterwards. This will save you from installing postgresql natively in your system ;)

<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'>bundle install without production # And forget any other plan</span></code></pre></td></tr></table></div></figure>

And now, setup 

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>heroku console
</span><span class='line'>ENV['DATABASE_URL']
</span><span class='line'>"postgres://username:password@hostname/database"
</span><span class='line'># postgres://syhvqllmxm:QYkDdNcf7AXAbJsXOm9E@ec2-107-22-181-234.compute-1.amazonaws.com/syhvqllmxm</span></code></pre></td></tr></table></div></figure>

And the resulting database.yml:
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>production: 
</span><span class='line'>  encoding: unicode
</span><span class='line'>  adapter: postgresql
</span><span class='line'>  username: syhvqllmxm
</span><span class='line'>  port: 5432
</span><span class='line'>  host: ec2-107-22-181-234.compute-1.amazonaws.com
</span><span class='line'>  database: syhvqllmxm
</span><span class='line'>  password: QYkDdNcf7AXAbJsXOm9E
</span></code></pre></td></tr></table></div></figure>
&#8211;>




<!--
* https://gist.github.com/1280760
* http://daringfireball.net/projects/markdown/basics
* http://en.wikipedia.org/wiki/CNAME_record
* http://devcenter.heroku.com/articles/custom-domains
-->

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Install and deploy Rails apps easily in Mac OS X Lion]]></title>
    <link href="http://yoursite.com/blog/2011/11/19/install-and-deploy-rails-apps-easily-in-lion/"/>
    <updated>2011-11-19T14:06:00+01:00</updated>
    <id>http://yoursite.com/blog/2011/11/19/install-and-deploy-rails-apps-easily-in-lion</id>
    <content type="html"><![CDATA[<h4>Why Rails</h4>

<p>Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Control pattern.</p>

<p>This guide does not only involve installing ruby sucessfully in Lion. It also explains how to serve a whole project on the cloud easily.</p>

<p>Although all this might sound a little bit tough, this tutorial can be also followed as a step-by-step guide.</p>

<p>These are the instructions to install Ruby and Rails in your Lion system.</p>

<h4>Steps</h4>

<ul>
<li>Install XCode (it includes git and the rest of tool for compiling Ruby sources)</li>
<li>Install HomeBrew</li>
<li>Install Ruby through RVM</li>
<li>Create Rails App</li>
<li>Deployment to Heroku</li>
</ul>


<h3>Install HomeBrew</h3>

<p><a href="https://github.com/mxcl/homebrew/wiki/Installation">Homebrew</a> makes the installation of UNIX tools (or other occasional utilities that Apple didn’t include with OS X) easier than MacPorts or Fink.</p>

<p>Its installation is simple and avoids lots of manual and noisy installations of needed tools during development, e.g.: postgresql, imagemagick, etc):</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>mkdir -p /usr/local/Cellar # some homebrew fixes by doing this (https://github.com/mxcl/homebrew/wiki/installation)
</span><span class='line'>/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"</span></code></pre></td></tr></table></div></figure>


<h3>Install RVM</h3>

<p><a href="http://beginrescueend.com/">RVM</a> is a tool that makes it super easy to install, manage and work with multiple versions of Ruby, interpreters and sets of Gems.</p>

<p>Uh. And what the heck is &#8220;Gems&#8221;? <a href="http://rubygems.org/">Gems</a> is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (yep!, as Python has <a href="http://packages.python.org/distribute/easy_install.html">eggs</a>, as node.js uses <a href="http://npmjs.org/">npm</a>, or as PHP comes with <a href="http://pear.php.net/">PEAR</a>).</p>

<p>The gem command is used to build, upload, download, and install Gem packages.</p>

<p>With RVM you can have 1.8.7 and 1.9.2 live together without any issues. You can even swap back and forth from 1.8.7 to 1.9.2 as you see fit.</p>

<p>To install RVM in your system, run this:</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'>bash &lt; &lt;(curl -s https://rvm.beginrescueend.com/install/rvm)</span></code></pre></td></tr></table></div></figure>


<p>Now it&#8217;s time for echoing to .bash_profile our new environment and installing ruby:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' &gt;&gt; ~/.bash_profile
</span><span class='line'>source $HOME/.bash_profile
</span><span class='line'># Install ruby
</span><span class='line'>rvm install 1.9.2
</span><span class='line'>rvm use ruby-1.9.2
</span></code></pre></td></tr></table></div></figure>


<p>From now on, just refer RVM to the version of ruby you want to run:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rvm use ruby-1.9.2
</span><span class='line'>gem install rails      # Your friend from now on 
</span><span class='line'>gem install bundler    # Run bundle install inside your rails projects!
</span><span class='line'>gem install heroku     # Deployment 
</span><span class='line'>gem install taps       # Migrations on heroku</span></code></pre></td></tr></table></div></figure>


<p>Probably, this would be also a good moment to install some extra tools through brew:</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'>brew install ack wget curl redis memcached libmemcached colordiff imagemagick pg</span></code></pre></td></tr></table></div></figure>


<p>This remarkable package manager is written in Ruby too, which means you cam make your own homebrew formula (<a href="https://github.com/mxcl/homebrew/wiki/Formula-Cookbook">here</a> you have a hint on how to) in case you need a custom source for a specific package.</p>

<h3>Create your Rails App</h3>

<p>Let&#8217;s create an empty Rails project to play with. Just run in your terminal</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rvm use ruby-1.9.2
</span><span class='line'>
</span><span class='line'>cd $HOME/Desktop; rails new myproject
</span><span class='line'>cd myproject; rails s</span></code></pre></td></tr></table></div></figure>


<p>Now you should see something at <a href="http://localhost:3000">http://localhost:3000</a>!</p>

<h3>Deploying to Heroku</h3>

<p>If you don&#8217;t have an account yet, here you have some reasons to register then:</p>

<ul>
<li>It&#8217;s free in case you don&#8217;t need many resources</li>
<li>It&#8217;s suitable for small projects and demos. Check <a href="http://www.heroku.com/features">its features</a>.</li>
</ul>


<p>Get to your app path and run:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>bundle install
</span><span class='line'>git init
</span><span class='line'>git add .
</span><span class='line'>git commit -m "new app"  # To commit changes: git add . ; git commit -a -m "Fixed" ; git push</span></code></pre></td></tr></table></div></figure>


<p>Git uses SSH as its secure transport protocol. And Heroku uses Git, so you&#8217;ll need to generate a public SSH key
and upload it to Heroku. Some details are described in <a href="http://devcenter.heroku.com/articles/keys">this Heroku article</a>.</p>

<p>Time to deploy our app:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>heroku create ; git push master heroku 
</span><span class='line'># Check production logs with: heroku logs --tail 
</span><span class='line'>heroku open</span></code></pre></td></tr></table></div></figure>



]]></content>
  </entry>
  
</feed>

