This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("awesome!") | |
console.log("awesome!") | |
console.log("awesome!") | |
console.log("awesome!") | |
console.log("awesome!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function error(err, options) { | |
var originalError = null; | |
if (typeof err.message === 'string' && err.message !== '') { | |
if (typeof options === 'string' || (options && options.message)) { | |
originalError = util.copy(err); | |
originalError.message = err.message; | |
} | |
} | |
err.message = err.message || null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copy(object) { | |
if (object === null || object === undefined) return object; | |
var dupe = {}; | |
// jshint forin:false | |
for (var key in object) { | |
dupe[key] = object[key]; | |
} | |
return dupe; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isEmpty(obj) { | |
for (var prop in obj) { | |
if (obj.hasOwnProperty(prop)) { | |
return false; | |
} | |
} | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: node_js | |
node_js: | |
- '4.0' | |
branches: | |
only: | |
- master | |
before_install: | |
- openssl aes-256-cbc -K $encrypted_e011a6d7eebf_key -iv $encrypted_e011a6d7eebf_iv -in .travis/id_rsa.enc -out ~/.ssh/id_rsa -d | |
- chmod 600 ~/.ssh/id_rsa | |
- eval $(ssh-agent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{#each data}} | |
<div>{{@index}}</div> <!-- start from 0--> | |
<div>{{this}}</div> <!-- "aa"--> | |
{{/each}} | |
<script> | |
var data = ["aa","bb"] | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<p>123</p> | |
<p>321</p> | |
<p>456</p> | |
<p>789</p> | |
</div> | |
<script> | |
$("div p:first-child") //return <p>123</p> | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#ele").children().length>0; // if has children return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
div{ | |
height:100px; | |
width:100px; /*宽高必须相等*/ | |
overflow:hidden; /*隐藏超出div的部分*/ | |
border-radius:50%;/*圆角为宽高的50%*/ | |
} | |
</style> | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//查找同级元素 | |
$("#id").next(); // 下一个同级元素 | |
$("#id").prev(); // 前一个 | |
$("#id").nextAll("div"); // 所有该元素之后的同级div元素 | |
$("#id").prevAll("div"); | |
$("#id").prevAll("div").andSelf(); //所有该元素之前的同级div元素及该元素本身 |
NewerOlder