<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>A Simple Matter of Programming - Home</title>
  <id>tag:asimplematterofprogramming.com,2007:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.7.3">Mephisto Noh-Varr</generator>
  <link href="http://asimplematterofprogramming.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://asimplematterofprogramming.com/" rel="alternate" type="text/html"/>
  <updated>2007-11-28T02:50:05Z</updated>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-11-28:18</id>
    <published>2007-11-28T02:46:00Z</published>
    <updated>2007-11-28T02:50:05Z</updated>
    <link href="http://asimplematterofprogramming.com/2007/11/28/textmate-haml-indentation" rel="alternate" type="text/html"/>
    <title>TextMate Haml Indentation</title>
<content type="html">
            &lt;p&gt;TextMate has this clever feature where when you paste something, it is adjusted to the same indentation as the preceding text. This works wonderfully in languages like Ruby that have block ending delimiters. However, in certain languages (Haml, Sass, Yaml, Python), you indicate the end of a logical block by indentation alone. The result is that when you copy and paste code, the indentation feature is more often wrong than it is right.&lt;/p&gt;


	&lt;p&gt;You can turn off the indentation feature from the preferences pane, but then you lose a useful feature when using languages like Ruby. TextMate also provides a Paste Without Re-Indent feature, but it&#8217;s rather a pain to type Ctrl+Cmd+V every time I want to paste. My solution was to make a macro which calls Paste Without Re-Indent, and map it to Cmd+V in Haml and Yaml files. The macro is available for &lt;a href=&quot;http://dotjerky.com/svn/shared/trunk/textmate_extensions/Fix%20Pasting%20in%20Haml.tmMacro&quot;&gt;download&lt;/a&gt;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-08-01:17</id>
    <published>2007-08-01T03:42:00Z</published>
    <updated>2007-08-01T03:48:02Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/8/1/sword-in-ruby" rel="alternate" type="text/html"/>
    <title>SWORD in Ruby</title>
<content type="html">
            &lt;p&gt;On a number of occasions, I&#8217;ve played around with manipulating the text of the Bible in Ruby. Tonight, for the first time, I did it the correct and obvious way, and was successful.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;require 'rubygems'
require 'inline'
class Bible
  inline(:C) do |builder|
    builder.include '&amp;lt;swmgr&gt;'
    builder.add_compile_flags '-x c++', '-lstdc++', '-I/opt/local/include/sword', '-L/opt/local/lib', '-lsword'
    builder.prefix %{
      using namespace sword;
    }
    builder.c %{
      char * text(char * ref) {
        SWMgr mgr = SWMgr();
        SWModule *kjv = mgr.getModule(&quot;KJV&quot;);
        kjv-&gt;setKey(ref);
        return kjv-&gt;RenderText();
      }
    }
  end
end
puts Bible.new.text(&quot;jn 3:16&quot;).gsub(/&amp;lt;[^&gt;]*&gt;/, '')&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You need to &lt;code&gt;sudo port install sword sword-bible-kjv&lt;/code&gt; first. This is going to be useful.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-06-17:15</id>
    <published>2007-06-17T01:36:00Z</published>
    <updated>2007-08-01T03:53:35Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/6/17/navigation" rel="alternate" type="text/html"/>
    <title>Navigation</title>
<content type="html">
            Navigation is kind of a big deal. It&#8217;s one of the few things we still sigh about when we think back to the days when we used Java and Eclipse. I don&#8217;t know if anyone is doing anything about it. Like most tool support, a much simpler solution than Eclipse could get you 90% of the value. Today I had an idea about how to approach navigation, and I think it rather a good one. Look at this:
