Skip to content

Instantly share code, notes, and snippets.

@sdlong
Last active July 18, 2016 13:03
Show Gist options
  • Save sdlong/e2188e26ad1a0231ae29 to your computer and use it in GitHub Desktop.
Save sdlong/e2188e26ad1a0231ae29 to your computer and use it in GitHub Desktop.
ATOM snippets
'.html.erb':
'link_to':
'prefix': 'lt'
'body': '<% link_to("$1", ${2:path}) %>'
'link_to_delete':
'prefix': 'ltd'
'body': '<%= link_to("$1", ${2:path}, method: :delete, data: { confirm: "Are you sure?" } ) %>'
'link_to_icon':
'prefix': 'lti'
'body': """
<% link_to(${1:path}, class: "btn btn-primary") do %>
<i class="icon"></i>
<% end %>
"""
'<% %>':
'prefix': 'er'
'body': '<% $1 %>'
'<%= %>':
'prefix': 'pe'
'body': '<%= $1 %>'
'<%# %>':
'prefix': 'pc'
'body': '<%# $1 %>'
'form':
'prefix': 'form'
'body': """
<%= simple_form_for(@${1:things}) do |f| %>
${2:block}
<% end %>
"""
'each':
'prefix': 'each'
'body': """
<% @${1:things}.each do |${2:thing}| %>
${3:block}
<% end %>
"""
'fp':
'prefix': 'fp'
'body': '<%= f.input ${1:symbol} %>'
'end':
'prefix': 'end'
'body': '<% end %>'
'else':
'prefix': 'else'
'body': '<% else %>'
'if':
'prefix': 'if'
'body': """
<% if ${1:condition} %>
${2:block}
<% end %>
"""
'ife':
'prefix': 'if/else'
'body': """
<% if ${1:condition} %>
${2:true-block}
<% else %>
${3:false-block}
<% end %>
"""
'note TODO':
'prefix': 'ntd'
'body': '<%# TODO : ${1:something} %>'
'submit tag':
'prefix': 'st'
'body': '<%= f.submit "${1:word}", class: "btn", data: { disable_with: "${2:submiting...}" } %>'
@sdlong
Copy link
Author

sdlong commented Jul 1, 2015

sample:

lt
<% link_to("", path) %>

ltd
<%= link_to("", path, method: :delete, data: { confirm: "Are you sure?" } ) %>

lti
<% link_to(path, class: "btn btn-primary") do %>
  <i class="icon"></i>
<% end %>

er
<%  %>

pe
<%=  %>

pc
<%#  %>

form
<%= simple_form_for(@things) do |f| %>
  block
<% end %>

each
<% @things.each do |thing| %>
  block
<% end %>

fp
<%= f.input  %>

st
<%= f.submit "word", class: "btn", data: { disable_with: "submiting..." } %>

end
<% end %>

else
<% else %>

if
<% if condition %>
  block
<% end %>

ife
<% if condition %>
  true-block
<% else %>
  false-block
<% end %>

ntd
<%# TODO : something %>

@sdlong
Copy link
Author

sdlong commented Jul 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment