Skip to content

Instantly share code, notes, and snippets.

View onmyway133's full-sized avatar
๐Ÿ˜‡
What you don't know is what you haven't learned

Khoa onmyway133

๐Ÿ˜‡
What you don't know is what you haven't learned
View GitHub Profile
class ViewController: UIViewController {
let box = UIView()
override func viewDidLoad() {
super.viewDidLoad()
box.backgroundColor = UIColor.red
view.addSubview(box)
}
@onmyway133
onmyway133 / a.swift
Created January 8, 2019 15:24
a.swift
import Foundation
public enum Event<T> {
case Next(value: T)
case Failed(error: ErrorType)
// MARK: Initialization
public init(value: T) {
self = .Next(value: value)
}
@onmyway133
onmyway133 / a.swift
Created January 8, 2019 15:22
a.swift
import Foundation
public final class Signal<T> {
var event: Event<T>?
var callbacks: [Event<T> -> Void] = []
let lockQueue = dispatch_queue_create("lock_queue", DISPATCH_QUEUE_SERIAL)
// MARK: Initialization
public init(event: Event<T>) {
import React, {Component} from 'react'
import { StyleSheet, View, Text, SafeAreaView } from 'react-native'
import { facebookService } from '../../library/FacebookService'
import { Avatar } from 'react-native-elements'
export default class ProfilePage extends React.Component {
constructor(props) {
super(props)
this.logout = this.logout.bind(this)
import React from 'react'
import { StyleSheet, View, Text } from 'react-native'
import {facebookService} from '../../library/FacebookService'
export default class LogInPage extends React.Component {
constructor(props) {
super(props)
this.login = this.login.bind(this)
}
import React from 'react'
import { StyleSheet, View, Text } from 'react-native'
import {facebookService} from '../../library/FacebookService'
export default class LogInPage extends React.Component {
constructor(props) {
super(props)
this.login = this.login.bind(this)
}
import { createStackNavigator } from 'react-navigation'
import LoginPage from './LoginPage'
export const LoginNavigator = createStackNavigator({
Login: {
screen: LoginPage,
navigationOptions: {
title: "Login"
}
}
import { createBottomTabNavigator } from 'react-navigation'
import ProfilePage from '../profile/ProfilePage'
import ShopPage from '../shop/ShopPage'
export const MainNavigator = createBottomTabNavigator({
Profile: {
screen: ProfilePage,
navigationOptions: {
tabBarLabel: 'Profile'
}
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import {LoginNavigator} from './src/components/login/LoginNavigator'
import {MainNavigator} from './src/components/main/MainNavigator'
import FBSDK from 'react-native-fbsdk'
import {createSwitchNavigator} from 'react-navigation'
const { AccessToken } = FBSDK
export default class App extends Component {
import React from 'react'
import FBSDK from 'react-native-fbsdk'
const { LoginButton, AccessToken, GraphRequest, GraphRequestManager } = FBSDK
class FacebookService {
constructor() {
this.requestManager = new GraphRequestManager()
}