Last active
August 29, 2015 14:02
-
-
Save jipiboily/d4cf750c08085f405e67 to your computer and use it in GitHub Desktop.
Playing with Atom snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your snippets | |
# | |
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to | |
# expand the prefix into a larger code block with templated values. | |
# | |
# You can create a new snippet in this file by typing "snip" and then hitting | |
# tab. | |
# | |
# An example CoffeeScript snippet to expand log to console.log: | |
# | |
# '.source.coffee': | |
# 'Console log': | |
# 'prefix': 'log' | |
# 'body': 'console.log $1' | |
# | |
# RSpec stuff | |
'.source.ruby': | |
describe: | |
prefix: 'desc' | |
body: """describe '$1' do | |
$2 | |
end""" | |
context: | |
prefix: 'context' | |
body: """context '$1' do | |
$2 | |
end""" | |
'it (lambda style)': | |
prefix: 'it' | |
body: 'it { $1 }' | |
'it (full block)': | |
prefix: 'it ' | |
body: """it "$1" do | |
$2 | |
end""" | |
let: | |
prefix: 'let' | |
body: 'let(:$1) { $2 }' | |
subject: | |
prefix: 'sub' | |
body: 'subject { $1 }' | |
before: | |
prefix: 'bef' | |
body: """before do | |
$1 | |
end""" | |
# Rails | |
model: | |
prefix: 'model' | |
body: """class ${1:MyModel} < ActiveRecord::Base | |
$2 | |
end""" | |
controller: | |
prefix: 'controller' | |
body: """class ${1:MyController} < ApplicationController | |
def index | |
end | |
end""" | |
# Plain Ruby | |
class: | |
prefix: 'class' | |
body: """class ${1:MyClass} | |
$2 | |
end""" | |
module: | |
prefix: 'module' | |
body: """module ${1:MyModule} | |
extend ActiveSupport::Concern | |
included do | |
end | |
module ClassMethods | |
end | |
end""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment