From d0d1e59ad081497dad61f4ab403fe3e0bb067b03 Mon Sep 17 00:00:00 2001 From: Gilad Peleg Date: Wed, 7 May 2014 10:19:01 +0300 Subject: [PATCH 1/3] Add useful javascript snippets --- UltiSnips/javascript.snippets | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index f8d4790..bdc7216 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -79,6 +79,14 @@ setTimeout(function() { }${2:.bind(${3:this})}, ${1:10}); endsnippet +snippet fi "for prop in obj using hasOwnProperty" +for (${1:prop} in ${2:obj}){ + if ($2.hasOwnProperty($1)) { + ${0:// body...} + } +} +endsnippet + # Snippets for Console Debug Output snippet ca "console.assert" b @@ -121,6 +129,10 @@ snippet cl "console.log" b console.log(${1:"${2:value}"}); endsnippet +snippet cd "console.debug" b +console.debug(${1:"${2:value}"}); +endsnippet + snippet cprof "console.profile" b console.profile("${1:label}"); ${VISUAL}$0 From 98b1b48d926fb31e76bd137ab43c1bd5c21ce317 Mon Sep 17 00:00:00 2001 From: Gilad Peleg Date: Wed, 7 May 2014 15:09:41 +0300 Subject: [PATCH 2/3] add b flag and edit placeholder --- UltiSnips/javascript.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index bdc7216..f8dabf1 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -79,10 +79,10 @@ setTimeout(function() { }${2:.bind(${3:this})}, ${1:10}); endsnippet -snippet fi "for prop in obj using hasOwnProperty" +snippet fi "for prop in obj using hasOwnProperty" b for (${1:prop} in ${2:obj}){ if ($2.hasOwnProperty($1)) { - ${0:// body...} + $0 } } endsnippet From e7f047b666dad4b0413d634d1c8d67131fe6c450 Mon Sep 17 00:00:00 2001 From: Gilad Peleg Date: Wed, 7 May 2014 15:10:33 +0300 Subject: [PATCH 3/3] Update javascript.snippets --- UltiSnips/javascript.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index f8dabf1..5889e05 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -82,7 +82,7 @@ endsnippet snippet fi "for prop in obj using hasOwnProperty" b for (${1:prop} in ${2:obj}){ if ($2.hasOwnProperty($1)) { - $0 + ${VISUAL}$0 } } endsnippet