Skip to content

Instantly share code, notes, and snippets.

🎯
Beating the fuck out of Javascript with Reason

Peter Piekarczyk peterpme

🎯
Beating the fuck out of Javascript with Reason
Block or report user

Report or block peterpme

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@peterpme
peterpme / User.graphql
Last active Mar 1, 2018
User Mutation Clarification - imagine User having 20 keys, 5 of which are non-nullable (email_verified: Boolean!)
View User.graphql
type User = {
id: ID!
first_name: String
last_name: String
email_verified: Boolean!
}
input UpdateUserInput {
first_name: String
last_name: String
@peterpme
peterpme / Label.re
Last active Mar 3, 2018
Reason Label
View Label.re
open BsReactNative;
let component = ReasonReact.statelessComponent("Label");
let styles =
StyleSheet.create(
Style.(
{
"container":
style([
@peterpme
peterpme / bsconfig.json
Created Feb 27, 2018
React Native + ReasonML bsconfig.json
View bsconfig.json
{
"name": "altos-react-native",
"reason": {"react-jsx" : 2},
"bsc-flags": ["-bs-super-errors"],
"package-specs": [{
"module": "commonjs",
"in-source": true
}],
"suffix": ".bs.js",
"namespace": true,
@peterpme
peterpme / ScrollView.js
Created Feb 3, 2018
React Native ScrollView & flexGrow
View ScrollView.js
const Layout = () => (
<ScrollView
contentContainerStyle={{
flexGrow: 1,
justifyContent: 'space-between'
}}>
<Row />
<Row />
<Row />
<Row />
@peterpme
peterpme / ScrollView.js
Last active Feb 3, 2018
React Native's ScrollView Tricks
View ScrollView.js
const Layout = () => (
<ScrollView
contentContainerStyle={{
flex: 1,
justifyContent: 'space-between'
}}>
<Row />
<Row />
<Row />
<Row />
@peterpme
peterpme / environment.js
Last active Jun 1, 2018
Psuedo Environment Variables using Expo Release Channels
View environment.js
import { Constants } from 'expo'
const ENV = {
dev: {
apiUrl: 'http://localhost:1337/api'
},
staging: {
apiUrl: 'https://staging.orchard.ai/api'
},
prod: {
@peterpme
peterpme / updateResponse.js
Created Dec 30, 2017
React Apollo updateResponse Question
View updateResponse.js
updateUser: (variables) => {
return mutate({
variables,
// when using optimisticResponse and I don't include the values, I get a warning.
optimisticResponse: {
updateUser: {
__typename: 'User',
id: 'xyz',
setting: undefined,
View keybase.md

Keybase proof

I hereby claim:

  • I am peterpme on github.
  • I am peterpme (https://keybase.io/peterpme) on keybase.
  • I have a public key ASDd9ipiMIdjkzvqnBaqXLvRHaN2-tVZtgHng-YSVYRv4Ao

To claim this, I am signing this object:

View apollo-tote-loading.js
<ApolloTote
query={`
query {
user {
imageUrl
}
}
`}
renderLoading={() => <Avatar.Loading />}
render={value => <Avatar imageUrl={value.user.imageUrl} />}
View apollo-tote-authorization.js
<ApolloTote
query={`
query {
user {
id
}
}
`}
test={data => !!(data && data.user && data.user.id)}
handleFail={() => Store.dispatch({ type: 'LOG_OUT' })}
You can’t perform that action at this time.