看来 jQuery 你已经用得很爽了,想学习如何自己编写插件。非常好,这篇文档正适合你。用插件和方法来扩展 jQuery 非常强大,把最聪明的功能封装到插件中可以为你及团队节省大量开发时间。
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
const map = (array, func) => ( | |
array.map(func) | |
); | |
const flatMap = (array, func) => ( | |
array.reduce((result, element) => ( | |
result.concat(func(element)) | |
), []) | |
); |
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
@Component({ | |
selector: 'spinner', | |
template: `<h1>spinner</h1>` // This will be displayed while loading. | |
}) | |
class Spinner { | |
} | |
@Directive({ | |
selector: "[loading]", | |
inputs: ["loading"], |
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
Select all and delete (actually move to buffer) | |
:%d | |
Select all and copy to buffer | |
:%y | |
Use p to paste the buffer. |
If you just want to fix the issue quickly, scroll down to the "solution" section below.
If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g
, you may see an error like this:
$ npm update npm -g
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
FROM ubuntu:14.04 | |
MAINTAINER Pan Jiabang, [email protected] | |
RUN \ | |
# use aliyun's mirror for better download speed | |
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \ | |
apt-get update && \ | |
apt-get install -y nodejs curl git-core && \ | |
# use nodejs as node |
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
# JS files | |
JS_FINAL = js/project-name-all.js | |
JS_TARGETS = js/file1.js \ | |
js/file2.js \ | |
js/file3.js | |
# CSS files | |
CSS_FINAL = css/project-name-all.css | |
STYLUS_TARGETS = css/file1.styl \ |
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
_.mixin({ | |
// This will parse a delimited string into an array of | |
// arrays. The default delimiter is the comma, but this | |
// can be overriden in the second argument. | |
CSVtoJSON: function( strData, strDelimiter ){ | |
// Check to see if the delimiter is defined. If not, | |
// then default to comma. | |
strDelimiter = (strDelimiter || ","); | |
// FIX: add an ending carriage return if missing |
NewerOlder