Skip to content

@judofyr /example.html secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
<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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.