Skip to content

Instantly share code, notes, and snippets.

View jason-shen's full-sized avatar
🗼
Coding........

Jason Shen jason-shen

🗼
Coding........
View GitHub Profile
@jason-shen
jason-shen / vscode.txt
Created March 16, 2018 11:34 — forked from EQuimper/vscode.txt
VS CODE PACKAGES
5 TOP PACKAGES
1. Path Intellisense
2. Project Manager
3. Auto Rename Tag
4. JavaScript (ES6) code snippets
5. Output Colorizer
You need to have
@jason-shen
jason-shen / settings.json
Last active March 16, 2018 13:53 — forked from EQuimper/settings.json
VsCode Settings
// Place your settings in this file to overwrite the default settings
{
"editor.fontSize": 15,
"editor.fontFamily": "Consolas",
"editor.tabSize": 2,
"editor.wordWrapColumn": 80,
"editor.fontLigatures": true,
"editor.snippetSuggestions": "top",
"editor.minimap.enabled": true,
"files.exclude": {
@jason-shen
jason-shen / uploadImage.ts
Created March 16, 2018 13:53 — forked from EQuimper/uploadImage.ts
Upload a image using presign url from s3 in React-Native
export async function uploadImage(method: string, url: string, file: any) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest()
xhr.open(method, url)
xhr.setRequestHeader('Content-Type', file.type)
xhr.onload = () => {
if (xhr.status !== 200) {
reject(
new Error(
`Request failed. Status: ${xhr.status}. Content: ${xhr.responseText}`
@jason-shen
jason-shen / isRootScreen.js
Created March 16, 2018 13:53 — forked from EQuimper/isRootScreen.js
React-Navigation for know if the root screen. Let us manages back button android.
// @flow
export function isRootScreen(navigator: {
index: ?number,
routes: ?Array<Object>,
}) {
if (navigator.index == null) {
return true;
}
@jason-shen
jason-shen / icons.js
Created March 16, 2018 13:54 — forked from EQuimper/icons.js
Running Vector Icons for React-Native-Navigation
import React from 'react';
import Entypo from 'react-native-vector-icons/Entypo'
import { Platform, PixelRatio } from 'react-native';
const navIconSize = (__DEV__ === false && Platform.OS === 'android') ? PixelRatio.getPixelSizeForLayoutSize(25) : 25;
const replaceSuffixPattern = /--(active|big|small|very-big)/g;
const icons = {
home: [navIconSize, Entypo],
photos_list = [
"https://freestocks.org/fs/wp-content/uploads/2018/01/english_bulldog_lying_on_a_sofa_2-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2017/04/old_tile_stove_fire-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2017/10/trip_in_the_mountins_with_a_dog-733x1100.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/08/french_fries-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/09/memory_box_2-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/10/sailing_boat_at_sunset-450x300.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/11/playground_ropes-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/11/fig_cake_2-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2017/12/christmas_tree_decoration_3-800x533.jpg",
import { NavigationActions } from 'react-navigation';
import { normalize } from 'normalizr';
import { Feed, Photo } from '../utils/api';
import { arrayOfPhotos } from './normalizr_schema';
export const FETCH_FEED_IMAGES = 'FETCH_FEED_IMAGES';
export const FETCH_FEED_IMAGES_SUCCESS = 'FETCH_FEED_IMAGES_SUCCESS';
export const FETCH_FEED_IMAGES_ERROR = 'FETCH_FEED_IMAGES_ERROR';
// @flow
import React, { Component } from 'react';
import {
RefreshControl,
FlatList,
View,
ActivityIndicator,
} from 'react-native';
@jason-shen
jason-shen / .gitconfig
Last active March 16, 2018 14:21 — forked from EQuimper/.gitconfig
My .gitconfig
[user]
name = jason-shen
email = jason_2000_nz@hotmail.com
[alias]
c = commit -m
i = init
s = status
graph = log --graph --oneline --decorate=short --branches='*'
br = branch
@jason-shen
jason-shen / clear.txt
Created March 16, 2018 13:56 — forked from EQuimper/clear.txt
React-Native clear Watchman + Cache
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache