This file contains hidden or 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
| export class About extends React.Component { | |
| ... | |
| animate(show) { | |
| if (show) { | |
| this.contentStyle = { opacity: 1, transform: 'translateY(-50%)' }; | |
| } else { | |
| this.contentStyle = { opacity: 0, transform: 'translateY(-40%)' }; | |
| } | |
| // wait for animation to finish |
This file contains hidden or 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
| terraform init -backend-config=config.tfvars | |
| terraform plan -var-file=main.tfvars -out main.tfplan | |
| terraform apply main.tfplan |
This file contains hidden or 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 str = 'cd0148035c000f01d20097002b0185030000000000000000000000000000000000000000000000008403dd0159022d033c0334036d0349038503000000000000000000000000000084034b03da00d40077008503000000008403480303003e009c0045002a016c016200860185030000000000000000000000000000000000000000000000000000000000008403b40055017e00c10185030000000000000000000000000000000000000000000000000000000084031c028901fe0185030000000000000000000000000000000000000000000000000000000000008403260026000d001d00850300000000000000000000000000000000000000000000000000000000840348034d038603b600400268029000e402850384005c02d7029502ff0101006e026f008001100307014701a90297003b0386008c005d008a00840341036c034500fd01850315017a002a01d101d100d2008002510353037c006e00df002c0239039b027c00f702d200e9016d01f0001e021303c201d000a800460206013c02de028d00de01b20119022902ca0002019400f00121020801ea00d4019f027c03d00074031a022e010d009c006d036802ed01cc008800d002ec0120017a018f00c0007100c50084036e034e035b036603fb026c038503f9000b013201a10197013d013a02d8003402de002b015e011a02230096012b0 |
This file contains hidden or 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 bsc = []; | |
| bsc.push(Buffer.from('30333239313730353139000000000000000000000000000050756244534b5f3100000000000000003337383732330000303033323235363239394d4544494e41000000000000000000000000000000000047414c4c45474f0000000000000000000000000000000053414e445241000000000000000000000000000000000042494249414e4100000000000000000000000000000000304631393833303630333039303334304f2b0032024301025aff80809d278f606d67868c5d8a785d636a71a55f55ca51b57dbc6dbd735841c99374477f4a7f21648f718f9296ac5b8864a28bab3fae54746695a9ad78b5606f65a19db07eb65a387cb443b76c655dab8fbe4bc051a1afaaa0ba8fc071c56036543b5a4e5d94c2a9acba7bbd89c488c8aeb2a6cdb9a8c2b2bc8dcac9cc7e577c2c831d78487e44893d7bc93c4df6f6ff430821a2202049b78aff00370242011759ff80809497969d859b7bbf7d9477ab43b9458f4eba3ba253843396437fbfbfc355cd72386ebd9ec05ec389c569c043c37cdd617978b56ab873b986ba506f6cb258b38c4c5fa941b87fab99b0667866a45251305a4ba664a97bac917e595bbe80c983c59fc2acabe24c488d408ae45db5add3b4dab1cfbfd66cd0c5d6c8a73f38644a5d6f729271aee9d206c1082292a0ffa7cd25521defff0000002513 |
This file contains hidden or 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 withToggle(Component) { | |
| function Wrapper(props, ref) { | |
| return ( | |
| <Toggle.Consumer> | |
| {toggleContext => ( | |
| <Component toggle={toggleContext} {...props} ref={ref} /> | |
| )} | |
| </Toggle.Consumer> | |
| ) | |
| } |
This file contains hidden or 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
| class Toggle extends React.Component { | |
| static Consumer = ToggleContext.Consumer | |
| toggle = () => | |
| this.setState( | |
| ({on}) => ({on: !on}), | |
| () => this.props.onToggle(this.state.on), | |
| ) | |
| state = {on: false, toggle: this.toggle} | |
| render() { | |
| return ( |
This file contains hidden or 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
| // Example - prop drilling through nested rendering | |
| const Name = ({ name }) => <Text>{name}</Text>; | |
| const Block = ({ name }) => <View><Name name={name} /></View>; | |
| const Bar = ({ name }) => <View><Block name={name} /></View>; | |
| const Nav = ({ name }) => <View><Bar name={name} /></View>; |
This file contains hidden or 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
| // Example | |
| /* stylesheet definition */ | |
| export const redStyle = { color: 'red' }; | |
| /* component */ | |
| import { redStyle } from './colorStyle'; |
This file contains hidden or 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
| // Spot the semantic error | |
| export const stopEpic = action => action.pipe( | |
| ofType(STOP), | |
| switchMapTo(stop().pipe( | |
| mapTo(new StopAction()), | |
| catchError(() => of(new StopFailureAction())), | |
| )), | |
| ); |
This file contains hidden or 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
| export class FunctionWithArgumentsComponent extends React.Component { | |
| doSomethingWithColor = color => () => {}; | |
| style = { color: this.props.color }; | |
| render() { | |
| return <View style={this.style} onPress={this.doSomethingWithColor(this.props.color)} />; | |
| } | |
| } | |
| // -- Or as a stateless functional component -- |