Skip to content

Instantly share code, notes, and snippets.

View voratham's full-sized avatar
🤔
finding learning new thing ?

Voratham.Siri voratham

🤔
finding learning new thing ?
View GitHub Profile
@voratham
voratham / react native maps
Last active January 23, 2018 05:14
react-native-maps getCurrentLocation and general rules => Not Move when add multiple marker via socket , setInterval
<MapView
style={{...StyleSheet.absoluteFillObject}}
ref={map => {
this.map = map;
}}
minZoomLevel={2}
maxZoomLevel={20}
provider={MapView.PROVIDER_GOOGLE}
initialRegion={this.state.initialRegionState}
showsUserLocation={true}
const redis = require("redis"),
client = redis.createClient();
var myLocation = { latitude : 13.617531, longitude : 100.623084 }
var taxi1 = { name : "taxi1" , latitude : 13.627457, longitude : 100.627518}
var taxi2 = { name: "taxi2" , latitude : 13.744965, longitude : 100.638121 }
var taxi_all = [ taxi1 , taxi2 ]
console.log('taxi_all :: ' , taxi_all);
@voratham
voratham / code_back_handler.js
Created February 13, 2018 05:22
react-native-navigation-wix backhandler
// ในทุกอน่าสามารถแทรก onNavigatorEvent ให้มันเพื่อดัก event แต่ละหน้า
// วิธีการคือ นำ Backhandler ของ react-native core มาใช้เพื่อสร้าง event ก่อนที่จะแสดงหน้าผลปัจจุบัน
// ที่นี่ ในหน้าที่แสดงหน้าแรก จะมี event backhandler โผล่มา ที่นี่ถ้าจะ push ไปหน้าอื่น ก็ลบทิ้งซะ จบบบ
constructor(props){
if(Platform.OS === 'android'){
this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
}
@voratham
voratham / Podfile_react_native_on_work
Created February 13, 2018 05:24
Podfile pod install สำหรับการตั้ง project บน react-native ที่ใช้บ่อย ๆ
# You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'taxiDriverApp' do
rn_path = '../node_modules/react-native'
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path , :subspecs => [
@voratham
voratham / react_native_button_bootom.js
Created February 15, 2018 03:50
StyleComponentReactNative
<Root>
<View style={{flex:1}}>
<ScrollView style={{flex:1}}>
{
this._rednerGridUploadFile()
}
</ScrollView>
{
<View style={{ flex:.1 , height: 55 , backgroundColor:'red', justifyContent:'center' , alignSelf : 'stretch' ,alignItems :'center' }}>
<TouchableOpacity style={{}}>
@voratham
voratham / test.js
Created February 26, 2018 08:12
SolutionWixDrawerSomeScreen
constructor(props) {
super(props);
this.props.navigator.setOnNavigatorEvent(
this.onNavigatorEvent.bind(this)
);
}
// If this screen was the first screen app (like a slash or login page), you will need do this
// componentWillMount() {
// this.props.navigator.setDrawerEnabled({
@voratham
voratham / instruction.txt
Created March 17, 2018 04:14
BIS618 - Dataproc Google Cloud
เลือกสร้าง Cluster ใน zone ที่ยังไม่เคยใช้เพื่อไม่ให้เกินข้อจำกันฟรีที่ 8vCPUs 100GB disk
Master: 4 vCPUs 15GB 40 GB disk
2 workers: 2 vCPUs 7.5GB 30 GB disk
Image version: 1.2
Initialization actions:
gs://dataproc-initialization-actions/zeppelin/zeppelin.sh
gs://dataproc-initialization-actions/hue/hue.sh
(ดู Initialization actions เพิ่มเติมที่ https://github.com/GoogleCloudPlatform/dataproc-initialization-actions)
@voratham
voratham / RNInifinityLoadingFlatList.js
Last active March 23, 2018 11:23
RNInifinityLoadingFlatList + ExpressJs-Server-Side
import React, { Component } from "react";
import moment from 'moment';
import { Alert, Platform, StyleSheet, View, Dimensions, BackHandler, ToastAndroid, TouchableOpacity , FlatList , NativeModules, LayoutAnimation, } from "react-native";
import { Container, Grid, Row, Spinner, Col, Header, Title, Content, Footer, Input, Item, Button, Icon, Text, Thumbnail ,Card , CardItem , Left , Right , Body } from "native-base";
import {Loading} from "../CommonComponent";
import { Navigation, ScreenVisibilityListener } from "react-native-navigation";
import {observer} from 'mobx-react/native'
const DEFAULT_PADDING = { top: 300, right: 60, bottom: 300, left: 60 };
const { width, height } = Dimensions.get("window");
@voratham
voratham / FlatListscrollToIndex.js
Created May 18, 2018 10:47
FlatList scrollToIndex practical example.
import React, { Component } from 'react';
import { Text, View, FlatList, Dimensions, Button, StyleSheet } from 'react-native';
const { width } = Dimensions.get('window');
const style = {
justifyContent: 'center',
alignItems: 'center',
width: width,
height: 50,
@voratham
voratham / angular-template.html
Created May 22, 2018 07:26
angular-template.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js"></script>
</head>