Skip to content

Instantly share code, notes, and snippets.

@nnattawat
Last active October 26, 2015 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nnattawat/bf4a0c08080ffd669ec7 to your computer and use it in GitHub Desktop.
Save nnattawat/bf4a0c08080ffd669ec7 to your computer and use it in GitHub Desktop.
Useful sublime snippet for rails developer

Simple Sublime snippet that I am personnaly using to faster the development, such as binding.pry and rspec syntax.

Usage

Copy those file into your Sublime installation > Packages > User. For Mac users, it should locate at ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/. Then there will be snippet showing while you are typing in the ruby file.

Read more about Sublime Snippet

<snippet>
<content><![CDATA[
before(${1::each}) do
$0
end
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>before</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ruby</scope>
</snippet>
<snippet>
<content><![CDATA[
binding.pry
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>bin</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ruby</scope>
<scope>text.haml</scope>
</snippet>
<snippet>
<content><![CDATA[
context "${1}" do
$0
end
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>context</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ruby</scope>
</snippet>
<snippet>
<content><![CDATA[
describe "${1}" do
$0
end
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>desc</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ruby</scope>
</snippet>
<snippet>
<content><![CDATA[
it "${1}" do
$0
end
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>it</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ruby</scope>
</snippet>
<snippet>
<content><![CDATA[
t('.${1:key}')
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>t</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment