<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Right-Aligned Snippet Placeholders</title>
	<atom:link href="http://blog.macromates.com/2007/right-aligned-snippet-placeholders/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/</link>
	<description>TextMate and OS X</description>
	<lastBuildDate>Wed, 03 Feb 2010 16:53:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Humberto Diógenes</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-3076</link>
		<dc:creator>Humberto Diógenes</dc:creator>
		<pubDate>Tue, 26 Feb 2008 02:45:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-3076</guid>
		<description>&lt;p&gt;As I didn&#039;t understand very well the ruby+regexp+snippets solution, I decided to try to get the same result with a (hopefully simpler) Python-only command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/env python
from sys import stdin

width = 20
s = stdin.read()

print &quot;-&quot; * width
print s.rjust(width)
print &quot;-&quot; * width
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>As I didn&#039;t understand very well the ruby+regexp+snippets solution, I decided to try to get the same result with a (hopefully simpler) Python-only command:</p>

<pre><code>#!/usr/bin/env python
from sys import stdin

width = 20
s = stdin.read()

print "-" * width
print s.rjust(width)
print "-" * width
</code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-3040</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Thu, 07 Feb 2008 18:02:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-3040</guid>
		<description>&lt;p&gt;Anyone have a PHP or CSS translation of this?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Anyone have a PHP or CSS translation of this?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: murphy</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-3005</link>
		<dc:creator>murphy</dc:creator>
		<pubDate>Mon, 14 Jan 2008 22:32:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-3005</guid>
		<description>&lt;p&gt;Some alternatives for the ugly 1.upto(width):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;print (1..width).map { &#124;i&#124; &quot;(?#{i}:: )&quot; }

width.times { &#124;i&#124; print &quot;(?#{i+1}:: )&quot; }

i = 0
width.times { print &quot;(?#{i+=1}:: )&quot; }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;But the whole thing is just too complicated...I would prefer putting Ruby code into the ${...} expressions...like&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;${ruby:width=[30, $1.size].max}
# ${ruby:&#039;-&#039; * width}
# ${ruby:&#039; &#039; * (width - $1.size)}${1:Header}
# ${ruby:&#039;-&#039; * width}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;${ruby:width=[30, $1.size].max}
/*${ruby:&#039;*&#039; * width}*
* ${ruby:&#039; &#039; * (width - $1.size)}${1:Header}*
**${ruby:&#039;-&#039; * width}*/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;for C-style comments.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Some alternatives for the ugly 1.upto(width):</p>

<pre><code>print (1..width).map { |i| "(?#{i}:: )" }

width.times { |i| print "(?#{i+1}:: )" }

i = 0
width.times { print "(?#{i+=1}:: )" }
</code></pre>

<p>But the whole thing is just too complicated&#8230;I would prefer putting Ruby code into the ${&#8230;} expressions&#8230;like</p>

<pre><code>${ruby:width=[30, $1.size].max}
# ${ruby:'-' * width}
# ${ruby:' ' * (width - $1.size)}${1:Header}
# ${ruby:'-' * width}
</code></pre>

<p>and</p>

<pre><code>${ruby:width=[30, $1.size].max}
/*${ruby:'*' * width}*
* ${ruby:' ' * (width - $1.size)}${1:Header}*
**${ruby:'-' * width}*/
</code></pre>

<p>for C-style comments.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: seq</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2966</link>
		<dc:creator>seq</dc:creator>
		<pubDate>Wed, 12 Dec 2007 13:18:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2966</guid>
		<description>&lt;pre&gt;&lt;code&gt;#!/usr/bin/env ruby

width = 30

print &quot;/&quot;, &quot;*&quot;*width, &quot;\n&quot;
print &quot;${1/^&quot;, &quot;(.)?&quot;*width, &quot;.*$/*&quot;
1.upto(width) { &#124;i&#124; print &quot;(?#{i}:: )&quot; }
print &quot;/}${1:Header}\n&quot;
print &quot;*&quot;*width, &quot;/\n&quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<pre><code>#!/usr/bin/env ruby

width = 30

print "/", "*"*width, "\n"
print "${1/^", "(.)?"*width, ".*$/*"
1.upto(width) { |i| print "(?#{i}:: )" }
print "/}${1:Header}\n"
print "*"*width, "/\n"
</code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Teifion</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2944</link>
		<dc:creator>Teifion</dc:creator>
		<pubDate>Wed, 05 Dec 2007 13:09:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2944</guid>
		<description>&lt;p&gt;I&#039;m confused as to why the example given doesn&#039;t output the line above and below the the comment, this version I&#039;ve done does. Bearing in mind I&#039;ve never actually programmed Ruby before it might not be the most efficient way to do it.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/env ruby

width = 30

print &quot;/&quot;
width.times { print &quot;*&quot; }
print &quot;\n&quot;
print &quot;${1/^&quot; + &quot;(.)?&quot;*width + &quot;.*$/&quot;
print &quot;*&quot;
1.upto(width) { &#124;i&#124; print &quot;(?#{i}:: )&quot; }
print &quot;/}${1:Header}&quot; + &quot;\n&quot;
width.times { print &quot;*&quot; }
print &quot;/\n&quot;
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>I&#039;m confused as to why the example given doesn&#039;t output the line above and below the the comment, this version I&#039;ve done does. Bearing in mind I&#039;ve never actually programmed Ruby before it might not be the most efficient way to do it.</p>

<pre><code>#!/usr/bin/env ruby

width = 30

print "/"
width.times { print "*" }
print "\n"
print "${1/^" + "(.)?"*width + ".*$/"
print "*"
1.upto(width) { |i| print "(?#{i}:: )" }
print "/}${1:Header}" + "\n"
width.times { print "*" }
print "/\n"
</code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Allan Odgaard</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2943</link>
		<dc:creator>Allan Odgaard</dc:creator>
		<pubDate>Tue, 04 Dec 2007 15:31:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2943</guid>
		<description>&lt;p&gt;Ben: Yeah, my “script” was meant as a subset of a full snippet-generating script, so I didn’t put any shebang in it.&lt;/p&gt;

&lt;p&gt;Simon: I fixed it — if you (or anyone else) know of a preview plug-in for WordPress which works with the Markdown plug-in and is a hassle-free install, let me know — for now there is Edit in TM and Preview from there :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ben: Yeah, my “script” was meant as a subset of a full snippet-generating script, so I didn’t put any shebang in it.</p>

<p>Simon: I fixed it — if you (or anyone else) know of a preview plug-in for WordPress which works with the Markdown plug-in and is a hassle-free install, let me know — for now there is Edit in TM and Preview from there :)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2942</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Tue, 04 Dec 2007 12:03:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2942</guid>
		<description>&lt;p&gt;Thanks for cleaning up, whoever it was. ;-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for cleaning up, whoever it was. ;-)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2941</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Tue, 04 Dec 2007 11:56:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2941</guid>
		<description>&lt;p&gt;Bah - formatting didn&#039;t work. This blog needs preview mode!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Bah &#8211; formatting didn&#039;t work. This blog needs preview mode!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2940</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Tue, 04 Dec 2007 11:55:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2940</guid>
		<description>&lt;p&gt;In Python:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/env python
width=20
print &#039;&#039;.join(&#039;(?%s:: )&#039; % i for i in range(1, width+1))
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>In Python:</p>

<pre><code>#!/usr/bin/env python
width=20
print ''.join('(?%s:: )' % i for i in range(1, width+1))
</code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Perry</title>
		<link>http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2939</link>
		<dc:creator>Ben Perry</dc:creator>
		<pubDate>Tue, 04 Dec 2007 07:22:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.macromates.com/2007/right-aligned-snippet-placeholders/#comment-2939</guid>
		<description>&lt;p&gt;not sure if anyone else had this problem, but i had to add:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/env ruby
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;to the top of the command. Otherwise I just keep getting errors.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>not sure if anyone else had this problem, but i had to add:</p>

<pre><code>#!/usr/bin/env ruby
</code></pre>

<p>to the top of the command. Otherwise I just keep getting errors.</p>]]></content:encoded>
	</item>
</channel>
</rss>

