Skip to content

Instantly share code, notes, and snippets.

View watanabeyu's full-sized avatar
🥟
餃子

Yu Watanabe watanabeyu

🥟
餃子
View GitHub Profile
@watanabeyu
watanabeyu / ffmpeg-download.config
Created February 1, 2018 09:25
elastic beanstalkでffmpegをインストールするためのebextensionsコンフィグ(.ebextensions/ffmpeg-download.config)
packages:
yum:
ImageMagick: []
ImageMagick-devel: []
container_commands:
01-wget:
command: "wget -O /tmp/ffmpeg.tar.xz https://johnvansickle.com/ffmpeg/release-source"
02-mkdir:
command: "if [ ! -d /opt/ffmpeg ] ; then mkdir -p /opt/ffmpeg; fi"
03-tar:
@watanabeyu
watanabeyu / MainTabNavigator.js
Created February 9, 2018 06:20
react-navigationのtabNavigatorの背景色を変更する
const tabNavigator = TabNavigator(
{
Home: { screen: HomeScreen },
Search: { screen: HomeScreen }
},
{
tabBarOptions: {
showLabel: false,
activeTintColor: '#333',
inactiveTintColor: '#bbb',
@watanabeyu
watanabeyu / context0.js
Created March 30, 2018 02:52
React16.3.0
// Create a theme context, defaulting to light theme
const ThemeContext = React.createContext('light');
function ThemedButton(props) {
// The ThemedButton receives the theme from context
return (
<ThemeContext.Consumer>
{theme => <Button {...props} theme={theme} />}
</ThemeContext.Consumer>
);
package main
import (
"fmt"
"image"
_ "image/jpeg"
_ "image/png"
"log"
"net/http"
)
import React from 'react';
import {
Text,
TouchableOpacity,
Image,
View,
FlatList,
Dimensions,
StatusBar,
} from 'react-native';
import React from 'react';
import { TextInput as Input } from 'react-native';
export default class TextInput extends React.Component {
static defaultProps = {
onFocus: () => { },
}
constructor(props) {
super(props);
@watanabeyu
watanabeyu / progress-fetch.js
Last active October 3, 2018 09:54
progress fetch
const progressFetch = (url, options = {}, onProgress = {}) => new Promise((res, rej) => {
const xhr = new XMLHttpRequest();
xhr.open(options.method || 'post', url);
Object.keys(options.headers || {}).forEach((k) => {
xhr.setRequestHeader(k, options.headers[k]);
});
xhr.onload = e => res(e.target.responseText);
xhr.onerror = rej;
import React from 'react';
import { BottomTabBar } from 'react-navigation-tabs';
const TabBar = (props) => {
const { navigation = {} } = props;
const { state = {} } = navigation;
let newProps = props;
if (state.index === 0) {
newProps = Object.assign(
import * as React from 'react';
import { Text, View, StyleSheet,TouchableOpacity,CameraRoll,Linking } from 'react-native';
import { Constants,FileSystem,Permissions } from 'expo';
export default class App extends React.Component {
onPress = async () => {
const filePath = `${FileSystem.documentDirectory}share-movie.mp4`;
const res = await FileSystem.downloadAsync('http://techslides.com/demos/sample-videos/small.mp4', filePath);
// const i = await FileSystem.getInfoAsync(res.uri);
// console.log(i);
import uuid from 'uuid';
import * as firebase from 'firebase';
import 'firebase/firestore';
firebase.initializeApp(config);
firebase.firestore().settings({ timestampsInSnapshots: true });
const uploadFileAsync = async (uri) => {
const ext = uri.split('.').slice(-1)[0];
const path = `file/${this.uid}/${uuid.v4()}.${ext}`;