snipt

Ctrl+h for KB shortcuts

Ruby

Rails debug

logger.debug "Debug: #{OBJECT.attributes.inspect}"
https://snipt.net/embed/4c264df5bf77886324df66ac2cf5cc42/
/raw/4c264df5bf77886324df66ac2cf5cc42/
4c264df5bf77886324df66ac2cf5cc42
rb
Ruby
1
2019-07-07T14:53:49
True
False
False
Oct 23, 2012 at 07:18 PM
/api/public/snipt/48954/
rails-debug
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">logger</span><span class="o">.</span><span class="n">debug</span> <span class="s2">&quot;Debug: </span><span class="si">#{</span><span class="no">OBJECT</span><span class="o">.</span><span class="n">attributes</span><span class="o">.</span><span class="n">inspect</span><span class="si">}</span><span class="s2">&quot;</span> </span></pre></div> </td></tr></table>
debug, logger, ruby

Bash

Install postgrest on snow leopard

gem install pg -v 0.14.1 -- --with-pg-config=/usr/local/pgsql-9.1/bin/pg_config
https://snipt.net/embed/de5f0d1df77ec38262396a6a349aef8b/
/raw/de5f0d1df77ec38262396a6a349aef8b/
de5f0d1df77ec38262396a6a349aef8b
bash
Bash
1
2019-06-28T07:50:23
True
False
False
Oct 14, 2012 at 09:19 PM
/api/public/snipt/48560/
install-postgrest-on-snow-leopard
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>gem install pg -v 0.14.1 -- --with-pg-config<span class="o">=</span>/usr/local/pgsql-9.1/bin/pg_config </span></pre></div> </td></tr></table>

Ruby

List facebook mutual friends with the koala gem

1
2
3
4
5
6
require 'koala'

@graph = Koala::Facebook::API.new('the_token')

friend_id = 'the_friend_id'
@graph.get_connections("me", "mutualfriends/#{friend_id}")
https://snipt.net/embed/9f7a946e0803e3f964d43119d9dde428/
/raw/9f7a946e0803e3f964d43119d9dde428/
9f7a946e0803e3f964d43119d9dde428
rb
Ruby
7
2019-07-14T06:06:35
True
False
False
Oct 10, 2012 at 06:42 PM
/api/public/snipt/48406/
list-facebook-mutual-friends-with-the-koala-gem
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">require</span> <span class="s1">&#39;koala&#39;</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="vi">@graph</span> <span class="o">=</span> <span class="no">Koala</span><span class="o">::</span><span class="no">Facebook</span><span class="o">::</span><span class="no">API</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s1">&#39;the_token&#39;</span><span class="p">)</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="n">friend_id</span> <span class="o">=</span> <span class="s1">&#39;the_friend_id&#39;</span> </span><span id="L-6"><a name="L-6"></a><span class="vi">@graph</span><span class="o">.</span><span class="n">get_connections</span><span class="p">(</span><span class="s2">&quot;me&quot;</span><span class="p">,</span> <span class="s2">&quot;mutualfriends/</span><span class="si">#{</span><span class="n">friend_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span> </span></pre></div> </td></tr></table>
facebook, koala, mutual_friends