Skip to content

Instantly share code, notes, and snippets.

William Candillon wcandillon

Block or report user

Report or block wcandillon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View LoadAsset.tsx
import React, { useEffect, useState } from "react";
import { Asset } from "expo-asset";
import { AppLoading } from "expo";
export const usePromiseAll = <T extends any>(
promises: Promise<T>[],
cb: () => void
) =>
useEffect(() => {
(async () => {
View tsconfig.json
{
"compilerOptions": {
/* Basic Options */
"target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
// "module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["es6"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
"jsx": "react-native", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
View emoji-db.json
{
"🏻": {
"de": "Hautfarbe",
"it": "colore della pelle",
"fr": "peau",
"es": "piel",
"en": "light skin tone",
"pt": "modificador de emoji",
"zh_Hant": "白皮膚",
"ko": "피부 타입 일 다시 이",
View build-emoji-db.js
const fs = require("fs");
const languages = ["de", "it", "fr", "es", "en", "pt", "zh_Hant", "ko", "ja"];
const results = languages.map(lang => {
const result = {};
const txt = fs.readFileSync(`./synonyms/cldr-emoji-annotation-synonyms-${lang}.txt`, { encoding: "UTF-8"});
txt.split("\n")
.map(line => line.split("=>").map(token => token.trim()))
.filter(([emoji, metadata]) => metadata !== undefined)
.forEach(([emoji, metadata]) => {
View firebase.js
// @flow
import * as firebase from "firebase";
import "firebase/firestore";
const config = {
apiKey: "AIzaSyD",
authDomain: "react-native.firebaseapp.com",
databaseURL: "https://react-native.firebaseio.com",
projectId: "react-native",
storageBucket: "react-native.appspot.com",
@wcandillon
wcandillon / rn-init.sh
Last active Jul 12, 2019
Bootstrapping a React Native Project in 2019
View rn-init.sh
expo init $1
cd $1
yarn add @types/expo eslint eslint-config-react-native-wcandillon --dev
mv App.js App.tsx
curl -O https://gist.githubusercontent.com/wcandillon/10f40b913f1c63f357169b97473f9eb2/raw/45c677856ae512cbb8db41308de72d149fded5b4/tsconfig.json
curl -O https://gist.githubusercontent.com/wcandillon/f734fb532bffec0abc436749dd46c4bf/raw/c33de2df4b4fb4dec0b6f44e6aa1ceb5d7004141/.eslintrc
@wcandillon
wcandillon / wallet-animation.js
Created Sep 3, 2018
React Native Apple Wallet Animation
View wallet-animation.js
import React from "react";
import {
StyleSheet,
Text,
View,
ScrollView,
Animated,
SafeAreaView,
Dimensions
} from "react-native";
View Filter.js
// @flow
import * as React from "react";
import {Shaders, Node} from "gl-react";
import resolveAssetSource from "react-native/Libraries/Image/resolveAssetSource";
const shaders = Shaders.create({
Brannan: {
frag: `...`
}
});
View mobx-firestore.ts
import * as fb from "firebase";
import { computed, observable, runInAction } from "mobx";
type Query = fb.firestore.Query;
type DocumentReference = fb.firestore.DocumentReference;
type DocumentSnapshot = fb.firestore.DocumentSnapshot;
type LoadingDocumentSnapshot = DocumentSnapshot | undefined;
type Dictionary<T> = { [key: string]: T };
// type QuerySnapshot = fb.firestore.QuerySnapshot;
// type LoadingCollectionSnapshot = QuerySnapshot | undefined;
View UserStore.ts
import {User} from "./Model";
type Snapshot = firebase.database.DataSnapshot;
export default class UserStore {
constructor() {
FirebaseProvider.get().currentUserDBRef.on("value", (snapshot: Snapshot) => {
this.user = snapshot.val() as User;
});
}
}
You can’t perform that action at this time.