<?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>Yan Pritzker &#187; programming</title>
	<atom:link href="http://yanpritzker.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://yanpritzker.com</link>
	<description>photographer, entrepreneur, software engineer, musician, skier</description>
	<lastBuildDate>Thu, 26 Apr 2012 18:11:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel="next" href="http://yanpritzker.com/category/programming/feed/?page=2" />

		<item>
		<title>Convert rspec pending to xit with vim</title>
		<link>http://yanpritzker.com/2012/01/03/convert-rspec-pending-to-xit-with-vim/</link>
		<comments>http://yanpritzker.com/2012/01/03/convert-rspec-pending-to-xit-with-vim/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 17:52:31 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[rspec]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://yanpritzker.com/?p=434</guid>
		<description><![CDATA[RSpec has two ways of disabling tests: pending and xit. Except one of them is truly evil. Pending actually still runs the before block even when it&#8217;s disabled. This is bad when you have a test with a very expensive before block. Changing the pending to xit is a great strategy, but tedious. Vimscript to [...]]]></description>
			<content:encoded><![CDATA[<p>RSpec has two ways of disabling tests: pending and xit. Except one of them is truly evil. Pending actually still runs the before block even when it&#8217;s disabled. This is bad when you have a test with a very expensive before block. Changing the pending to xit is a great strategy, but tedious. Vimscript to the rescue! The functionality is available as part of my dotfiles repo, but you can just <a href="https://raw.github.com/skwp/dotfiles/master/vim/plugin/settings/rspec_pending_to_xit.vim">grab the script by itself</a> and type <em>,rxit</em> to use it on a file. </p>
<p>For more awesomeness, check out my dotfiles repo called <a href="http://github.com/skwp/dotfiles">YADR (Yet Another Dotfiles Repo)</a>, featuring 100% clean vimrc with all custom keymapping done in well factored scripts inside vim/plugin/settings, and a list of plugins perfectly tailored for Rails development, currently in alpha preview.</p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2012/01/03/convert-rspec-pending-to-xit-with-vim/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2012/01/03/convert-rspec-pending-to-xit-with-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learn to speak vim &#8211; verbs, nouns, and modifiers!</title>
		<link>http://yanpritzker.com/2011/12/16/learn-to-speak-vim-verbs-nouns-and-modifiers/</link>
		<comments>http://yanpritzker.com/2011/12/16/learn-to-speak-vim-verbs-nouns-and-modifiers/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 17:30:32 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://yanpritzker.com/?p=409</guid>
		<description><![CDATA[.vim strong { font-size: 120%; background: lightyellow; } .vim code { background: #eee; padding: 0.5em; margin-top:1em; display:block } Using vim is like talking to your editor in &#8216;verb modifier object&#8217; sentences, turned into acronyms learn some verbs: v (visual), c (change), d (delete), y (yank/copy). these are the most important. there are others learn some [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css" media="screen">
  .vim strong { font-size: 120%; background: lightyellow; }
  .vim code { background: #eee; padding: 0.5em; margin-top:1em; display:block }
</style>
<p>Using vim is like talking to your editor in &lsquo;verb modifier object&rsquo; sentences, turned into acronyms</p>
<ul class='vim'>
<li>learn some verbs: <strong>v</strong> (visual), <strong>c</strong> (change), <strong>d</strong> (delete), <strong>y</strong> (yank/copy). these are the most important. there are others</li>
<li>learn some modifiers: <strong>i</strong> (inside), <strong>a</strong> (around), <strong>t</strong> (till..finds a character), <strong>f</strong> (find..like till except including the char), <strong>/</strong> (search..find a string/regex)</li>
<li>learn some text objects: <strong>w</strong> (word), <strong>s</strong> (sentence) <strong>p</strong> (paragraph) <strong>b</strong> (block/parentheses), <strong>t</strong> (tag, works for html/xml) there are others</li>
</ul>
<p><strong>To move efficiently in vim,</strong> don&rsquo;t try to do anything by pressing keys many times, instead speak to the editor in sentences</p>
<ul>
<li>delete the current word: diw (delete inside word)</li>
<li>change current sentence: cis (change inside sentence)</li>
<li>change a string inside quotes: ci&rdquo; (change inside quote)</li>
<li>change until next occurrence of &#8216;foo&#8217;: c/foo (change search foo)</li>
<li>change everything from here to the letter X: ctX</li>
<li>visually select this paragraph: vap (visual around paragraph)</li>
</ul>
<p>If you understand the verbs and objects you&rsquo;re dealing with, you will soon realize that adding a new plugin and learning a new verb or noun exponentially increases your productivity, as you can now apply it in all the sentences you already know. It&rsquo;s just like learning a language. </p>
<h4>Let&#8217;s add some new text object plugins!</h4>
<ul>
<li>install surround.vim: <a href="https://github.com/tpope/vim-surround">vim-surround</a>- you get a new noun, the &lsquo;surround&rsquo; (s or S)
<ul>
<li>visually select a word and surround it with quotes: viwS&rdquo;</li>
<li>change surround from single quote to double quote: cs&rsquo;&rdquo;</li>
</ul>
</li>
<li>install <a href="https://github.com/nelstrom/vim-textobj-rubyblock" title="vim-textobj-rubyblock">vim-textobj-rubyblock</a> &#8211; you get a new noun, the &lsquo;ruby block&rsquo; (r)
<ul>
<li>delete current ruby block: dir (delete inside ruby block)</li>
<li>visually select a ruby function: var (visual around ruby block)</li>
<li>visually select the innards of a function: vir (visual inside ruby block)</li>
</ul>
</li>
<li>install <a href="https://github.com/tomtom/tcomment_vim">tComment</a> &#8211; new verb: &#8220;gc&#8221; (go comment)</li>
<ul>
<li>comment the current ruby method: gcar (go comment around ruby)</li>
</ul>
</ul>
<p>Now go out and learn a new verb or noun every day!</p>
<h4>Resources and Further Reading</h4>
<ul>
<li><a href="http://blog.carbonfive.com/2011/10/17/vim-text-objects-the-definitive-guide">Vim Text Objects, Definitive Guide</a>, a great blog post!</a></li>
<li>Want an exceptionally curated collection of the best plugins vim has to offer? Check out an early beta preview of my <a href="http://github.com/skwp/dotfiles">fully modularized vim/dotfile setup called YADR (Yet Another Dotfile Repo)</a> which includes text object plugins for ruby blocks(r), indents(i), dates(da/df), function arguments(a), and ruby symbols(:)</li>
</ul>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2011/12/16/learn-to-speak-vim-verbs-nouns-and-modifiers/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2011/12/16/learn-to-speak-vim-verbs-nouns-and-modifiers/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Vim demystified: ten commands you can start using today</title>
		<link>http://yanpritzker.com/2011/11/30/vim-demystified-ten-commands-you-can-start-using-today/</link>
		<comments>http://yanpritzker.com/2011/11/30/vim-demystified-ten-commands-you-can-start-using-today/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 15:01:38 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[productivity]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://yanpritzker.com/?p=375</guid>
		<description><![CDATA[.vimtable { text-align: left; width: 600px; border: 1px solid #aaa; margin-bottom: 1em } .vimtable td,th { padding: 1em; } .vimtable tr td {border-bottom: 1px solid #ddd } .vimtable tr.last td { border-bottom: none} .vimtable td.first { font-weight: bold; font-size: 120%; } .vimtable strong { font-size: 120%; background: lightyellow; } .vimtable tr.warning td { background: #ffffcc; [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css" media="screen">
  .vimtable { text-align: left; width: 600px; border: 1px solid #aaa; margin-bottom: 1em }
  .vimtable td,th { padding: 1em; }
  .vimtable tr td {border-bottom: 1px solid #ddd  }
  .vimtable tr.last td { border-bottom: none}
  .vimtable td.first { font-weight: bold; font-size: 120%; }
  .vimtable strong { font-size: 120%; background: lightyellow; }
  .vimtable tr.warning td { background: #ffffcc; color: #1E1E1A}
  .vimtable code { background: #eee; padding: 0.5em; margin-top:1em; display:block }
</style>
<p>These commands are not only extremely useful but also mnemonic and easy to learn for a huge payoff in keystroke savings. These are the common compound commands I use every day, and I think it&#8217;s easier to dive in this way than to try to learn vim key by key. </p>
<table class="vimtable">
<tr class='warning'>
<td colspan='100%'>Read Me First! <a href='http://dailyvim.blogspot.com/2008/04/ways-to-avoid-esc-key.html'>Save your wrists, stop using ESC in vim</a></td>
</tr>
<tr>
<td class="first">yaw</td>
<td>
    <strong>y</strong>ank <strong>a</strong>round <strong>w</strong>ord &#8211; copy the current word, no matter where your cursor is inside the word</p>
</td>
</tr>
<tr>
<td class="first">ci&#8221;</td>
<td><strong>c</strong>hange <strong>i</strong>nside quote (or any other enclosure). Example: <strong>ci(</strong> to change something surrounded by parentheses. But what&#8217;s <em>really cool</em> is that you can invoke this from anywhere inside a line of code, so even if the string you want to change is far away, typing <strong>ci&#8221;</strong> will put your right inside the string, ready to change it.</td>
</tr>
<tr>
<td class="first">ctX</td>
<td>
      <strong>c</strong>hange <strong>t</strong>ill <strong>X</strong> (any character); and in general the use of <strong>tX</strong> where X is any character, to move to that character. You can combine the motion with another command such as <strong>dtX</strong> (delete till X), <strong>ytX</strong> (yank till X), or <strong>vtX</strong> (visually select till X).</p>
</td>
</tr>
<tr>
<td class="first">gf</td>
<td>
<p>      <strong>g</strong>o to <strong>f</strong>ile &#8211; open the file under the cursor (useful for traversing file references inside codebases)
    </td>
</tr>
<tr>
<td class="first">* (Shift-8)</td>
<td>Takes you to the next occurrance of the word you&#8217;re currently looking at (often the best way to navigate to the definition of a method, if witin the same file)</td>
</tr>
<tr>
<td class="first">Ctrl-6</td>
<td>Jumps you back to the previous file you were editing. I use this so often I remapped it to just the capital letter Z:<br />
      <code> nnoremap &lt;silent&gt; Z &lt;C-^&gt;</code>
    </td>
</tr>
<tr>
<td class="first">Ctrl-]</td>
<td>
<p>
        Again, immensly useful for traversing codebases, this command relies on exuberant ctags (<a href="http://www.thegeekstuff.com/2009/04/ctags-taglist-vi-vim-editor-as-sourece-code-browser/">set up ctags</a>) to take you to method and class definitions. I remap this to simply leader capital <strong>F</strong>:
      </p>
<p>      <code>nnoremap &lt;silent&gt; <leader>F &lt;C-]&gt;</code></p>
<p>
        I believe all highly used commands should be a single letter, as close as possible to home row.
    </p>
</td>
</tr>
<td class="first">mX<br/>&#8216;X</td>
<td>
<p>
        You can bookmark a file very quickly by using <strong>m</strong> plus any capital letter. Then to go back to the file at any time, hit <strong>&#8216;</strong> and the same letter again.
      </p>
</td>
<tr class='warning'>
<td colspan='100%'>The commands in this section are based on custom aliases. Please check that the alias doesn&#8217;t overload a key you&#8217;re used to.</td>
</tr>
<tr>
<td class="first">K</td>
<td>
      For super fast code navigation, nothing beats the <A href="https://github.com/tjennings/git-grep-vim">git grep </a>plugin combined with an alias to grep the <strong>K</strong>urrent word under the cursor:</p>
<p>          <code>nnoremap &lt;silent&gt; K :GitGrep &lt;cword&gt;&lt;CR&gt;</code>
    </td>
</tr>
<tr>
<td class="first">vv<br/>ss</td>
<td>
      Splitting windows is a common and every day task, so you shouldn&#8217;t spend extra time typing to do so. Just double tap <strong>vv</strong> or <strong>ss</strong>:<br />
      <code>nnoremap &lt;silent&gt; vv &lt;C-w&gt;v<br/>nnoremap &lt;silent&gt; ss &lt;C-w&gt;s</code>
    </td>
</tr>
<tr class='last'>
<td class="first">Window navigation using J,K,I,M</td>
<td><em>Bonus:</em> A very common task for which the default key bindings involve way too many keystrokes. Use directional style keys to move between windows:<br />
      <code>nnoremap &lt;silent&gt; H &lt;C-w&gt;h<br />
      nnoremap &lt;silent&gt; L &lt;C-w&gt;l<br />
      nnoremap &lt;silent&gt; I &lt;C-w&gt;k<br />
      nnoremap &lt;silent&gt; M &lt;C-w&gt;j</code>
    </td>
</tr>
</table>
<div style='background:#eee; width:600px; margin-top:1em; margin-bottom:1em'>
<p style='margin: 1em;'>
If you liked this post, you might want to watch <a href="http://github.com/skwp/dotfiles">my dotfiles repo on github</a>. My dotfiles follow a keystroke minimizing principle where all common tools are only a few characters long, and are in the process of being cleaned up in order to release as a product targeting keystroke saving enthusiasts (this is especially important for those concerned with RSI prevention).
</p>
</div>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2011/11/30/vim-demystified-ten-commands-you-can-start-using-today/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2011/11/30/vim-demystified-ten-commands-you-can-start-using-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The next high level language</title>
		<link>http://yanpritzker.com/2008/03/27/the-next-high-level-language/</link>
		<comments>http://yanpritzker.com/2008/03/27/the-next-high-level-language/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 18:16:54 +0000</pubDate>
		<dc:creator>yan</dc:creator>
				<category><![CDATA[languages]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[thoughts]]></category>

		<guid isPermaLink="false">http://skwpspace.com/2008/03/27/the-next-high-level-language/</guid>
		<description><![CDATA[When we used low level languages like assembly, we had to care about how the computer performed every step of our operations. With the advent of mid level languages like C, we no longer cared about registers, but we still had to know how memory was managed. With the higher level languages (Java, Ruby, Smalltalk, [...]]]></description>
			<content:encoded><![CDATA[<p>When we used low level languages like assembly, we had to care about how the computer performed every step of our operations. With the advent of mid level languages like C, we no longer cared about registers, but we still had to know how memory was managed. With the higher level languages (Java, Ruby, Smalltalk, Lisp) and object oriented, functional, and event driven programming, we don&#8217;t care as much about how the work gets done, but program closer to the problem domain. As we create sets of objects that are more and more complex, we crate libraries and platforms. On these platforms, we create web applications.</p>
<p>Now we&#8217;re mashing up web applications themselves, creating more and more complex applications by building on top of existing APIs. As the register was to assembler, the array to C, and the object to Smalltalk/Java/Ruby, the web API is now a building block of the platform called the Internet. So what will the next high level language look like? We will no longer concern ourselves with objects, but rather services. Standardization&#8211;whether in the form of microformats and loosely defined service ontologies or the true semantic web with all its rdf madness&#8211;will bring power to this platform. </p>
<p>The code we write tomorrow will create web applications and new services with just a few lines of code which integrate services from all over the web. We&#8217;ll be able to register event callbacks not just across our local objects, but across web services themselves. Call it Web Oriented Programming.</p>
<p>Here&#8217;s a little implementation of a Facebook driven buddy-beacon type of system in this fantasy language.</p>
<pre>
at_url("/map_my_friends") do
  @map = Google.render_map(:center => 'Chicago, IL') do |map|
    map.add_data(:source => Facebook.get_friends.locations)
    map.add_data(:source => Yelp.my_favorite_places)
    map.add_data(:source => Planypus.my_plans)
  end

  Facebook.on_update(:attribute => :location) |user|
    @map.alert("#{user.login} has changed his location")
    @map.show_at_coordinates(user, user.location)
  end
end
</pre>
<p>This isn&#8217;t too far from what&#8217;s possible today, and most of today&#8217;s ugly implementation details deal with glue code and translation between the languages of different services.  The development of a standardized ontology will get us a long way toward having one-liner service integration. </p>
<p>Now&#8230;let&#8217;s make it happen.</p>
<div class="plus-one-wrap"><g:plusone href="http://yanpritzker.com/2008/03/27/the-next-high-level-language/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://yanpritzker.com/2008/03/27/the-next-high-level-language/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

