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
func LoadParsers(customParsers map[reflect.Type]Parser) (map[reflect.Type]Parser, error) { | |
parsers := map[reflect.Type]Parser{} | |
var boolParser BoolValue | |
parsers[reflect.TypeOf(true)] = &boolParser | |
var intParser IntValue | |
parsers[reflect.TypeOf(1)] = &intParser | |
var int64Parser Int64Value |
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
My presentational components: | |
Are concerned with how things look. | |
May contain both presentational and container components** inside, and usually have some DOM markup and styles of their own. | |
Often allow containment via this.props.children. | |
Have no dependencies on the rest of the app, such as Flux actions or stores. | |
Don’t specify how the data is loaded or mutated. | |
Receive data and callbacks exclusively via props. | |
Rarely have their own state (when they do, it’s UI state rather than data). | |
Are written as functional components unless they need state, lifecycle hooks, or performance optimizations. |
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 colors:Array = ["red","blue","green"]; | |
var buttons:Array = new Array(); | |
function colorSwitch(frame:Number) { | |
return function(e:MouseEvent) { | |
color.gotoAndStop(frame); | |
} | |
} | |
for (var i=0;i<colors.length;i++) { | |
buttons[i]=new button; | |
buttons[i].y=30*i; |
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 click(frame:Number) { | |
return function(e:MouseEvent) { | |
if(e.target.currentFrame == 1) { | |
e.target.gotoAndStop(frame); | |
} else { | |
e.target.gotoAndStop(1); | |
} | |
} | |
} | |
button1.addEventListener(MouseEvent.CLICK,click(2)); |
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 click(e:MouseEvent) { | |
if(e.target.currentFrame == 1) { | |
e.target.gotoAndStop(2); | |
} else { | |
e.target.gotoAndStop(1); | |
} | |
} | |
button1.addEventListener(MouseEvent.CLICK,click); | |
button2.addEventListener(MouseEvent.CLICK,click); |
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
button1.addEventListener(MouseEvent.CLICK, function(e:MouseEvent) { | |
if(button1.currentFrame == 1) { | |
button1.gotoAndStop(2); | |
} else | |
button1.gotoAndStop(1); | |
} | |
}); | |
button2.addEventListener(MouseEvent.CLICK, function(e:MouseEvent) { | |
if(button2.currentFrame == 1) { | |
button2.gotoAndStop(2); |
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
toggleDetails() { | |
this.setState({ | |
showDetails: !this.state.showDetails | |
}); | |
} |
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
func badtype(expected string, data interface{}) error { | |
return e("cannot load TOML value of type %T into a Go %s", data, expected) | |
} |
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
if item, ok := cmd.Commands[parms[0]]; ok { |
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
s := string(byteArray[:]) |