View styled-components-typescript-samples.tsx
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 styled from 'styled-components'; // 4.1.1 | |
import * as React from "react"; | |
type SizeProp = { size: number }; | |
const A = styled.div<SizeProp>` | |
height: ${props => props.size}px; | |
`; | |
const Ac = () => <A size={99} />; |
View flowType.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
/* @flow */ | |
import React, {PureComponent} from 'react'; | |
import type {Node} from 'react'; // Here's how to import the FlowType for Node (rendered react classes or null) | |
// Simple Component with Flow | |
type PropsType = { | |
a: string, | |
b: number, | |
}; |
View iterm-display-folder-name-in-tab-bash-profile.sh
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
##### | |
# iTerm - Display the current folder name at the top of tabs, and update when changing directory. | |
# | |
# Based on https://gist.github.com/phette23/5270658, with suggestions from the commments there | |
##### | |
addToPromptCommand() { | |
if [[ ":$PROMPT_COMMAND:" != *":$1:"* ]]; then | |
PROMPT_COMMAND="${PROMPT_COMMAND:+"$PROMPT_COMMAND:"}$1" | |
fi |
View Main.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
import {rootNavigatorSelector} from './navigation/router'; | |
import Store from './redux/store'; | |
// Connect `rootNavigatorSelector` to redux. | |
const ConnectedMain = connect(state => ({ | |
Layout: rootNavigatorSelector(state), | |
}))(Main); | |
// App root component | |
class Root extends PureComponent { |
View ConfigureStore.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
/** | |
* Creates and configures the Redux Store | |
*/ | |
import {createStore, applyMiddleware, compose} from 'redux'; | |
import thunkMiddleware from 'redux-thunk'; // useful for networking actions | |
import createLogger from 'redux-logger'; // log out each action | |
import {persistStore, autoRehydrate} from 'redux-persist'; | |
import rootReducer from './reducers'; // this combines all reducers into one | |
import {AsyncStorage} from 'react-native'; | |
import Console from '../Console'; |
View Root.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
// Your main root component | |
import React, {Component} from 'react-native'; | |
export class Root extends Component { | |
//.. | |
} |
View artifacts.gradle.txt
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
// Makes the APKs we build be called AppName-release-buildVariant-1.2.3_4.apk | |
// | |
// To use, add this file to the root of your project (next to gradle.properties) make sure the name is artifacts.gradle. | |
// Then edit gradle.properties to include: `applicationName=MyAppName` | |
// Then edit module build.gradle, add at the end `apply from: "../artifacts.gradle"` | |
// | |
// Adapted slightly from https://www.jayway.com/2015/03/13/producing-better-named-android-apks-with-gradle/ | |
android.applicationVariants.all { variant -> | |
def appName | |
//Check if an applicationName property is supplied; if not use the name of the parent project. |
View androidWifiDebug.sh
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
# Connect Android Device via USB cable | |
# Type in terminal | |
adb tcpip 5555 | |
# > restarting in TCP mode port: 5555 | |
# Find android device's IP with (Settings/About/Status) | |
adb connect X.X.X.X |
View react-native-keyboard-show-resize.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
'use strict'; | |
const React = require('react-native'); | |
const { | |
DeviceEventEmitter, | |
LayoutAnimation, | |
Dimensions, | |
} = React; |
NewerOlder