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 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 ( |
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 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, | |
}; |
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
package gormrepo | |
import ( | |
"context" | |
"reflect" | |
"github.com/jinzhu/gorm" | |
eh "github.com/looplab/eventhorizon" | |
"github.com/pkg/errors" |
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 { 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', | |
}); |
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
directive @relayID( | |
type: String, | |
) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION | |
type User { | |
id: ID! @relayID | |
email: String! | |
name: String! | |
} |
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 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', |
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 { vec2 } from 'gl-matrix'; | |
const ZERO_VECTOR = vec2.create(); | |
function linePerpendicularToLine(out, vec, middlePoint, weight) { | |
if (weight <= 0 || vec2.equals(vec, ZERO_VECTOR)) { | |
vec2.copy(out[0], middlePoint); | |
vec2.copy(out[1], middlePoint); | |
} else { | |
const perpendicular = vec2.fromValues(vec[1], -vec[0]); |
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 firebase from 'firebase' | |
export function defaultDirectKey(users) { | |
return users.sort().join('-') | |
} | |
class Firechat { | |
constructor(firebaseRef, options = {}) { | |
this.directKey = options.directKey || defaultDirectKey | |
this.maximumMessagesFetch = options.maximumMessagesFetch || 100 |
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 MOBILE_REGEXP = /^(\+84|0)(3[2-9]|5[2689]|7[06-9]|8[1-5])[0-9]{7}$/ | |
const PREFIX_CARRIERS = { | |
viettel: ["32","33","34","35","36","37","38","39"], | |
mobifone: ["70","79","77","76","78"], | |
vinaphone: ["83","84","85","81","82"], | |
vietnamobile: ["52","56","58"], | |
gmobile: ["59"] | |
}; | |
function phoneCarrier(phone) { |
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 { Linking, Platform } from 'react-native' | |
export const maybeOpenURL = async ( | |
url, | |
config, | |
) => { | |
Linking.openURL(url).catch((err) => { | |
if (err.code === 'EUNSPECIFIED') { | |
openInStore({ | |
appStoreLocale: 'us', |