Skip to content

Instantly share code, notes, and snippets.

View giautm's full-sized avatar
🐿️
Nice to meet you ʕ◔ϖ◔ʔ

Giau. Tran Minh giautm

🐿️
Nice to meet you ʕ◔ϖ◔ʔ
View GitHub Profile
@giautm
giautm / build-id.js
Created June 14, 2018 08:09
Next.JS Build-ID with last git commit
const fs = require('fs')
const path = require('path')
const { execFile } = require('child_process')
function lastCommitId(dir) {
return new Promise((resolve, reject) => {
const gitArgs = [
`--git-dir=${path.join(dir, '.git')}`,
`--work-tree=${dir}`,
'rev-parse',
directive @relayID(
type: String,
) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION
type User {
id: ID! @relayID
email: String!
name: String!
}
import { defaultFieldResolver } from 'graphql';
import { SchemaDirectiveVisitor } from 'graphql-tools';
import { createError } from 'apollo-errors';
export const UserPerms = Symbol('Get User Permissions');
export const NotAuthorizedAll = createError('NotAuthorized', {
message: 'Not authorized, required ALL of the permissions',
});
package gormrepo
import (
"context"
"reflect"
"github.com/jinzhu/gorm"
eh "github.com/looplab/eventhorizon"
"github.com/pkg/errors"
@giautm
giautm / App.js
Created February 6, 2018 08:25
Sketch App
import Expo from 'expo';
import * as ExpoPixi from 'expo-pixi';
import React, { Component } from 'react';
import { Image, StyleSheet, View } from 'react-native';
export default class App extends Component {
state = {
strokeColor: Math.random() * 0xffffff,
strokeWidth: Math.random() * 30 + 10,
};
@giautm
giautm / c
Last active December 23, 2017 05:12
Bug
import React from 'react';
import Link from 'next/link';
import { translate } from 'react-i18next';
import i18n from '../i18n';
import Frontend from '../components/frontend/Frontend/Frontend';
class Home extends React.Component {
render() {
return (
import {
defaultFieldResolver,
DirectiveNode,
GraphQLField,
GraphQLFieldResolver,
GraphQLResolveInfo,
GraphQLSchema,
} from 'graphql';
import { forEachField } from 'graphql-tools';
import { getArgumentValues } from 'graphql/execution/values';
import React, {Component} from 'react';
import {View, Text, Navigator, StatusBar} from 'react-native';
import SideMenu from './Router.js'
import Authentication from './Authentication/Authentication.js';
import Main from './Main/Main.js';
import ChangeInfo from './ChangeInfo/ChangeInfo.js';
import OrderHistory from './OrderHistory/OrderHistory.js';
export class SpecAsync {
async isSatisfiedBy(obj) {
return Promise.reject('isSatisfiedBy not implemented');
}
and(spec) {
return new AndSpecAsync(this, spec);
}
or(spec) {
/* @flow */
const defaultDiacriticsRemovalMap = [{
'base': 'A',
'letters': '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F'
}, {
'base': 'AA',
'letters': '\uA732'
}, {
'base': 'AE',
'letters': '\u00C6\u01FC\u01E2'