Skip to content

Instantly share code, notes, and snippets.

View pfulop's full-sized avatar
😈
YEAH!

Pavol Fulop pfulop

😈
YEAH!
  • Trondheim, Norway
View GitHub Profile
<TouchableOpacity onPressIn={this.addOne} onPressOut={this.stopTimer}>
<Icon name="plus-circle" size={30} color={'white'} />
</TouchableOpacity>
constructor() {
super();
this.state = {
number: 0,
};
this.timer = null;
this.addOne = this.addOne.bind(this);
this.stopTimer = this.stopTimer.bind(this);
}
export function loginWithFacebook(accessToken){
return (dispatch,_,firebaseApp)=>{
dispatch({ type: LOGGING_IN});
const credential = firebase.auth.FacebookAuthProvider.credential(accessToken);
firebaseApp.auth().signInWithCredential(credential).then((user) => {
dispatch({ type: LOGGED_IN, user });
}).catch((error) => {
console.log(error);
});
}
<LoginButton
publishPermissions={["publish_actions"]}
onLoginFinished={
(error, result) => {
if (error) {
alert("login has error: " + result.error);
} else if (result.isCancelled) {
alert("login is cancelled.");
} else {
AccessToken.getCurrentAccessToken().then(
export function checkUser() {
return (dispatch, getState, firebase) => {
firebase.auth().onAuthStateChanged((user) => {
if (user) {
dispatch({ type: LOGIN, user });
} else {
dispatch({ type: LOGOUT });
}
});
};
export function loginWithEmail(email, password){
return (dispatch,_,firebaseApp)=>{
dispatch({ type: LOGGING_IN});
firebaseApp.auth().signInWithEmailAndPassword(email, password)
.then((user) => {
dispatch({ type: LOGGED_IN, user });
})
.catch(err => dispatch({ type: ERROR, error: err.toString() }));
};
}
export function registerWithEmail(email, password){
return (dispatch,_,firebaseApp)=>{
dispatch({ type: CREATING_ACCOUNT});
firebaseApp.auth().createUserWithEmailAndPassword(email, password)
.then((user) => {
dispatch({ type: CREATED_ACCOUNT, user });
user.sendEmailVerification();
})
.catch(err => dispatch({ type: ERROR, error: err.toString() }));
};
@pfulop
pfulop / RootMode.js
Last active September 18, 2016 13:18
import { Model} from 'objection';
export default class RootModel extends Model {
static get generateGraphSchema(){
const required = {}, relations = {},convertType = (type) => {
switch (type) {
case 'string': return 'String';
case 'integer': return 'Int';
case 'number': return 'Float';
case 'boolean': return 'Boolean';
//@flow
import React, { Component,PropTypes } from 'react';
import {
StyleSheet,
TextInput,
View,
Text,
ListView,
//@flow
import React, { Component,PropTypes } from 'react';
import {
Platform,
StyleSheet,
TextInput,
View,
Text,
TouchableNativeFeedback,