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
var Manager = function (obj) { | |
this.target = obj; | |
this.history = []; | |
this.step = -1; | |
return this; | |
} | |
Manager.prototype.set = function (key, value) { | |
var me = this, | |
target = me.target; |
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
/** | |
* @date 2015/3/21 | |
* @author Dolphin | |
* | |
* Callback 风格的文件合并 | |
*/ | |
var fs = require('fs'); | |
function getFilesInDir(dir, cb) { |
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
/** | |
* An implementation for Quicksort. Doesn't | |
* perform as well as the native Array.sort | |
* and also runs the risk of a stack overflow | |
* | |
* Tests with: | |
* | |
* var array = []; | |
* for(var i = 0; i < 20; i++) { | |
* array.push(Math.round(Math.random() * 100)); |
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 getCommonParent(el1,el2){ | |
var parents1 = []; | |
var el = el1; | |
while(el) { | |
parents1.unshift(el); | |
el = el.parentNode; | |
} | |
var parents2 = []; |
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
/** | |
* @decorator | |
* Attach events to DOM element | |
* | |
* @param {Element|Function} elemOrFunc: DOM Element, or a function returns element | |
* @param {String} events: a list events separated with ',' | |
* | |
* Usage: | |
* @attachEvents(window, 'click') | |
* handleWindowClick(evt) { |
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
/* | |
* Usage: | |
* | |
* As a decorator: | |
* | |
* import defaultTheme from './style.scss'; | |
* | |
* @themr(defaultTheme) | |
* class Comp extends React.Component { ... } | |
* |
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
/** | |
* Optimize hybrid controlled component by add some method into proto | |
* | |
* Usage: | |
* @hybridCtrl | |
* class App extends React.Component { | |
* ... | |
* } | |
* | |
* @hybridCtrl('specified_prop_to_assign') |
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
@storeRefs | |
class Demo extends React.Component { | |
doSomething() { | |
this.buttonRef.kill(); | |
} | |
render() { | |
return ( | |
<Button refs={this.storeRefAs('buttonRef')}>blabla</Button> | |
); |
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
{ | |
"keys": ["tab"], | |
"command": "expand_abbreviation_by_tab", | |
// put comma-separated syntax selectors for which | |
// you want to expandEmmet abbreviations into "operand" key | |
// instead of SCOPE_SELECTOR. | |
// Examples: source.js, text.html - source | |
"context": [ | |
{ |
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
// demo config | |
const color = 'rgba(255, 0, 255, 1)'; | |
const radius = 50; | |
const offsetX = 50; | |
const offsetY = 50; | |
const width = 200; | |
const height = 100; | |
const dx = 100; | |
const dy = 100; |
OlderNewer