Skip to content

Instantly share code, notes, and snippets.

@muhozi
muhozi / ..git-pr.md
Created February 13, 2019 18:59 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@muhozi
muhozi / Fastfile
Created February 16, 2019 14:31 — forked from polbins/Fastfile
Fastlane script for Uploading to Slack and Play Store Alpha
default_platform :android
platform :android do
before_all do
ENV["SLACK_URL"] = "https://hooks.slack.com/services/ABC/123/XYZ"
end
######################### PUBLIC LANES #########################
desc "Deploy a new Prod APK version to Play Store Alpha"
@muhozi
muhozi / Appfile
Created February 17, 2019 19:39 — forked from mmazzarolo/Appfile
Simple Fastlane setup for React-Native (Android - iOS)
# iOS
app_identifier "com.myapp.app" # The bundle identifier of your app
apple_id "[email protected]" # Your Apple email address
team_id "1234ABCD" # Developer Portal Team ID
# Android
json_key_file "./google-play-api-secret.json" # Path to the json secret file - Follow https://github.com/fastlane/supply#setup to get one
package_name "com.myapp.app" # Your Android app package
@muhozi
muhozi / App.js
Created April 1, 2019 19:53
Upload image react native firebase
uploadImage = () => {
const ext = this.state.imageUri.split('.').pop(); // Extract image extension
const filename = `${uuid()}.${ext}`; // Generate unique name
this.setState({ uploading: true });
firebase
.storage()
.ref(`tutorials/images/${filename}`)
.putFile(this.state.imageUri)
.on(
firebase.storage.TaskEvent.STATE_CHANGED,
@muhozi
muhozi / App.js
Created April 1, 2019 20:10
Select image method
/**
* Select image method
*/
pickImage = () => {
ImagePicker.showImagePicker(options, response => {
if (response.didCancel) {
console.log('You cancelled image picker 😟');
} else if (response.error) {
alert('And error occured: ', response.error);
} else {
@muhozi
muhozi / progress-bar.js
Created April 1, 2019 20:28
Progress bar
//...
<Image source={imgSource} style={styles.image} />
{uploading && (
<View
style={[styles.progressBar, { width: `${progress}%` }]}
/>
)}
//...
@muhozi
muhozi / retrieve-from-asynStorage.js
Created April 1, 2019 20:51
Retrieve from AsyncStorage
componentDidMount() {
let images;
AsyncStorage.getItem('images')
.then(data => {
images = JSON.parse(data) || [];
this.setState({
images: images
});
})
.catch(error => {
@muhozi
muhozi / App.js
Created April 1, 2019 20:58
React native image upload
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
TouchableOpacity,
Image,
FlatList,
AsyncStorage,
Dimensions,
@muhozi
muhozi / .eslintrc
Created May 11, 2019 19:35 — forked from 1natsu172/.eslintrc
My airbnb based ESLint config for "typescript-eslint" with React & prettier
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"tsconfigRootDir": "."
},
"env": {
"browser": true,
"jest/globals": true
},
@muhozi
muhozi / App.js
Last active May 30, 2019 14:24
React Native Navigation with Redux
import React, { Component } from 'react';
import {
View, Platform,
} from 'react-native';
import { Provider } from 'react-redux';
import { Navigation } from 'react-native-navigation';
import Splash from '../containers/Splash';
import Auth from '../containers/Auth';
import Profile from '../containers/Profile';