snipt

Ctrl+h for KB shortcuts

Ruby

information

gem env
https://snippets.siftie.com/embed/bb3ccd5881d651448ded1dac904054ac/
/raw/bb3ccd5881d651448ded1dac904054ac/
bb3ccd5881d651448ded1dac904054ac
rb
Ruby
1
2019-04-08T21:58:55
True
False
False
/api/public/snipt/36786/
information
<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">gem</span> <span class="n">env</span> </span></pre></div> </td></tr></table>
ruby

Bash

rails validation

1
2
3
validates :min_age, :numericality => { :greater_than => 0, :less_than_or_equal_to => :max_age }

validates :max_age, :numericality => { :less_than_or_equal_to => 100 }
https://snippets.siftie.com/embed/b602be08631c960dc16c5076953abf7b/
/raw/b602be08631c960dc16c5076953abf7b/
b602be08631c960dc16c5076953abf7b
bash
Bash
4
2019-04-02T10:55:30
True
False
False
/api/public/snipt/35657/
rails-validation-1
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>validates :min_age, :numericality <span class="o">=</span>&gt; <span class="o">{</span> :greater_than <span class="o">=</span>&gt; 0, :less_than_or_equal_to <span class="o">=</span>&gt; :max_age <span class="o">}</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>validates :max_age, :numericality <span class="o">=</span>&gt; <span class="o">{</span> :less_than_or_equal_to <span class="o">=</span>&gt; <span class="m">100</span> <span class="o">}</span> </span></pre></div> </td></tr></table>
range, validation

Bash

cucumber command

bundle exec cucumber features/shopping_carts/login_user/billing_address.feature
https://snippets.siftie.com/embed/7d94c7aea0d6a0201e0e58ccba261507/
/raw/7d94c7aea0d6a0201e0e58ccba261507/
7d94c7aea0d6a0201e0e58ccba261507
bash
Bash
1
2019-04-13T10:54:53
True
False
False
/api/public/snipt/18748/
cucumber-command
<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>bundle <span class="nb">exec</span> cucumber features/shopping_carts/login_user/billing_address.feature </span></pre></div> </td></tr></table>
command, cucumber

Bash

Migration

1
2
3
4
rake db:drop
rake db:create
rake db:reset
rake db:migrate RAILS_ENV=test
https://snippets.siftie.com/embed/b439f9bbe0a4c866b54c7399f0d21e37/
/raw/b439f9bbe0a4c866b54c7399f0d21e37/
b439f9bbe0a4c866b54c7399f0d21e37
bash
Bash
5
2019-04-14T12:45:19
True
False
False
/api/public/snipt/18739/
migration
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rake db:drop </span><span id="L-2"><a name="L-2"></a>rake db:create </span><span id="L-3"><a name="L-3"></a>rake db:reset </span><span id="L-4"><a name="L-4"></a>rake db:migrate <span class="nv">RAILS_ENV</span><span class="o">=</span><span class="nb">test</span> </span></pre></div> </td></tr></table>
db, migrate, rails, ruby

Bash

Run Autospec

1
2
3
$ export AUTOFEATURE=true
$ spork RSpec &
$ ruby script/autospec 
https://snippets.siftie.com/embed/b9df82eae5c75586d02fbb6acc2ca989/
/raw/b9df82eae5c75586d02fbb6acc2ca989/
b9df82eae5c75586d02fbb6acc2ca989
bash
Bash
3
2019-04-09T05:54:24
True
False
False
/api/public/snipt/18718/
run-rspec
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$ <span class="nb">export</span> <span class="nv">AUTOFEATURE</span><span class="o">=</span><span class="nb">true</span> </span><span id="L-2"><a name="L-2"></a>$ spork RSpec <span class="p">&amp;</span> </span><span id="L-3"><a name="L-3"></a>$ ruby script/autospec </span></pre></div> </td></tr></table>
rails, rspec, ruby, spork

Bash

Ignore changes to tracked files

1
2
3
4
$ git update-index --assume-unchanged path/to/database.yml

# Find files marked as --assume-unchanged
$ git ls-files -v | grep -e "^[hsmrck]"
https://snippets.siftie.com/embed/22815de8ea7edf025d8395bba603f875/
/raw/22815de8ea7edf025d8395bba603f875/
22815de8ea7edf025d8395bba603f875
bash
Bash
4
2019-04-15T02:44:59
True
False
False
/api/public/snipt/18317/
ignore-changes-to-tracked-files-1
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$ git update-index --assume-unchanged path/to/database.yml </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1"># Find files marked as --assume-unchanged</span> </span><span id="L-4"><a name="L-4"></a>$ git ls-files -v <span class="p">|</span> grep -e <span class="s2">&quot;^[hsmrck]&quot;</span> </span></pre></div> </td></tr></table>
git

Bash

increase the Java heap memory for Maven 2 on linux

export MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=128m"
https://snippets.siftie.com/embed/b0051941560e9aa51f30c79c3dd6108b/
/raw/b0051941560e9aa51f30c79c3dd6108b/
b0051941560e9aa51f30c79c3dd6108b
bash
Bash
2
2019-04-11T21:07:31
True
False
False
/api/public/snipt/18289/
increase-the-java-heap-memory-for-maven-2-on-linux
<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="nb">export</span> <span class="nv">MAVEN_OPTS</span><span class="o">=</span><span class="s2">&quot;-Xmx2048m -XX:MaxPermSize=128m&quot;</span> </span></pre></div> </td></tr></table>
java, maven, ubuntu

Bash

load profile no need restart

source .bashrc 
https://snippets.siftie.com/embed/63f04cf19b2f8c1b155344fce3ed300e/
/raw/63f04cf19b2f8c1b155344fce3ed300e/
63f04cf19b2f8c1b155344fce3ed300e
bash
Bash
1
2019-04-04T17:34:26
True
False
False
/api/public/snipt/18288/
load-profile-no-need-restart
<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="nb">source</span> .bashrc </span></pre></div> </td></tr></table>
profile, ubuntu