Skip to content

Commit

Permalink
ver2
Browse files Browse the repository at this point in the history
  • Loading branch information
longyiyiyu committed Oct 21, 2015
1 parent f6721b8 commit 24dc6e1
Show file tree
Hide file tree
Showing 21 changed files with 289 additions and 17 deletions.
110 changes: 98 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ for (${1:prop} in ${2:obj}) {
}
```

### [fo] for
### [for] for

```javascript
for (var ${1:i} = ${2:0}, ${3:l} = ${4:arr}.length; ${1:i} < ${3:l}; ++${1:i}) {
Expand All @@ -81,7 +81,7 @@ for (var ${1:i} = ${2:0}, ${3:l} = ${4:arr}.length; ${1:i} < ${3:l}; ++${1:i}) {

## Function

### [fn] function
### [fn][fun] function

```javascript
function ${1:functionName}(${2:arguments}) {
Expand All @@ -97,16 +97,16 @@ function(${1:arguments}) {
}
```
### [apply] apply
### [ap] apply
```javascript
${1:functionName}.apply(${2:context}, [${3:arguments}]);
apply(${1:context}, [${2:arguments}]);
```
### [call] call
### [ca] call
```javascript
${1:functionName}.call(${2:context}, ${3:arguments});
call(${1:context}, ${2:arguments});
```
### [iif] immediately-invoked function expression
Expand Down Expand Up @@ -139,78 +139,138 @@ if (${1:expr}) {
## Jquery
### [jvt] get $this
### [jvt] var $this = $(this)
```javascript
var \$this = \$(this);
```
### [jve] get jquery element
### [jve] var $var = $('var')
```javascript
var \$${1} = \$('${2}');
```
### [jvd] get data
### [jvd] var d = $d.data('d')
```javascript
var ${1:cid} = \$${2:this}.data('${3:cid}');
```
### [da] data()
```javascript
data('${1}')
```
### [jext] $.extend
```javascript
\$.extend(${1});
```
### [ext] extend()
```javascript
extend(${1})
```
### [jat] $.attr
```javascript
\$${1:this}.attr('${2}'${3});
```
### [at] attr()
```javascript
attr('${1}'${2})
```
### [jcss] $.css
```javascript
\$${1:this}.css({${2}});
```
### [css] css()
```javascript
css({${2}})
```
### [jwi] $.width
```javascript
\$${1:this}.width(${2});
```
### [wi] width()
```javascript
width(${1})
```
### [jhe] $.height
```javascript
\$${1:this}.height(${2});
```
### [he] height()
```javascript
height(${1})
```
### [jsh] $.show
```javascript
\$${1:this}.show();
```
### [sh] show()
```javascript
show()
```
### [jhi] $.hide
```javascript
\$${1:this}.hide();
```
### [hi] hide()
```javascript
hide()
```
### [jac] $.addClass
```javascript
\$${1:this}.addClass('${2}');
```
### [addC] addClass()
```javascript
addClass('${1}')
```
### [jrc] $.removeClass
```javascript
\$${1:this}.removeClass('${2}');
```
### [rem] removeClass()
```javascript
removeClass('${1}')
```
### [jon] $.on
```javascript
Expand All @@ -219,20 +279,46 @@ var ${1:cid} = \$${2:this}.data('${3:cid}');
});
```
### [on] on()
```javascript
on('${1:click}', ${2}function(e${3}) {
${4:// body...}
});
```
### [jtri] $.trigger
```javascript
\$${1:doc}.trigger('${2:eventType}'${3});
```
### [tri] trigger()
```javascript
trigger('${1:eventType}'${2});
```
## MISC
### [vs] save context
### [vs] var self = this
```javascript
var ${1:self} = this;
```
### [se] self = this
```javascript
self = this;
```
### [th] that = this
```javascript
that = this;
```
### [al] alert
```javascript
Expand Down Expand Up @@ -281,15 +367,15 @@ module.exports = {${1}};
## Timer
### [st] setTimeout
### [st][setT] setTimeout
```javascript
setTimeout(function() {
${2:// body...}
}, ${1:delay});
```
### [si] setInterval
### [si][setI] setInterval
```javascript
setInterval(function() {
Expand Down
2 changes: 1 addition & 1 deletion for-native.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for (var ${1:i} = ${2:0}, ${3:l} = ${4:arr}.length; ${1:i} < ${3:l}; ++${1:i}) {
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>fo</tabTrigger>
<tabTrigger>for</tabTrigger>
<description>for</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js, keyword.control.js</scope>
Expand Down
4 changes: 2 additions & 2 deletions function-apply.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<snippet>
<content><![CDATA[
${1:functionName}.apply(${2:context}, [${3:arguments}]);
apply(${1:context}, [${2:arguments}]);
]]></content>
<tabTrigger>apply</tabTrigger>
<tabTrigger>ap</tabTrigger>
<scope>source.js</scope>
<description>method.apply()</description>
</snippet>
4 changes: 2 additions & 2 deletions function-call.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<snippet>
<content><![CDATA[
${1:functionName}.call(${2:context}, ${3:arguments});
call(${1:context}, ${2:arguments});
]]></content>
<tabTrigger>call</tabTrigger>
<tabTrigger>ca</tabTrigger>
<scope>source.js</scope>
<description>method.call()</description>
</snippet>
10 changes: 10 additions & 0 deletions function2.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<snippet>
<content><![CDATA[
function ${1:functionName}(${2:arguments}) {
${3:// body...}
}
]]></content>
<tabTrigger>fun</tabTrigger>
<scope>source.js</scope>
<description>function</description>
</snippet>
11 changes: 11 additions & 0 deletions jquerys-addClass.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
addClass('${1}')
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>addC</tabTrigger>
<description>addClass()</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js, keyword.operator.js</scope>
</snippet>
11 changes: 11 additions & 0 deletions jquerys-attr.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
attr('${1}'${2})
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>at</tabTrigger>
<description>attr()</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js, keyword.operator.js</scope>
</snippet>
11 changes: 11 additions & 0 deletions jquerys-css.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
css({${1}})
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>css</tabTrigger>
<description>css()</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js, keyword.operator.js</scope>
</snippet>
11 changes: 11 additions & 0 deletions jquerys-extend.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
extend(${1})
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>ext</tabTrigger>
<description>extend()</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js, keyword.operator.js</scope>
</snippet>
11 changes: 11 additions & 0 deletions jquerys-getData.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
data('${1}'${2})
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>da</tabTrigger>
<description>data()</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js, storage.type.js</scope>
</snippet>
11 changes: 11 additions & 0 deletions jquerys-height.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
height(${1})
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>he</tabTrigger>
<description>height()</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js, keyword.operator.js</scope>
</snippet>
11 changes: 11 additions & 0 deletions jquerys-hide.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
hide()
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>hi</tabTrigger>
<description>hide()</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js, keyword.operator.js</scope>
</snippet>
13 changes: 13 additions & 0 deletions jquerys-on.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<snippet>
<!-- Example: Hello, ${1:this} is a ${2:snippet}. -->
<content><![CDATA[
on('${1:click}', ${2}function(e${3}) {
${4:// body...}
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>on</tabTrigger>
<description>on()</description>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js, keyword.operator.js</scope>
</snippet>
Loading

0 comments on commit 24dc6e1

Please sign in to comment.