secret
Last active

  • Download Gist
example.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
<p>Mac:</p>
<p><pre class="sunburst"><br />
<span class="Comment"><span class="Comment">#</span> stick in .irbrc</span><br />
<span class="Keyword">def</span> <span class="Entity">copy</span>(<span class="Variable">str</span>)<br />
<span class="Variable">IO</span>.<span class="Entity">popen</span>(<span class="String"><span class="String">&#8216;</span>pbcopy<span class="String">&#8217;</span></span>, <span class="String"><span class="String">&#8216;</span>w<span class="String">&#8217;</span></span>) { |<span class="Variable">f</span>| f <span class="Keyword">&lt;&lt;</span> str.<span class="Entity">to_s</span> }<br />
<span class="Keyword">end</span><br />
<br />
<span class="Keyword">def</span> <span class="Entity">paste</span><br />
<span class="String"><span class="String">`</span>pbpaste<span class="String">`</span></span><br />
<span class="Keyword">end</span><br />
<br />
<span class="Keyword">def</span> <span class="Entity">ep</span><br />
<span class="Entity">eval</span>(paste)<br />
<span class="Keyword">end</span><br />
</pre><br />
<br />
Linux with xclip (thanks <a href="http://gist.github.com/124272">Bjørn Arild Mæland</a>):</p>
<p>
<pre class="sunburst">
<span class="Keyword">def</span> <span class="Entity">copy</span>(<span class="Variable">str</span>)
<span class="Variable">IO</span>.<span class="Entity">popen</span>(<span class="String"><span class="String">'</span>xclip -i<span class="String">'</span></span>, <span class="String"><span class="String">'</span>w<span class="String">'</span></span>) { |<span class="Variable">f</span>| f <span class="Keyword">&lt;&lt;</span> str.<span class="Entity">to_s</span> }
<span class="Keyword">end</span>
<span class="Keyword">def</span> <span class="Entity">paste</span>
<span class="String"><span class="String">`</span>xclip -o<span class="String">`</span></span>
<span class="Keyword">end</span>
</pre>
</p>
example.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
Mac:
 
<notextile>
<pre class="sunburst">
<span class="Comment"><span class="Comment">#</span> stick in .irbrc</span>
<span class="Keyword">def</span> <span class="Entity">copy</span>(<span class="Variable">str</span>)
<span class="Variable">IO</span>.<span class="Entity">popen</span>(<span class="String"><span class="String">'</span>pbcopy<span class="String">'</span></span>, <span class="String"><span class="String">'</span>w<span class="String">'</span></span>) { |<span class="Variable">f</span>| f <span class="Keyword">&lt;&lt;</span> str.<span class="Entity">to_s</span> }
<span class="Keyword">end</span>
 
<span class="Keyword">def</span> <span class="Entity">paste</span>
<span class="String"><span class="String">`</span>pbpaste<span class="String">`</span></span>
<span class="Keyword">end</span>
 
<span class="Keyword">def</span> <span class="Entity">ep</span>
<span class="Entity">eval</span>(paste)
<span class="Keyword">end</span>
</pre>
</notextile>
 
Linux with xclip (thanks "Bjørn Arild Mæland":http://gist.github.com/124272):
 
<notextile>
<pre class="sunburst">
<span class="Keyword">def</span> <span class="Entity">copy</span>(<span class="Variable">str</span>)
<span class="Variable">IO</span>.<span class="Entity">popen</span>(<span class="String"><span class="String">'</span>xclip -i<span class="String">'</span></span>, <span class="String"><span class="String">'</span>w<span class="String">'</span></span>) { |<span class="Variable">f</span>| f <span class="Keyword">&lt;&lt;</span> str.<span class="Entity">to_s</span> }
<span class="Keyword">end</span>
<span class="Keyword">def</span> <span class="Entity">paste</span>
<span class="String"><span class="String">`</span>xclip -o<span class="String">`</span></span>
<span class="Keyword">end</span>
</pre>
</notextile>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.