Skip to content

Instantly share code, notes, and snippets.

View yusinto's full-sized avatar
🎯
Focusing

Yusinto Ngadiman yusinto

🎯
Focusing
View GitHub Profile
@yusinto
yusinto / ecsCreateService_error.log
Created August 26, 2016 04:30
ecs/CreateService InvalidParameterException: A host port mapping for the container port 80 is required
DEBUG aws-sdk-go DEBUG: Request ecs/CreateService Details:
DEBUG --- REQUEST POST-SIGN -----------------------------
DEBUG POST / HTTP/1.1
DEBUG Host: ecs.ap-southeast-2.amazonaws.com
DEBUG User-Agent: terraform/0.7.1 aws-sdk-go/1.4.1 (go1.7; darwin; amd64)
DEBUG Content-Length: 528
DEBUG Authorization: xxx
DEBUG Content-Type: application/x-amz-json-1.1
DEBUG X-Amz-Date: 20160825T130303Z
DEBUG X-Amz-Target: AmazonEC2ContainerServiceV20141113.CreateService
@yusinto
yusinto / routes.js
Created October 3, 2017 02:49
Example routes with apollo
<Route path="/" component={App}>
<IndexRoute component={Home} />
<Route path="example-path">
<IndexRoute component={ExampleLanding} />
</Route>
<Route path="/apollo-path">
<IndexRoute component={ApolloLanding} />
</Route>
<Route path="*" component={NotFoundPage} />
</Route>
@yusinto
yusinto / ApolloLanding.js
Created October 3, 2017 03:11
Example apollo landing component
import {createNetworkInterface, ApolloClient, ApolloProvider} from 'react-apollo';
import {SubscriptionClient} from 'subscriptions-transport-ws';
import {addGraphQLSubscriptions} from 'add-graphql-subscriptions';
let networkInterface = createNetworkInterface({uri: config.graphcool.simpleApi});
const wsClient = new SubscriptionClient(config.graphcool.subscriptions, {
// See https://github.com/apollographql/subscriptions-transport-ws/issues/220
// for why the timeout should be set to 30000.
timeout: 30000,
reconnect: true,
@yusinto
yusinto / updateCountry_fetch.js
Last active June 3, 2024 15:05
Graphql mutation with fetch
const updateCountryFetch = async (countryId, happinessFactor, population) => {
const query = JSON.stringify({
query: `mutation {
updateCountry(
id: "${countryId}"
happinessFactor: ${happinessFactor}
population: ${population}) { id }
}
`
});
@yusinto
yusinto / updateCountry_graphql-request.js
Last active August 4, 2021 19:13
Graphql mutation using graphql-request
const updateCountryGraphqlRequest = async (countryId, happinessFactor, population) => {
const query = `
mutation updateCountry ($countryId: ID!, $happinessFactor: Int!, $population: Int!) {
updateCountry(id: $countryId, happinessFactor: $happinessFactor, population: $population) { id }
}
`;
const variables = {
countryId,
happinessFactor,
population,
@yusinto
yusinto / cloudbuild.yaml
Last active September 1, 2019 08:21
Example container builder cloudbuild.yaml for GKE demo.
steps:
- name: ubuntu
id: generate-image-tag
entrypoint: bash
args:
- '-c'
- echo $(date) | md5sum | awk '{print $1}' > tag.txt
- name: gcr.io/cloud-builders/docker
id: docker-build-push
@yusinto
yusinto / deployment-template.yaml
Last active March 21, 2018 04:42
Kubernetes minimal deployment template to deploy a vue node js app
kind: Deployment
apiVersion: apps/v1beta1
metadata:
name: _BRANCH_NAME-deployment
labels:
branchName: _BRANCH_NAME
spec:
replicas: 2
selector:
matchLabels:
@yusinto
yusinto / promises-promises.js
Created April 6, 2018 00:25
reactjunkie.com promises promises
const p = new Promise(
// this is called the "executor"
(resolve, reject) => {
console.log(1);
resolve(2);
console.log(3);
}
);
console.log(4);
@yusinto
yusinto / index.js
Last active April 13, 2018 11:30
Cloud functions emulator demo
const greet = (req, res) => {
console.log('hello world from the emulator!');
res.send('ok google');
};
module.exports = {
greet,
};
@yusinto
yusinto / .graphqlconfig.yml
Created April 28, 2018 06:10
Sample .graphqconfig.yml for relay schema stitching
schemaPath: ./remote.schema.graphql
extensions:
endpoints:
default:
url: https://eu1.prisma.sh/public-nickelwarrior-830/wendarie-prisma/dev