Skip to content

Instantly share code, notes, and snippets.

View reyhansofian's full-sized avatar

Reyhan Sofian reyhansofian

View GitHub Profile
@reyhansofian
reyhansofian / app.js
Last active February 24, 2019 11:07
Application server using configmap reload
// @ts-check
const express = require("express");
const app = express();
const fs = require("fs");
const bodyParser = require('body-parser');
const mountPath = "/etc/config";
const configMapFile = "..data";
@reyhansofian
reyhansofian / k8s.yaml
Created February 24, 2019 11:04
Kubernetes manifest using configmap reload container
apiVersion: v1
kind: Service
metadata:
labels:
test-app: test
name: test
namespace: default
spec:
externalTrafficPolicy: Cluster
ports:
apiVersion: v1
kind: Service
metadata:
labels:
test-app: test
name: test
namespace: default
spec:
externalTrafficPolicy: Cluster
ports:
// @ts-check
const express = require("express");
const app = express();
const fs = require("fs");
const bodyParser = require('body-parser');
// volume mount path
const mountPath = "/etc/config";
@reyhansofian
reyhansofian / SingletonEnforcer.js
Created December 11, 2017 01:49 — forked from uran1980/SingletonEnforcer.js
ES6 singleton pattern: use Symbol to ensure singularity
// http://stackoverflow.com/a/26227662/1527470
const singleton = Symbol();
const singletonEnforcer = Symbol();
class SingletonEnforcer {
constructor(enforcer) {
if (enforcer !== singletonEnforcer) {
throw new Error('Cannot construct singleton');
}
const express = require('express');
const { graphqlExpress, graphiqlExpress } = require('apollo-server-express');
const bodyParser = require('body-parser');
const bunyan = require('bunyan');
const mysql = require('mysql2');
const graphQLServer = express();
const logger = bunyan.createLogger({ name: 'server' });
const GRAPHQL_PORT = 3003;
if filereadable(glob(".vimrc.local"))
source .vimrc.local
endif
let g:neoformat_javascript_prettier = {
  \ 'exe': 'prettier',
  \ 'args': ['--single-quote'],
  \ 'replace': 0,
  \ 'stdin': 1,
  \ 'no_append': 1
  \ }
let g:neoformat_enabled_javascript = ['prettier']
// FilmDetail.js
import React, { Component, PropTypes } from 'react';
import { gql, graphql } from 'react-apollo';
import {
Text,
View,
} from 'react-native';
@graphql(gql`
query($id: ID!) {
@graphql(gql`
query($id: ID!) {
film(id: $id) {
title
openingCrawl
director
producers
releaseDate
}
}