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

  <title><![CDATA[Development Tips]]></title>
  <link href="http://vigodome.com/atom.xml" rel="self"/>
  <link href="http://vigodome.com/"/>
  <updated>2012-01-28T00:23:31+02:00</updated>
  <id>http://vigodome.com/</id>
  <author>
    <name><![CDATA[Uğur Özyılmazel]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Show free memory on OSX]]></title>
    <link href="http://vigodome.com/blog/2012/01/27/show-free-memory-on-osx/"/>
    <updated>2012-01-27T20:03:00+02:00</updated>
    <id>http://vigodome.com/blog/2012/01/27/show-free-memory-on-osx</id>
    <content type="html"><![CDATA[<p>I was looking for <a href="http://www.ubuntu.com/">Ubuntu</a>&#8217;s <code>free</code> command for osx lion. I googled it as usual.
I&#8217;ve seen that, there was a command called <code>alloc</code> and it is not available at the moment.
I decided to write my own script in <a href="http://ruby-lang.org/" title="A programmer's best friend">Ruby</a>.</p>

<p>This is almost my first Ruby attempt! (<em>I wrote in Python</em>)</p>

<p>Based on &#8220;Activity Monitor.app&#8221; on OS X, used memory is a sum of:</p>

<ul>
<li>Wired</li>
<li>Active</li>
<li>Inactive</li>
</ul>


<p>memories. I managed to find out installed memory via <code>sysctl -n hw.memsize</code>. Here is the
script that i wrote:</p>

<div><script src='https://gist.github.com/1690045.js?file=free-memory.rb'></script>
<noscript><pre><code>#!/usr/bin/env ruby
# encoding: utf-8

# By Uğur Özyılmazel, @vigobronx | @ugurozyilmazel
# http://vigodome.com | http://ugur.ozyilmazel.com | http://github.com/vigo

def get_paged_memory_usage(match_string, paging=4096)
  mvar = 3
  if match_string.split(/[^\w]/).length &gt; 1
    mvar = 4
  end
  paged_val = `vm_stat | grep &quot;Pages #{match_string}:&quot; | awk '{ print $#{mvar}}'`.to_i
  gigabyte_val = (paged_val * paging) / 1024 / 1024 / 1000.0
end

installed_memory = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 1000.0
total_consumed = 0
['wired down', 'active', 'inactive'].each { |key| total_consumed += get_paged_memory_usage(key) }
printf(&quot;%.2fG&quot;, (installed_memory-total_consumed)) # returns in gigabytes
</code></pre></noscript></div>


<p>I embedded it to my prompt shell aka <code>$PS1</code>. I&#8217;ve checked and compared the results via
<code>htop</code> and <code>top</code> commands. I get the same exac values. Due to OSX Lion, memory goes wild!!!.
Especially <a href="http://www.mozilla.org/en-US/firefox/" title="Firefox web browser">Firefox</a> leeches it abnormally. This little script kinda warns me that
it is time to restart Firefox or close it for a while!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to fix TM substitution]]></title>
    <link href="http://vigodome.com/blog/2012/01/14/how-to-fix-tm-substitution/"/>
    <updated>2012-01-14T15:10:00+02:00</updated>
    <id>http://vigodome.com/blog/2012/01/14/how-to-fix-tm-substitution</id>
    <content type="html"><![CDATA[<p>I was adding some custom <code>TM_</code> variables to <a href="http://macromates.com" title="TextMate: The Missing Editor">TextMate</a>. As you know,
variable name always starts with <strong>TM_</strong> letters. I had some funny moments but
i figured it out (<em>I mean remembered</em>).</p>

<p>To fix this, you must un-check TM option at <strong>System Preferences</strong> &gt; <strong>Language &amp; Text</strong></p>

<div class="flash-video">
    <div>
        <iframe src="http://www.screenr.com/embed/KJPs" width="650" height="396" frameborder="0"></iframe>
    </div>
</div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Changing TextMate's comment out behavior for CSS scope]]></title>
    <link href="http://vigodome.com/blog/2012/01/12/changing-textmates-comment-out-behavior/"/>
    <updated>2012-01-12T10:28:00+02:00</updated>
    <id>http://vigodome.com/blog/2012/01/12/changing-textmates-comment-out-behavior</id>
    <content type="html"><![CDATA[<p>Block commenting is very annoying most of the times while writing CSS. It is
not working like the other scopes (<em>Python, JavaScript</em>).</p>

<!-- more -->


<p>As you know, when you comment out a block in CSS it looks like this:</p>

<figure class='code'><figcaption><span>Block commented out CSS Snippet 1  </span></figcaption>
 <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='css'><span class='line'><span class="c">/*.test {</span>
</span><span class='line'><span class="c">    border: 1px solid #000;</span>
</span><span class='line'><span class="c">    color: #f0f;</span>
</span><span class='line'><span class="c">    margin: 0;</span>
</span><span class='line'><span class="c">}*/</span>
</span></code></pre></td></tr></table></div></figure>


<p>Pain starts when you want to undo or comment/un-comment quickly. You need to
select precisely and need to fix lines and breaks. It is not easy as Python
or JavaScript.</p>

<p>I would be better, if i can turn block commenting to this:</p>

<figure class='code'><figcaption><span>Block commented out CSS Snippet 2  </span></figcaption>
 <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='css'><span class='line'><span class="c">/*.test {*/</span>
</span><span class='line'><span class="c">/*    border: 1px solid #000;*/</span>
</span><span class='line'><span class="c">/*    color: #f0f;*/</span>
</span><span class='line'><span class="c">/*    margin: 0;*/</span>
</span><span class='line'><span class="c">/*}*/</span>
</span></code></pre></td></tr></table></div></figure>


<p>Open <code>Bundles</code> > <code>Bundle Editor</code> and choose <code>CSS</code> > <code>Comments</code> and add these lines:</p>

<pre><code>{   name = 'TM_COMMENT_MODE';
    value = 'line';
},
</code></pre>

<p><img src="http://f.cl.ly/items/1A1F1g073j1W1B211P15/css-prefs-fix.png" title="TextMate Bundle Editor" alt="TextMate Bundle Editor"></p>

<p>Now it turns to this (8</p>

<div class="flash-video">
    <div>
        <iframe src="http://www.screenr.com/embed/3MPs" width="650" height="396" frameborder="0"></iframe>
    </div>
</div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Change default shell, use new Bash which is installed from Homebrew]]></title>
    <link href="http://vigodome.com/blog/2011/12/30/change-default-shell/"/>
    <updated>2011-12-30T11:52:00+02:00</updated>
    <id>http://vigodome.com/blog/2011/12/30/change-default-shell</id>
    <content type="html"><![CDATA[<p>Do to lack of <strong>Associative Arrays</strong> in Bash (<em>Version &lt; 3</em>) i decided to
install <code>bash</code> from <a href="http://mxcl.github.com/homebrew/" title="Homebrew">Homebrew</a>.</p>

<pre><code>brew install bash
</code></pre>

<p>After installation, you must set
your new bash <strong>as default bash</strong> in to your system. Homebrew installs bash to</p>

<pre><code>/usr/local/bin/
</code></pre>

<!-- more -->


<p>If you wish to check your current bash version, just <code>echo</code> these variables:</p>

<pre><code>echo $BASH_VERSION # gives full version
echo $BASH_VERSINFO # gives major version number
</code></pre>

<p>We will use <code>chsh</code> command to proceed but before that, we must add this
new bash location in to <code>/etc/shells</code>. Otherwise, system will alert an error.
Now, lets edit file:</p>

<pre><code>sudo nano /etc/shells
</code></pre>

<p>add this line at the end of the list:</p>

<pre><code>/usr/local/bin/bash
</code></pre>

<p>Now, we can run <code>chsh</code> command:</p>

<pre><code>chsh -s /usr/local/bin/bash YOUR_USER_NAME
</code></pre>

<p>Enter your password to proceed. Now you can restart Terminal.app and check
if the installation is correct:</p>

<pre><code>echo $BASH_VERSION
</code></pre>

<p>Now you can define:</p>

<figure class='code'><figcaption><span>Associative Array Declaration requires BASH version 4 or higher</span></figcaption><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='bash'><span class='line'><span class="nb">declare</span> -A MY_ARRAY
</span></code></pre></td></tr></table></div></figure>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Show categories and post count in Octopress]]></title>
    <link href="http://vigodome.com/blog/2011/12/22/show-categories-and-post-count-in-octopress/"/>
    <updated>2011-12-22T11:17:00+02:00</updated>
    <id>http://vigodome.com/blog/2011/12/22/show-categories-and-post-count-in-octopress</id>
    <content type="html"><![CDATA[<p>Wouldn&#8217;t it be great to have <strong>Categories</strong> page in <a href="http://octopress.org/" title="Octopress: A blogging framework for hackers!">Octopress</a>?
If so, create a new page for Categories:</p>

<figure class='code'><figcaption><span>New Octopress page</span></figcaption><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='bash'><span class='line'>rake new_page<span class="o">[</span>blog/categories<span class="o">]</span>
</span></code></pre></td></tr></table></div></figure>


<!-- more -->


<p>Open <code>blog/categories/index.markdown</code> and insert this snippet:</p>

<figure class='code'><figcaption><span>Categories  </span></figcaption>
 <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='django'><span class='line'><span class="x">&lt;ul&gt;</span>
</span><span class='line'><span class="cp">{%</span> <span class="k">for</span> <span class="nv">item</span> <span class="k">in</span> <span class="nv">site.categories</span> <span class="cp">%}</span><span class="x"></span>
</span><span class='line'><span class="x">    &lt;li&gt;&lt;a href=&quot;/blog/categories/</span><span class="cp">{{</span> <span class="nv">item</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="cp">}}</span><span class="x">/&quot;&gt;</span><span class="cp">{{</span> <span class="nv">item</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">|</span> <span class="nf">capitalize</span> <span class="cp">}}</span><span class="x">&lt;/a&gt; [ </span><span class="cp">{{</span> <span class="nv">item</span><span class="o">[</span><span class="m">1</span><span class="o">]</span><span class="nv">.size</span> <span class="cp">}}</span><span class="x"> ]&lt;/li&gt;</span>
</span><span class='line'><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span><span class="x"></span>
</span><span class='line'><span class="x">&lt;/ul&gt;</span>
</span></code></pre></td></tr></table></div></figure>


<p>If you like to see the result, check out my <a href="http://vigodome.com/blog/categories/" title="Categories">Categories page</a>.</p>

<p>For the record, thanks to <a href="http://jimpravetz.com/" title="Jim Pravetz">Jim Pravetz</a> for the <a href="http://jimpravetz.com/blog/2011/12/inserting-liquid-syntax-into-octopress-codeblock/">Liquid Syntax tip</a>.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[TextMate : Show files beginning with dot]]></title>
    <link href="http://vigodome.com/blog/2011/12/22/textmate-show-files-beginning-with-dot/"/>
    <updated>2011-12-22T10:14:00+02:00</updated>
    <id>http://vigodome.com/blog/2011/12/22/textmate-show-files-beginning-with-dot</id>
    <content type="html"><![CDATA[<p>I was checking some files related to <a href="http://www.sinatrarb.com/">Sinatra</a> yesterday and noticed
that <a href="http://macromates.com" title="TextMate: The Missing Editor">TextMate</a> is not showing files which are started with
<code>.</code> character. Like <code>.autotest</code> <code>.rspec</code>. After a quick googling, found
Wil Linssen&#8217;s <a href="http://wil-linssen.com/entry/getting-hidden-files-to-appear-in-the-textmate-project-drawer/">web site</a>.</p>

<!-- more -->


<p>Just go to ></p>

<p>Preferences > Advanced > <strong>Folder References</strong> and change the pattern to:</p>

<pre><code>!(/\.(?!.)[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
</code></pre>

<p>After making this, I noticed that, <code>.DS_Store</code> files are shown too! I did a
quick fix to this, just changed to:</p>

<pre><code>!(/\.(?!.)[^/]*|\.(tmproj|o|pyc|DS_Store)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
</code></pre>

<p><img src="http://f.cl.ly/items/1Y0I183S1d3h2N2v0Q2W/TextMate%20-%20Show%20files%20start%20with%20dot.png" title="TextMate shows files beginning with dot" alt="TextMate screenshot"></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Hello World]]></title>
    <link href="http://vigodome.com/blog/2011/12/18/hello-world/"/>
    <updated>2011-12-18T17:54:00+02:00</updated>
    <id>http://vigodome.com/blog/2011/12/18/hello-world</id>
    <content type="html"><![CDATA[<p>Normally I blog in Turkish, which is my native language. From now on, I&#8217;ll
try to keep it simple and post as much as I can about my development interests
in English with this lovely blogging engine called: <a href="http://octopress.org/" title="Octopress: A blogging framework for hackers!">Octopress</a>.</p>

<!-- more -->


<p>I&#8217;m a <a href="http://python.org" title="Python">Python</a> / <a href="https://www.djangoproject.com/" title="Django Project">Django</a> developer. I&#8217;m building web
application. I&#8217;ve seen many tweets about Octopress, especially developers was
telling that how Octopress is flexible for posting code examples and snippets.</p>

<h3>Yes It is true!</h3>

<p>It is insanely true that Octopress is a great and simple blogging engine for
developers. Its written in Ruby. If you are familiar to the Ruby world like
<a href="http://www.sinatrarb.com/">Sinata</a>, <a href="https://github.com/mojombo/jekyll" title="Jekyll is a blog-aware, static site generator in Ruby">Jekyll</a>, <a href="http://sass-lang.com/">Sass</a>, <a href="http://www.yaml.org/">Yaml</a> everthing
will be easier than.</p>

<p>Don&#8217;t worry, you really don&#8217;t need to know any of those terms. Just read and
follow the steps which is mentioned in the <a href="http://octopress.org/docs/">Octopress Docs</a>.</p>

<p>I just did few tweaks to customize my own website. Also, i rapidly created a
TextMate bundle too. Check out <a href="https://github.com/vigo/textmate-octopress.tmbundle">Octopress TextMate Bundle</a>.</p>

<h2>My Version of Octopress</h2>

<p>I&#8217;ve added another layout called: <code>plain</code>. Normally, you need to:</p>

<figure class='code'><figcaption><span>Create New Page</span></figcaption><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='bash'><span class='line'>rake new_page<span class="o">[</span>filename<span class="o">]</span>
</span></code></pre></td></tr></table></div></figure>


<p>Right now, if you pass second parameter, which is <code>is_plane_page</code>, creates
<strong>plain page layout</strong>.</p>

<figure class='code'><figcaption><span>Create New Plain Page</span></figcaption><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='bash'><span class='line'>rake new_page<span class="o">[</span>filename,true<span class="o">]</span>
</span></code></pre></td></tr></table></div></figure>


<p>This creates:</p>

<figure class='code'><figcaption><span>Plain Page Layout  </span></figcaption>
 <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>
</pre></td><td class='code'><pre><code class='text'><span class='line'>---
</span><span class='line'>layout: plain
</span><span class='line'>title: &quot;[page title]&quot;
</span><span class='line'>comments: false
</span><span class='line'>sharing: false
</span><span class='line'>footer: false
</span><span class='line'>author:
</span><span class='line'>asides: [asides/recent_posts.html, asides/twitter.html, asides/github.html]
</span><span class='line'>---
</span></code></pre></td></tr></table></div></figure>


<p>I&#8217;ve just duplicated the file <code>source/_layouts/page.html</code> and created
<code>plain.html</code>:</p>

<figure class='code'><figcaption><span>My Custom Layout html (octopress-layout-plain.html)</span> <a href='http://vigodome.com/downloads/code/octopress-layout-plain.html'>download</a></figcaption>
 <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>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
</pre></td><td class='code'><pre><code class='html'><span class='line'>---
</span><span class='line'>layout: default
</span><span class='line'>---
</span><span class='line'>
</span><span class='line'><span class="nt">&lt;div&gt;</span>
</span><span class='line'><span class="nt">&lt;article</span> <span class="na">role=</span><span class="s">&quot;article&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>  {% if page.title %}
</span><span class='line'>  <span class="nt">&lt;header&gt;</span>
</span><span class='line'>    <span class="nt">&lt;h1</span> <span class="na">class=</span><span class="s">&quot;entry-title&quot;</span><span class="nt">&gt;</span>{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}<span class="nt">&lt;/h1&gt;</span>
</span><span class='line'>    {% if page.date %}<span class="nt">&lt;p</span> <span class="na">class=</span><span class="s">&quot;meta&quot;</span><span class="nt">&gt;</span>{% include post/date.html %}{{ time }}<span class="nt">&lt;/p&gt;</span>{% endif %}
</span><span class='line'>  <span class="nt">&lt;/header&gt;</span>
</span><span class='line'>  {% endif %}
</span><span class='line'>  {{ content }}
</span><span class='line'>  {% unless page.footer == false %}
</span><span class='line'>    <span class="nt">&lt;footer&gt;</span>
</span><span class='line'>      {% if page.date or page.author %}<span class="nt">&lt;p</span> <span class="na">class=</span><span class="s">&quot;meta&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>        {% if page.author %}{% include post/author.html %}{% endif %}
</span><span class='line'>        {% include post/date.html %}{% if updated %}{{ updated }}{% else %}{{ time }}{% endif %}
</span><span class='line'>        {% if page.categories %}{% include post/categories.html %}{% endif %}
</span><span class='line'>      <span class="nt">&lt;/p&gt;</span>{% endif %}
</span><span class='line'>      {% unless page.sharing == false %}
</span><span class='line'>        {% include post/sharing.html %}
</span><span class='line'>      {% endunless %}
</span><span class='line'>    <span class="nt">&lt;/footer&gt;</span>
</span><span class='line'>  {% endunless %}
</span><span class='line'><span class="nt">&lt;/article&gt;</span>
</span><span class='line'>{% if site.disqus_short_name and page.comments == true %}
</span><span class='line'>  <span class="nt">&lt;section&gt;</span>
</span><span class='line'>    <span class="nt">&lt;h1&gt;</span>Comments<span class="nt">&lt;/h1&gt;</span>
</span><span class='line'>    <span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">&quot;disqus_thread&quot;</span> <span class="na">aria-live=</span><span class="s">&quot;polite&quot;</span><span class="nt">&gt;</span>{% include post/disqus_thread.html %}<span class="nt">&lt;/div&gt;</span>
</span><span class='line'>  <span class="nt">&lt;/section&gt;</span>
</span><span class='line'>{% endif %}
</span><span class='line'><span class="nt">&lt;/div&gt;</span>
</span><span class='line'>{% unless page.sidebar == false %}
</span><span class='line'>    {% unless page.asides == false %}
</span><span class='line'>    <span class="nt">&lt;aside</span> <span class="na">class=</span><span class="s">&quot;sidebar&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>        {% include_array asides %}
</span><span class='line'>    <span class="nt">&lt;/aside&gt;</span>
</span><span class='line'>    {% endunless %}
</span><span class='line'>{% endunless %}
</span></code></pre></td></tr></table></div></figure>


<p>If you check <code>line 35</code>, you&#8217;ll see the <code>page.asides</code> variable. My plain page
layout allows you to add page based asides. Now you can change asides in every
page you like to.</p>

<p>Here is my <code>Rakefile</code> tweak, just did this small change:</p>

<figure class='code'><figcaption><span>My Custom Rakefile  diff (octopress-layout-plain-Rakefile.diff)</span> <a href='http://vigodome.com/downloads/code/octopress-layout-plain-Rakefile.diff'>download</a></figcaption>
 <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>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
<span class='line-number'>38</span>
<span class='line-number'>39</span>
<span class='line-number'>40</span>
<span class='line-number'>41</span>
<span class='line-number'>42</span>
<span class='line-number'>43</span>
</pre></td><td class='code'><pre><code class='diff'><span class='line'><span class="gd">--- Rakefile    2011-12-21 23:35:10.000000000 +0200</span>
</span><span class='line'><span class="gi">+++ Rakefile-mine    2011-12-21 23:34:18.000000000 +0200</span>
</span><span class='line'><span class="gu">@@ -1,8 +1,9 @@</span>
</span><span class='line'> # usage rake new_page[my-new-page] or rake new_page[my-new-page.html] or rake new_page (defaults to &quot;new-page.markdown&quot;)
</span><span class='line'><span class="gd">-desc &quot;Create a new page in #{source_dir}/(filename)/index.#{new_page_ext}&quot;</span>
</span><span class='line'><span class="gd">-task :new_page, :filename do |t, args|</span>
</span><span class='line'><span class="gi">+desc &quot;Create a new page (or plain page) in #{source_dir}/(filename)/index.#{new_page_ext}&quot;</span>
</span><span class='line'><span class="gi">+task :new_page, :filename, :is_plane_page do |t, args|</span>
</span><span class='line'>   raise &quot;### You haven&#39;t set anything up yet. First run `rake install` to set up an Octopress theme.&quot; unless File.directory?(source_dir)
</span><span class='line'>   args.with_defaults(:filename =&gt; &#39;new-page&#39;)
</span><span class='line'><span class="gi">+  args.with_defaults(:is_plane_page =&gt; &#39;&#39;)</span>
</span><span class='line'>   page_dir = [source_dir]
</span><span class='line'>   if args.filename.downcase =~ /(^.+\/)?(.+)/
</span><span class='line'>     filename, dot, extension = $2.rpartition(&#39;.&#39;).reject(&amp;:empty?)         # Get filename and extension
</span><span class='line'><span class="gu">@@ -24,12 +25,22 @@</span>
</span><span class='line'>     puts &quot;Creating new page: #{file}&quot;
</span><span class='line'>     open(file, &#39;w&#39;) do |page|
</span><span class='line'>       page.puts &quot;---&quot;
</span><span class='line'><span class="gd">-      page.puts &quot;layout: page&quot;</span>
</span><span class='line'><span class="gd">-      page.puts &quot;title: \&quot;#{title}\&quot;&quot;</span>
</span><span class='line'><span class="gd">-      page.puts &quot;date: #{Time.now.strftime(&#39;%Y-%m-%d %H:%M&#39;)}&quot;</span>
</span><span class='line'><span class="gd">-      page.puts &quot;comments: true&quot;</span>
</span><span class='line'><span class="gd">-      page.puts &quot;sharing: true&quot;</span>
</span><span class='line'><span class="gd">-      page.puts &quot;footer: true&quot;</span>
</span><span class='line'><span class="gi">+      if args.is_plane_page.length &gt; 0</span>
</span><span class='line'><span class="gi">+        page.puts &quot;layout: plain&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;title: \&quot;#{title}\&quot;&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;comments: false&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;sharing: false&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;footer: false&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;sidebar:&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;asides:&quot;</span>
</span><span class='line'><span class="gi">+      else</span>
</span><span class='line'><span class="gi">+        page.puts &quot;layout: page&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;title: \&quot;#{title}\&quot;&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;date: #{Time.now.strftime(&#39;%Y-%m-%d %H:%M&#39;)}&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;comments: true&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;sharing: true&quot;</span>
</span><span class='line'><span class="gi">+        page.puts &quot;footer: true&quot;</span>
</span><span class='line'><span class="gi">+      end</span>
</span><span class='line'>       page.puts &quot;---&quot;
</span><span class='line'>     end
</span><span class='line'>   else
</span></code></pre></td></tr></table></div></figure>


<p>Well, my next plan is to find out how to add language/locale support for date
object. Month names, day names and all the other string based things are
need to be customizable via <code>_config.yml</code> (<em>I belive</em>)</p>
]]></content>
  </entry>
  
</feed>

