Skip to content

Instantly share code, notes, and snippets.

View andreferi3's full-sized avatar
🏠
Working from home

Andre Feri Saputra andreferi3

🏠
Working from home
  • Indonesia
View GitHub Profile
function shadow(elevation) {
elevation,
shadowColor: 'black',
shadowOffset: { width: 0, height: elevation - 1},
shadowOpacity: 0.24,
shadowRadius: elevation
}
const STATUSBAR_HEIGHT_EXPO =
global.__expo && global.__expo.Constants
? global.__expo.Constants.statusBarHeight
: 0;
const STATUSBAR_HEIGHT = Platform.select({
android: STATUSBAR_HEIGHT_EXPO,
ios: Platform.version >= 11 ? 0 : STATUSBAR_HEIGHT_EXPO
});
openPlayStore() {
const appStoreLink = 'itms://apps.apple.com/us/app/koperasi-namastra/id1487403555'
const playStoreLink = 'market://details?id=com.namastra_mobile_ver_2'
const url = Platform.OS === 'ios' ? appStoreLink : playStoreLink
Linking.openURL(url)
}
const Schema = Yup.object().shape({
password: Yup.string().required("This field is required"),
changepassword: Yup.string().when("password", {
is: val => (val && val.length > 0 ? true : false),
then: Yup.string().oneOf(
[Yup.ref("password")],
"Both password need to be the same"
)
})
});
function getApiUrl(releaseChannel) {
if (releaseChannel === undefined) return App.apiUrl.dev // since releaseChannels are undefined in dev, return your default.
if (releaseChannel.indexOf('prod') !== -1) return App.apiUrl.prod // this would pick up prod-v1, prod-v2, prod-v3
if (releaseChannel.indexOf('staging') !== -1) return App.apiUrl.staging // return staging environment variables
}
// source : https://github.com/expo/expo/issues/7857
let regString = /^[a-zA-Z ]*$/
let regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
let regPassword = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{6,}$/g
let regNumber = /^[0-9]*$/
let regPhoneNumber = /^08[0-9]*$/
let regAddress = /^(?=.*\w).{2,}$/g
let regRt = /^(?=.*\d).{3,3}$/g
let regFractionNumber = /^[0-9]{1,4}([,.][0-9]{1,2})?$/g
// variable to hold the references of the textfields
inputs = {};
// function to focus the field
focusTheField = (id) => {
this.inputs[id].focus();
}
// upon submitting the Field 1, we want to focus the Field 2
render() {
return (
// So basically you edit the /node_modules/react-native/react.gradle file
// and add the doLast right after the doFirst block, manually.
doFirst { ... }
doLast {
def moveFunc = { resSuffix ->
File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");
if (originalDir.exists()) {
File destDir = file("$buildDir/../src/main/res/drawable-${resSuffix}");
ant.move(file: originalDir, tofile: destDir);
import React from 'react'
import { View, ViewPropTypes } from 'react-native'
import PropTypes from 'prop-types';
import { data1 } from '../example/Chart/dataScheme';
import { SVGHeight, SVGWidth, GRAPH_MARGIN, graphWidth, graphHeight, parseTime, xRange, yRange, countGraphHeight, countGraphWidth } from './helper/chartHelper';
import { utcParse, extent, min, max } from 'd3';
import * as shape from 'd3-shape';
import { scaleTime, scaleLinear } from 'd3-scale'
import Svg, { Defs, LinearGradient, Stop, Path, G, Line, Text } from 'react-native-svg';
@andreferi3
andreferi3 / encrypt_openssl.md
Created June 27, 2020 07:49 — forked from dreikanter/encrypt_openssl.md
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt: