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
fun syncPets() = repository.syncPets() |
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
syncPets.setOnClickListener({ | |
launch(UI) { | |
syncPets.isEnabled = false | |
val message = petViewModel.syncPets() | |
Toast.makeText(baseContext, message, Toast.LENGTH_LONG).show() | |
syncPets.isEnabled = 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
launch { | |
delay(1000) | |
println("Hello from Kotlin Coroutines!") | |
} |
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
import React, { Component } from 'react'; | |
import { Redirect } from 'react-router-dom'; | |
import { graphql } from 'react-apollo'; | |
import gql from 'graphql-tag'; | |
import { sanitize } from '../commons/HtmlSanitizer'; | |
class Page extends Component { | |
render() { | |
const props = this.props; |
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { BrowserRouter } from 'react-router-dom'; | |
import { ApolloProvider } from 'react-apollo'; | |
import { ApolloClient } from 'apollo-client'; | |
import { HttpLink } from 'apollo-link-http'; | |
import { InMemoryCache } from 'apollo-cache-inmemory'; | |
const client = new ApolloClient({ | |
link: new HttpLink({ uri: 'http://localhost:5010/graphql' }), |
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
setImageSize(width, height){ | |
if (this.props.width && !this.props.height) { | |
this.setState({ | |
width: this.props.width, | |
height: height * (this.props.width / width) | |
}); | |
} else if (!this.props.width && this.props.height) { | |
this.setState({ | |
width: width * (this.props.height / height), | |
height: this.props.height |
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
componentWillMount(){ | |
if (this.props.source.uri){ | |
Image.getSize(this.props.source.uri, (width, height) => { | |
this.setImageSize(width, height); | |
}); | |
} else { | |
let {width, height} = resolveAssetSource(this.props.source); | |
this.setImageSize(width, height); | |
} | |
} |
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 hello_world = require('bindings')('hello_world') | |
console.log(hello_world.sayHi()); |
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
{ | |
"targets": [ | |
{ | |
"cflags!": [ "-fno-exceptions" ], | |
"cflags_cc!": [ "-fno-exceptions" ], | |
"include_dirs" : [ | |
"<!@(node -p \"require('node-addon-api').include\")" | |
], | |
"target_name": "hello_world", | |
"sources": [ "hello_world.cc" ], |