&lt;pre&gt;&lt;code&gt;dotjerky$ related app/controllers/products_controller.rb 
app/controllers/products_controller.rb (31)
test/functional/products_controller_test.rb (28)
app/models/product.rb (18)
app/views/products/index.rhtml (18)
test/unit/product_test.rb (16)
app/views/products/_form.rhtml (15)
db/schema.rb (15)
app/models/image.rb (14)
app/models/user.rb (14)
app/views/products/show.rhtml (14)
app/views/layouts/site_layout.rhtml (14)
test/fixtures/products.yml (14)
app/helpers/products_helper.rb (14)
test/fixtures/taggings.yml (14)
... ... ...&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This was accomplished with about 10 minutes of Ruby hacking and a few calls to subversion. It basically looks up which files tend to get committed at the same time as the given file, which means that it has no dependency on the language or framework used. Performance is a problem, accessing all that history, so I need to figure out some sort of cache. Otherwise, it&#8217;s a simple matter of slapping a &lt;span class=&quot;caps&quot;&gt;GUI&lt;/span&gt; on this thing and hooking it into TextMate.&lt;/p&gt;


	&lt;p&gt;It seems like you could do some really cool stuff with line numbers too, like showing snippets of code from other files that were modified at the same time. That would be quite a bit more work though, and probably more annoying when it showed the wrong thing.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-06-01:14</id>
    <published>2007-06-01T00:55:00Z</published>
    <updated>2007-08-01T03:53:55Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/6/1/the-naming-of-the-beasts" rel="alternate" type="text/html"/>
    <title>The Naming of the Beasts</title>
<content type="html">
            &lt;p&gt;It&#8217;s said that naming things is one of the more difficult aspects of programming. Lately, it hasn&#8217;t been as much of a problem for me as it used to be. Ruby doesn&#8217;t make you have as many classes to name as Java does. And when you really get to know Ruby, you figure out that local variables are basically useless too, which makes for even less things to name. But there&#8217;s still the matter of has_many :through models in Rails, which almost always feel contrived.&lt;/p&gt;


	&lt;p&gt;Suppose we were to invent a language for naming things. You could start with more or less English vocabulary, I suppose, but you would change things.&lt;/p&gt;


	&lt;p&gt;First of all, you would want it to be highly inflected in useful sorts of ways. Temporal inflection (past tense, etc) would have to be replaced with something more useful to computer time, with an eye toward the conceptual complexity of thread management. Plurality would stay mostly the same, but you would add another inflection for collections of things (singular words for pluralities, which are ad hoc in English).&lt;/p&gt;


