Skip to content

Instantly share code, notes, and snippets.

@t-mw
Last active July 17, 2016 09:33
Show Gist options
  • Save t-mw/11e8fbce4ac0463803548bb79db1cbaa to your computer and use it in GitHub Desktop.
Save t-mw/11e8fbce4ac0463803548bb79db1cbaa to your computer and use it in GitHub Desktop.
Sublime snippets
<snippet>
<content><![CDATA[${1:test_name}_(${2:_State}) ->
{"${3:description}",
fun() ->
${4:ok}
end}.]]></content>
<tabTrigger>eunit</tabTrigger>
<scope>source.erlang</scope>
<description>EUnit Test Case</description>
</snippet>
<snippet>
<content><![CDATA[${1:method_name}(${2:Args}) ->
gen_server:call(?MODULE, {$1, $2}).
handle_call({$1, $2}, _From, State) ->
$0{reply, ok, State};]]></content>
<tabTrigger>gs_call</tabTrigger>
<scope>source.erlang</scope>
<description>gen_server:call</description>
</snippet>
<snippet>
<content><![CDATA[type $1Payload = ${2:{ \}};
interface $1 extends TypedAction<$1Payload> {
type: "${1/([a-z]+)([A-Z])|([a-z]+\z)/\U(?1$1_$2:)(?3$3:)/g}";
}
const ${1/(\w+)/\l$1/} = actionCreator<$1Payload>("${1/([a-z]+)([A-Z])|([a-z]+\z)/\U(?1$1_$2:)(?3$3:)/g}");]]></content>
<tabTrigger>redux_ts_action</tabTrigger>
<scope>source.ts, source.tsx</scope>
<description>Redux Typescript Action</description>
</snippet>
<snippet>
<content><![CDATA[type ${1:TypeName} = ${2:any};
interface $1State { ${1/(\w+)/\l$1/}: $1; };
function ${1/(\w+)/\l$1/}(state: $1$3, action: Action) {
switch (action.type) {$4
default:
return state;
}
}
]]></content>
<tabTrigger>redux_ts_reducer</tabTrigger>
<scope>source.ts, source.tsx</scope>
<description>Redux Typescript Reducer</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment