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
/* @flow */ | |
/* eslint-disable */ | |
import mongoose from 'mongoose'; | |
export type MongoId = typeof mongoose.Types.ObjectId | { | |
toString(): string, | |
}; | |
export type MongoOrScalarId = MongoId | string | 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 Timer() { | |
const startTime = React.useRef(performance.now()); | |
const [time, setTime] = React.useState(performance.now()); | |
React.useEffect(() => { | |
const id = setTimeout(() => { | |
ReactDOM.flushSync(() => { | |
setTime(performance.now()); | |
}); | |
}, 2); |
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
// Example of what data masking gets us with Relay | |
const AdminList = createFragmentContainer( | |
(props) => <div> | |
{props.admins.map((admin) => <div>{admin.name}</div>)} | |
</div>, | |
{ | |
admins: graphql` | |
fragment AdminList_admins on User @relay(plural: true) { | |
name |
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
git diff master... --name-only | grep -E '.js$' | xargs ./node_modules/eslint/bin/eslint.js |
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 readline = require('readline'); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
terminal: false | |
}); | |
const paths = [ | |
{ path: 'graphql/connection/', tag: 'Connection' }, |
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
// @flow | |
import { ConnectionHandler } from 'relay-runtime'; | |
import { isObject, isArray } from 'lodash/fp'; | |
export function listRecordRemoveUpdater({ parentId, itemId, parentFieldName, store }) { | |
const parentProxy = store.get(parentId); | |
const items = parentProxy.getLinkedRecords(parentFieldName); | |
parentProxy.setLinkedRecords(items.filter(record => record._dataID !== itemId), parentFieldName); | |
} |
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
// Call this in MainApplication.onCreate(), just after Soloader line. | |
private static void initialize(Context context) { | |
if (BuildConfig.DEBUG) { | |
try { | |
/* | |
We use reflection here to pick up the class that initializes Flipper, | |
since Flipper library is not available in release mode | |
*/ | |
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); | |
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); |
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 adb_connect { | |
# PORT used to connect. Default: 5555 | |
PORT=${1:-5555} | |
# IP address from current device connected | |
IP_ADDRESS=`adb shell ip route | awk '{print $9}'` | |
echo "ADB connect to $IP_ADDRESS on port $PORT" | |
# Change connection from usb to tcpip using $PORT |
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 { useEffect, useRef } from 'react'; | |
export const useEventEmitter = (eventEmitter, eventName: string, fn: () => void) => { | |
const subscription = useRef(null); | |
useEffect(() => { | |
subscription.current = eventEmitter.addListener(eventName, fn); | |
return () => { | |
if (subscription.current) { |
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
/** | |
* RCTNativeTestModuleSpec.h | |
* | |
* NOTE: This file is codegenerated. | |
*/ | |
#import <vector> | |
#import <Foundation/Foundation.h> |
OlderNewer