- install appcenter cli https://github.com/Microsoft/appcenter-cli
appcenter login
- update
"name": "GNCUAT",
in package.json - add
"react-native": "0.0.0",
to dependencies in package.json appcenter codepush release-react -a Branding-Brand/GNCIOS -d Latest
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
/** | |
* | |
* Util function to create type safe state management store with useContext and useReducer. | |
* The mechanism is described by https://kentcdodds.com/blog/how-to-use-react-context-effectively/ | |
* | |
*/ | |
import React, { useReducer, createContext, useContext } from 'react'; | |
export type ContextProviderProps = { children: React.ReactNode }; |
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
function notNullOrUndefined<T>(x: T | null | undefined): x is T { | |
return x !== null && x !== undefined; | |
} | |
const arr = [1, 2, null, undefined]; // (number | null | undefined)[] | |
const arrFiltered = arr.filter(notNullOrUndefined); // number[] |
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
function foo(): null; | |
function foo(a: number): string; | |
function foo(a?) { | |
if (typeof a === 'number') { | |
return '123'; | |
} else { | |
return null; | |
} | |
} |
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
function sampleArray(arr, num) { | |
if (arr.length <= num) { | |
return arr; | |
} else { | |
const every = Math.floor(arr.length / num); | |
const sampleIndex = Array(num) | |
.fill(0) | |
.map((_, i) => i * every); | |
// keep last element |
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
FROM node:10-alpine | |
# Installs Python 3 | |
RUN apk add --no-cache python3 && \ | |
python3 -m ensurepip && \ | |
rm -r /usr/lib/python*/ensurepip && \ | |
pip3 install --upgrade pip setuptools && \ | |
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \ | |
if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \ | |
rm -r /root/.cache |
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 express = require('express'); | |
const path = require('path'); | |
const fs = require('fs'); | |
const proxy = require('http-proxy-middleware'); | |
const app = express(); | |
const proxyConfig = require('./proxy-remote.conf.json'); | |
const port = 4200; | |
const ngBuildPath = path.join(__dirname, 'dist/projectAbc'); | |
const ngBuildIndex = fs |
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 express = require('express'); | |
const path = require('path'); | |
const fs = require('fs'); | |
const proxy = require('http-proxy-middleware'); | |
const app = express(); | |
const proxyConfig = require('./proxy-remote.conf.json'); | |
const port = 4200; | |
const ngBuildPath = path.join(__dirname, 'dist/projectAbc'); | |
const ngBuildIndex = fs |
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
type typeA = { a: string }; | |
type typeB = { b: string }; | |
type typeAorB = typeA | typeB; | |
// type check for union type | |
function isA(foo: typeA | typeB): foo is typeA { | |
return (<typeA>foo).a !== undefined; | |
} | |
// usage |
NewerOlder