Just some peace of code that helps us in work.
- Install Package Controll
- In Sublime Text 2/3 press
⌘+shift+p
(orctrl+shift+p
) and enterInstall Package
- In this palet enter
EvercodeLab Sublime Snippets
and pressenter
- …
- Profit!
ST2
git clone [email protected]:EvercodeLab/evercodelab-sublime-snippets.git \
~/Library/Application\ Support/Sublime\ Text\ 2/Packages/EvercodeSnippetPack
ST3
git clone [email protected]:EvercodeLab/evercodelab-sublime-snippets.git \
~/Library/Application\ Support/Sublime\ Text\ 3/Packages/EvercodeSnippetPack
git clone [email protected]:EvercodeLab/evercodelab-sublime-snippets.git \
~/.config/sublime-text-2/Packages/EvercodeSnippetPack
<%
:<% %>
erb
:<%= %>
seems wierd at first, but is easy to type with just left handif
: if-endife
: if-else-endcase
: case-when-when-endwhen
: wheneach
: object-each-do-endtap
: object-tap-do-endtry
: object-try-do-endformfor
: form-forfi
: form inputimgtag
: image-taglinkto
: link-tooptforsel
: options for selectoptfrom
: options from collection for selectrender
: render partialselecttag
: select tagsimplefields
: simple fields for formsimpleform
: simple form with fields
docready
: jQuery document ready functionconsole
: console.log() function — help debug JavaScriptanonymous-function
: anonymous functionon
: jQueryon
function, 'click' by default
itsrt
: it-should-respond-toitsbt
: it-should-belong-toitshm
: it-should-have-manyitshabtm
: it-should-have-and-belong-to-manyits
: its-property-should
match
: match-path-actionget
: get-pathpost
: post-pathres
: resourcesro
: resources-onlyre
: resources-except
sf-crud-controller
: generate whole CRUD controllersf-controller-with-annotation
: controller with annotationssf-action-with-annotation
: action annotated with @Route and @Templatesf-em
: getting Entity Manager in Controllersf-get-repository
: getting repository with Entity managersf-get-user-from-security-context
: get User information from security.contextsf-redirect
: redirectsf-flash
: flash messagesf-403
: throwing 403 exceptionsf-404
: throwing 404 exception
sf-entity-class
: generates entity classsf-orm-column
: generates ORM column defenitionsf-orm-column-with-set-and-get
: generates ORM column defenition with setter and gettersf-repository-class
: generates entity repository classsf-query-builder
: generate query buildersf-setter-and-getter
: setter and getter methodssf-setter
: setteresf-getter
: getter
sf-form-type
: creates form type classsf-cnoice-list-class
: creates choice list class
For basic Twig functions use PHP Twig. It provide next snippets:
}}
:{{ }}
%%
:{% %}
block
:{% block name %}{% endblock %}
blockb
: block with blank lineextends
:{% extends 'template' %}
filter
:{% filter name %}{% endfilter %}
filterb
: filter with blank linefor
:{% for item in seq %}
fore
: for with elseif
:{% if condition %}{% endif %}
ifb
: same asif
but with blank lineife
: same asif
but with else statementelse
:{% else %}
set
:{% set var = value %}
setb
: same asset
but in other syntax
And here some more Twig snippets:
twig-path
: path functiontwig-include
: include other templatetwig-render
: render other templatetwig-spaceless
: render peace of templte without spaces
sf-sonata-admin-class
: creates SonataAdmin class
sf-service
: yml service defenitionsf-service-admin
: yml admin service defenition
class
: just PHP classphp
: PHP open tagpubfun
: public functionprivfun
: private functionprotfun
: protected function
snippet
: just for generation of other snippets
More to come. Stay tuned.