<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>CSCI E-168, Fall 2007 - Latest Comments in Your one-liners?</title><link>http://e168f07.disqus.com/</link><description></description><atom:link href="https://e168f07.disqus.com/your_one_liners/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 01 Nov 2007 12:22:12 -0000</lastBuildDate><item><title>Re: Your one-liners?</title><link>http://e168f07.7fff.com/2007/10/24/your-one-liners/#comment-7224</link><description>&lt;p&gt;Nice!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jgn</dc:creator><pubDate>Thu, 01 Nov 2007 12:22:12 -0000</pubDate></item><item><title>Re: Your one-liners?</title><link>http://e168f07.7fff.com/2007/10/24/your-one-liners/#comment-7223</link><description>&lt;p&gt;Good one.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jgn</dc:creator><pubDate>Thu, 01 Nov 2007 12:21:05 -0000</pubDate></item><item><title>Re: Your one-liners?</title><link>http://e168f07.7fff.com/2007/10/24/your-one-liners/#comment-7215</link><description>&lt;p&gt;Proposed 1-liner:&lt;/p&gt;&lt;p&gt;Hash#invert returns a new hash where the keys of the new hash are the values of the old hash, and vice-versa.  If the original hash contains multiple keys that map to the same value, the new hash will contain a single entry for that value (now the new key) and which of the original keys becomes the new value is not predictable.&lt;/p&gt;&lt;p&gt;Write a one-liner which inverts a hash, but where each value in the new hash is an array containing all the keys of the original hash.&lt;/p&gt;&lt;p&gt;Now, write a one-liner like the above, but if there is only one (new) value, it should be a simple value, not an array.&lt;/p&gt;&lt;p&gt;- Steve&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">steveharris</dc:creator><pubDate>Thu, 01 Nov 2007 11:26:09 -0000</pubDate></item><item><title>Re: Your one-liners?</title><link>http://e168f07.7fff.com/2007/10/24/your-one-liners/#comment-6409</link><description>&lt;p&gt;Plus, you can't censor things containing a mix of word and non-word characters.  If you put "can't" in your banned word list, it won't be filtered out.&lt;br&gt;I'll leave the substring-based solution to someone else.&lt;br&gt;Also, what I posted censors case-sensitively.  That probably ought to be corrected, too.  Making it:&lt;br&gt;     &lt;a href="http://d.map" rel="nofollow noopener" target="_blank" title="d.map"&gt;d.map&lt;/a&gt; {|b| b.upcase}.include?(w.upcase)&lt;br&gt;should take case of that.&lt;br&gt;Oneliners that try to cover all the bases seem to get quite ornate.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp</dc:creator><pubDate>Sat, 27 Oct 2007 22:22:59 -0000</pubDate></item><item><title>Re: Your one-liners?</title><link>http://e168f07.7fff.com/2007/10/24/your-one-liners/#comment-6408</link><description>&lt;p&gt;This is a little tricky, since punctuation gets in the way (you can't use a plain "split" because those "Indians" at the end have a trailing ".")&lt;br&gt;I think this covers most situations, but "\b" may be a little obscure.&lt;/p&gt;&lt;p&gt;s.split(/\b/).map {|w| d.include?(w) ? w[0].chr + "*" * (w.length - 1) : w}.join&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp</dc:creator><pubDate>Sat, 27 Oct 2007 22:16:10 -0000</pubDate></item><item><title>Re: Your one-liners?</title><link>http://e168f07.7fff.com/2007/10/24/your-one-liners/#comment-6282</link><description>&lt;p&gt;Can you add some code to show it working . . . ?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jgn</dc:creator><pubDate>Fri, 26 Oct 2007 07:43:10 -0000</pubDate></item><item><title>Re: Your one-liners?</title><link>http://e168f07.7fff.com/2007/10/24/your-one-liners/#comment-6268</link><description>&lt;p&gt;d.inject(a) { |censored, bad_word| censored.gsub( &lt;a href="http://Regexp.new" rel="nofollow noopener" target="_blank" title="Regexp.new"&gt;Regexp.new&lt;/a&gt;( bad_word ),  '*' * bad_word.length) }&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mhoram</dc:creator><pubDate>Fri, 26 Oct 2007 00:28:16 -0000</pubDate></item></channel></rss>