Also, I tend to care a lot about how things lay out spatially. I like my code to line up in two dimensions. Sometimes I even make pictures and diagrams in my code (in a very abstract sense). The English language has a bit of serendipity here:
&lt;pre&gt;&lt;code&gt;dx = [other.right - left, other.left - right].map(&#38;:abs).min
dy = [other.bottom - top, other.top - bottom].map(&#38;:abs).min&lt;/code&gt;&lt;/pre&gt;
On the other hand, you have the absurd imbalance of the ultimate dichotomy, true and false. Our hypothetical language, then, would insist that all words in a semantic set have the same number of letters, so that things will line up.

	&lt;p&gt;But I think the greatest significance of a new language would be to remove the inhibition to making up words. There are thousands of concepts that don&#8217;t have good names even outside of programming (see The Meaning of Liff). The original intent, as I understand it, of Christopher Alexander&#8217;s &lt;em&gt;design patterns&lt;/em&gt; was not to put together a toolbox of design techniques, but to put together a &lt;em&gt;pattern language&lt;/em&gt; for discussing and understanding design, as it is done by designers.&lt;/p&gt;


	&lt;p&gt;I tried to use design patterns in Java, and they never really felt right. I think most of the Java patterns, converted to Ruby, end up being a block. Just a block. Consequently, my attitude toward design patterns has been that they were standard hacks around limitations of the language. You don&#8217;t hear a lot about patterns in Ruby land.&lt;/p&gt;


	&lt;p&gt;I think we lost something when patterns became prescriptive rather than descriptive. I would expect that there are some very abstract practices in Ruby that would be worth naming, if we thought about it. It&#8217;s much easier to codify things in Ruby than in Java, so it may be that certain libraries are actually living design patterns. But there&#8217;s plenty of difference between really good Ruby code and really bad Ruby code, and I think we could describe the difference, and it&#8217;s usually more than just a missing library.&lt;/p&gt;


	&lt;p&gt;A better language helps you to think better thoughts. At some point the programming language itself is no longer the bottleneck, and innovation has to happen elsewhere. I&#8217;m not really sure what the right approach is here&#8212;I&#8217;d hate to decrease the accessibility of programming. But I&#8217;m proud to be in the only field I know of that has this problem. We are the only sons of Adam who carry on the tradition of the naming of the beasts.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-05-18:13</id>
    <published>2007-05-18T04:05:00Z</published>
    <updated>2007-08-01T03:54:25Z</updated>
    <link href="http://asimplematterofprogramming.com/2007/5/18/sanity" rel="alternate" type="text/html"/>
    <title>Sanity</title>
<content type="html">
            If you have two Ruby thread that are making calls to standard out at the same time, they will be interleaved. Try it:
&lt;pre&gt;&lt;code&gt;Thread.new {puts 1, 2, 3}; puts 1, 2, 3&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Now, if you happen to have some other &lt;em&gt;native&lt;/em&gt; thread out there, and it happens to be calling CoreAudio APIs, and the main Ruby thread happens to print more things than the other Ruby thread, the other native thread inexplicably gets into an infinite loop and pegs the &lt;span class=&quot;caps&quot;&gt;CPU&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;I kid you not.&lt;/p&gt;


	&lt;p&gt;It dies peacefully if the main Ruby thread finishes. Otherwise it requires a force quit. If the secondary Ruby thread prints more than the main thread, it has no effect. And it is clearly the number of objects printed, not the amount of data.&lt;/p&gt;


	&lt;p&gt;In some cases, the behavior will wait until after a gets, if there is one. This seems to depend on how many Ruby threads there are, and sometimes on whether there is a second gets (which is, of course, impossible).&lt;/p&gt;


	&lt;p&gt;It seems like there&#8217;s a race condition on access to standard out, but I can&#8217;t imagine what CoreAudio has to do with it. CoreMidi APIs have no effect. And it doesn&#8217;t have any business touching standard out. It may have something to do with thread scheduling, and the fact that the CoreAudio calls access the high speed timer. But CoreAudio could be a red herring.&lt;/p&gt;


	&lt;p&gt;Any help?&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-04-16:12</id>
    <published>2007-04-16T02:44:00Z</published>
    <updated>2007-08-01T03:55:01Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/4/16/homeschool-fixtures" rel="alternate" type="text/html"/>
    <title>Homeschool Fixtures</title>
<content type="html">
            &lt;pre&gt;&lt;code&gt;homeschool_fixtures :posts, :comments, :users
def test_comment
  post :create, :post_id =&gt; the_post(:user =&gt; some_user).id, :comment =&gt; {:text =&gt; 'hi'}
  assert_equal last_comment, the_post.comments.last
  assert_equal some_user, last_comment.moderator
end&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;There are no supporting fixture definitions anywhere. It&#8217;s wicked-awesome in practice. Everything is right there.&lt;/p&gt;


	&lt;p&gt;It was a late innovation on a recent project, so I don&#8217;t know much about the performance impact of doing things this way. On the one hand, it&#8217;s more dynamic, which is usually means slower, but on the other hand, you don&#8217;t have to load anything you don&#8217;t need, so it might be faster. To have any chance at good performance, you would want to use this method consistently, turn off the yaml features, and do appropriate &lt;span class=&quot;caps&quot;&gt;DELETE&lt;/span&gt; FROMs in between tests (we were using blank yml files to get that effect, but that&#8217;s bad).&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-04-02:11</id>
    <published>2007-04-02T21:32:00Z</published>
    <updated>2007-04-03T23:09:50Z</updated>
    <link href="http://asimplematterofprogramming.com/2007/4/2/jester" rel="alternate" type="text/html"/>
    <title>Jester</title>
<content type="html">
            &lt;p&gt;It was bound to happen. &lt;a href=&quot;http://giantrobots.thoughtbot.com/2007/4/2/jester-javascriptian-rest&quot;&gt;Jester&lt;/a&gt; allows you to consume &lt;span class=&quot;caps&quot;&gt;REST&lt;/span&gt; APIs, a la ActiveResource, in Javascript. I think the Rails community is slowly moving toward more data-oriented &lt;span class=&quot;caps&quot;&gt;AJAX&lt;/span&gt;, and I heartily approve.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-03-01:10</id>
    <published>2007-03-01T05:05:00Z</published>
    <updated>2007-03-01T05:34:55Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/3/1/fast_dnd" rel="alternate" type="text/html"/>
    <title>fast_dnd</title>
<content type="html">
            &lt;p&gt;The &lt;a href=&quot;http://script.aculo.us&quot;&gt;Script.aculo.us&lt;/a&gt; drag and drop code is really very nice. Unfortunately, it starts to slow down when you have more than 30 droppables on the page. I thought it would be fun to do something about that, so &lt;a href=&quot;http://dotjerky.com/svn/shared/trunk/fast_dnd/fast_dnd.js&quot;&gt;I did&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;This is one of the few times I&#8217;ve ever been able to directly apply any of the knowledge I&#8217;ve accumulated about how game engines work. Drag and drop is just a &lt;a href=&quot;http://en.wikipedia.org/wiki/Collision_detection&quot;&gt;collision detection&lt;/a&gt; problem, and &lt;a href=&quot;http://en.wikipedia.org/wiki/Spatial_index&quot;&gt;spatial indexing&lt;/a&gt; is a very simple way to optimize it.&lt;/p&gt;


	&lt;p&gt;In general I consider my experiment to be a success. The test file is noticeably more responsive when using the optimization. I do wish that it didn&#8217;t have to rebuild the entire index so often, or at least that the rebuild could be run in a thread, but we&#8217;re up against the limitations of the browser.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-02-26:8</id>
    <published>2007-02-26T20:29:00Z</published>
    <updated>2007-08-01T03:57:26Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/2/26/dom_id" rel="alternate" type="text/html"/>
    <title>#dom_id</title>
<content type="html">
            &lt;pre&gt;&lt;code&gt;class ActiveRecord::Base
  def dom_ids
    @dom_ids ||= Hash.new
  end

  def dom_id(*suffixes)
    name = suffixes.empty? ? 'element' : suffixes.collect(&#38;:to_s).join('_')
    dom_ids[name] = [self.class.name.underscore, self.id, *suffixes].compact.join('_')
  end
end&lt;/code&gt;&lt;/pre&gt;

I like it. It takes the idea of &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; id generation from Sails and makes it more universal. Example usage:
&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;fieldset&lt;/span&gt; &lt;span class=&quot;an&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;lt;%= @object.dom_id %&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;er&quot;&gt;&amp;gt;&lt;/span&gt;&amp;quot;&lt;span class=&quot;er&quot;&gt;&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;legend&lt;/span&gt; &lt;span class=&quot;an&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;lt;%= @object.dom_id :title %&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;er&quot;&gt;&amp;gt;&lt;/span&gt;&amp;quot;&lt;span class=&quot;er&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;%=h @object.title %&amp;gt;&lt;/span&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;/legend&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  ...&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;new ClientSideController(&lt;span class=&quot;c&quot;&gt;&amp;lt;%= @object.dom_ids.to_json %&amp;gt;&lt;/span&gt;)&lt;span class=&quot;ta&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-02-20:6</id>
    <published>2007-02-20T05:11:00Z</published>
    <updated>2007-08-01T03:55:58Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/2/20/lsub" rel="alternate" type="text/html"/>
    <title>lsub</title>
<content type="html">
            &lt;pre&gt;&lt;code&gt;#!/usr/bin/env ruby
pattern, replace = *ARGV
regexp = Regexp.new(pattern)
until $stdin.eof?
  line = $stdin.readline
  $stdout.print(line.sub(regexp, replace)) if line.match(regexp)
end&lt;/code&gt;&lt;/pre&gt;

Which you might use this way:
&lt;pre&gt;&lt;code&gt;#!/bin/bash
svn st | lsub &quot;^\?\s+(.*)$&quot; &quot;\1&quot;&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-02-16:5</id>
    <published>2007-02-16T03:43:00Z</published>
    <updated>2007-02-16T03:52:14Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/2/16/fore" rel="alternate" type="text/html"/>
    <title>Fore!</title>
<content type="html">
            &lt;pre&gt;&lt;code&gt;script/plugin install http://dotjerky.com/svn/shared/trunk/plugins/javascript_routes&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;It even has tests.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-02-15:4</id>
    <published>2007-02-15T02:59:00Z</published>
    <updated>2007-08-01T03:56:43Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/2/15/routes-js" rel="alternate" type="text/html"/>
    <title>routes.js</title>
<content type="html">
            &lt;p&gt;Once upon a time there was a web framework in Java called Sails. It was pretty much a knock-off of Rails, and it was pretty much the best Java code ever written (whatever that means). All of us who worked hard on Sails (all two of us) are now programming Rails full-time and loving it. Well, mostly loving it.&lt;/p&gt;


	&lt;p&gt;We still miss parts of Sails. Parts of it were better (better!) than Rails. I&#8217;m not kidding. We still talk about Sails Components. Sails Components were amazing. We wrote like three of them. They were a late innovation on the last Sails project ever. But they were awesome.&lt;/p&gt;


	&lt;p&gt;Basically you bundled together related Java, Javascript, &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;, and template code and it all got wired up automatically. The files were included in the right spots. The ajax callbacks were defined in javascript for you. The &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; elements were already found for you, and they always had unique and meaningful ids. Data got converted to &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt; and passed to the client for free, and could be sent back as context with your ajax request for a nickel. It was beautiful. But the structure it provided for heavy scripting was even better than the automation.&lt;/p&gt;


	&lt;p&gt;In Rails, now, we have this &lt;span class=&quot;caps&quot;&gt;RJS&lt;/span&gt; thing. It&#8217;s alright, I suppose. It does encourage you to be light on scripting, which might be considered a good thing. It doesn&#8217;t embrace the web the way &lt;span class=&quot;caps&quot;&gt;REST&lt;/span&gt; does, which is a bit concerning. And you couldn&#8217;t do anything with it if you didn&#8217;t depend on the javascript libraries, which are heavy scripting themselves&amp;mdash;heavier for being stand-alone the way they are.&lt;/p&gt;


	&lt;p&gt;I think that if we implemented something similar to Sails Components in Rails, we would find the Sails approach to be superior for highly dynamic pages and widgets, and that &lt;span class=&quot;caps&quot;&gt;RJS&lt;/span&gt; still has its place on simpler screens.&lt;/p&gt;


	&lt;p&gt;Anyway, I was hacking around with routes and came up with something comparable to the ajax magic in Sails. This much works:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;Routes.someObjectUrl(24);
// =&gt; '/someObject/24'

Routes.someObjectUrl(24, {_method: 'delete'});
// =&gt; '/someObject/24?_method=delete'&lt;/code&gt;&lt;/pre&gt;

It would probably be better to return a Url object so you can do things like this:
&lt;pre&gt;&lt;code&gt;Routes.someObjectUrl(24).send({onSuccess: this.callback.bind(this)});&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-01-16:3</id>
    <published>2007-01-16T02:50:00Z</published>
    <updated>2007-02-02T01:30:44Z</updated>
    <category term="Hardware"/>
    <link href="http://asimplematterofprogramming.com/2007/1/16/iphone" rel="alternate" type="text/html"/>
    <title>iPhone</title>
<content type="html">
            &lt;p&gt;I really thought it was going to be a pocket Mac. It ran &lt;span class=&quot;caps&quot;&gt;OS X&lt;/span&gt;, after all. But then Mr. Steve Jobs (who is a lying liar) told us that it wouldn&#8217;t be running any third-party software. It really is just an iPod, a phone, and an internet communicator, like he said. But we all know that it&#8217;s actually an iPod nano, a Cingular-exclusive phone, and a 2.5G internet communicator. I will be buying the OpenMoko phone instead.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2007-01-02:2</id>
    <published>2007-01-02T21:33:00Z</published>
    <updated>2007-01-02T23:31:13Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2007/1/2/desktop-hack" rel="alternate" type="text/html"/>
    <title>Desktop hack</title>
<content type="html">
            &lt;code&gt;
mv ~/Desktop ~/OldDesktop &#38;&#38; ln -s ~ ~/Desktop
&lt;/code&gt;

	&lt;p&gt;Log out and back in.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://asimplematterofprogramming.com/">
    <author>
      <name>dotjerky</name>
    </author>
    <id>tag:asimplematterofprogramming.com,2006-12-22:1</id>
    <published>2006-12-22T22:45:00Z</published>
    <updated>2007-08-01T03:56:20Z</updated>
    <category term="Code"/>
    <link href="http://asimplematterofprogramming.com/2006/12/22/javascript-macros" rel="alternate" type="text/html"/>
    <title>Javascript macros</title>
<content type="html">
            &lt;pre&gt;&lt;code&gt;function get(symbol) {
  return function(target) {
    return target[symbol];
  }
}
function set(symbol, value) {
  return function(target) {
    return target[symbol] = value;
  }
}&lt;/code&gt;&lt;/pre&gt;
Thus:
&lt;pre&gt;&lt;code&gt;disableUnchecked: function() {
 this.checkboxes.reject(get('checked')).each(set('disabled', true));
}&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
</feed>
