Skip to content

Instantly share code, notes, and snippets.

View anhtuank7c's full-sized avatar

Tuan Nguyen anhtuank7c

View GitHub Profile
@anhtuank7c
anhtuank7c / close.svg
Created June 13, 2017 08:27
svg file for react native
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anhtuank7c
anhtuank7c / svg-css-inliner-color-hexer-gradient-defs-grouper-number-formatter.js Convert Illustrator SVG export into cross-platform CSS independent mode. CSS rule and style inlining, group gradients into a definitions tag, remove elements with display set to none, make colors hex. Works with react-native-web react-native-svg and svgs to give cross-platform web and native mobile rendering of any SVG produced in Illustrator.
/*
Import https://raw.githubusercontent.com/MikeMcl/decimal.js/master/decimal.js first
Then run this.
Then put it into the SVG to JSX Online Converter http://svg-jsx.patmoody.com/
Then find (e.g. using WebStorm) all occurences of the regexp </?.
Select all matches (the first letter of every react tag) and toggle case / replace with upper case (to use cross-platform react components from the svgs library)
Finally, wrap in a pure function and make sure to import all needed components:
import React from "react";
@anhtuank7c
anhtuank7c / smscode
Created October 21, 2017 14:51 — forked from asiatact/smscode
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
@anhtuank7c
anhtuank7c / index.ios.js
Created November 6, 2017 08:24 — forked from Jpoliachik/index.ios.js
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@anhtuank7c
anhtuank7c / googleSignIn.js
Created April 12, 2018 14:17
Google SignIn Config
GoogleSignIn.configure({
// iOS
clientID: 'yourClientID',
// iOS, Android
// https://developers.google.com/identity/protocols/googlescopes
scopes: ['seller'],
// iOS, Android
// Whether to request email and basic profile.
<!DOCTYPE html>
<html lang="vi" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article# title: http://ogp.me/ns#title image: http://ogp.me/ns#image">
<head>
<meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>
Thiết kế in ấn M.A.P Hải Phòng </title>
<link href="/favicon.ico" type="image/x-icon" rel="icon"/><link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/> <link rel="apple-touch-icon" sizes="57x57" href="/favicons/xapple-icon-57x57.png.pagespeed.ic.k7zLab2s1K.webp">
<link rel="apple-touch-icon" sizes="60x60" href="/favicons/xapple-icon-60x60.png.pagespeed.ic.l5GlS7NVVW.webp">
<link rel="apple-touch-icon" sizes="72x72" href="/favicons/xapple-icon-72x72.png.pagespeed.ic.m9Jcd0HbKO.webp">

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@anhtuank7c
anhtuank7c / .eslintrc
Created September 14, 2018 16:17 — forked from radiovisual/.eslintrc
React Native AirBnB ESLint Config
{
"parser": "babel-eslint",
"plugins": [
"react",
"react-native"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
@anhtuank7c
anhtuank7c / setup_firebase.sh
Created December 12, 2018 05:41
Setup Firebase Environment GoogleService-Info.plist
# Name of the resource we're selectively copying
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist
# Get references to dev and prod versions of the GoogleService-Info.plist
# NOTE: These should only live on the file system and should NOT be part of the target (since we'll be adding them to the target manually)
GOOGLESERVICE_INFO_DEV=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Debug/${GOOGLESERVICE_INFO_PLIST}
GOOGLESERVICE_INFO_STAGING=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Staging/${GOOGLESERVICE_INFO_PLIST}
GOOGLESERVICE_INFO_PROD=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Release/${GOOGLESERVICE_INFO_PLIST}
# Make sure the dev version of GoogleService-Info.plist exists
# Name of the resource we're selectively copying
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist
# Get references to dev and prod versions of the GoogleService-Info.plist
# NOTE: These should only live on the file system and should NOT be part of the target (since we'll be adding them to the target manually)
GOOGLESERVICE_INFO_DEV=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Debug/${GOOGLESERVICE_INFO_PLIST}
GOOGLESERVICE_INFO_STAGING=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Staging/${GOOGLESERVICE_INFO_PLIST}
GOOGLESERVICE_INFO_PROD=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Release/${GOOGLESERVICE_INFO_PLIST}
# Make sure the dev version of GoogleService-Info.plist exists