Skip to content

Instantly share code, notes, and snippets.

View watanabeyu's full-sized avatar
🥟
餃子

Yu Watanabe watanabeyu

🥟
餃子
View GitHub Profile
import React from 'react';
import {
Text,
TouchableOpacity,
Image,
View,
FlatList,
Dimensions,
StatusBar,
} from 'react-native';
package main
import (
"fmt"
"image"
_ "image/jpeg"
_ "image/png"
"log"
"net/http"
)
@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>
);
@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 / 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:
.ms-slide-info{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0 !important;
min-height: 0 !important;
display: flex;
justify-content: center;
align-items: center;
@watanabeyu
watanabeyu / component.js
Last active November 15, 2017 06:51
react High Order Components
import React from 'react';
import {
View,
Text,
TouchableOpacity,
Alert
} from 'react-native';
import hoc from './hoc';
@watanabeyu
watanabeyu / scraping.go
Created August 28, 2017 10:47
scraping and spreadsheet
package main
import (
"io/ioutil"
"os"
"regexp"
"strconv"
"strings"
"time"
@watanabeyu
watanabeyu / promise_settimeout.js
Last active May 11, 2017 03:59
ssrでfetchしてるときにあえてsetTimeout使って遅らせたいときの、setTimeoutの書き方
return new fetch(`/hogehoge`)
.then(response => {
return response.json().then(json => ({ status: response.status, json }))
})
.then(r => {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log("settimeout finish")
resolve(0)
return dispatch({ type: "FINISH" })
const formData = new FormData()
formData.append("hoge","hogehoge")
formData.append("foo","bar")
fetch("url", {
headers:{
'Accept': 'application/json, */*',
//'Content-type':'application/json'
},
method:"post",