Skip to content

Instantly share code, notes, and snippets.

View anhtuank7c's full-sized avatar
🎯
Focusing

Tuan Nguyen anhtuank7c

🎯
Focusing
View GitHub Profile
@anhtuank7c
anhtuank7c / .gitignore
Created June 21, 2023 09:24 — forked from tatsuyasusukida/.gitignore
Node.js Docker Image that can uses FFmpeg
View Text.tsx
import { TranslateOptions } from 'i18n-js/typings'
import {StyleProp, Text as RNText, TextProps as RNTextProps, TextStyle} from 'react-native'
import { TxKeyPath, useI18n } from '../hooks/useI18n'
import { ThemeProps, useThemeColor } from './Themed'
const presets = {
default: {fontSize: 17, lineHeight: 24, fontWeight: 'normal'} as StyleProp<TextStyle>,
primary: {fontSize: 17, lineHeight: 24, fontWeight: '600'} as StyleProp<TextStyle>,
secondary: {fontSize: 17, lineHeight: 24, fontWeight: 'normal'} as StyleProp<TextStyle>,
header: {fontSize: 27, lineHeight: 34, fontWeight: '600' } as StyleProp<TextStyle>,
@anhtuank7c
anhtuank7c / cleanup_node_modules.sh
Created January 7, 2023 10:41
[Mac/Linux] List and remove all the node_modules at the current directory
View cleanup_node_modules.sh
#!/bin/bash
# Cleanup node_modules
echo "Calculate disk space for node_modules in all directory"
find . -name "node_modules" -type d -prune -print | xargs du -chs
echo "Remove all node_modules directory"
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
@anhtuank7c
anhtuank7c / const_keyword.dart
Last active June 23, 2022 07:15
Exploring const keyword in Dart
View const_keyword.dart
class Contact {
// Constructor is marked 'const' so all fields must be final.
final String name;
final int age;
// const at class level have to go along with static keyword
static const alive = true;
// const constructor
const Contact(this.name, this.age);
@anhtuank7c
anhtuank7c / final_keyword.dart
Last active June 18, 2022 15:02
Exploring final keyword in Dart
View final_keyword.dart
class Contact {
String name;
int age;
Contact(this.name, this.age);
@override
String toString() {
return "$name: $age";
}
@anhtuank7c
anhtuank7c / AudioCue.kt
Created April 20, 2022 02:53
AudioCue class, let initial this class to call speakOut function to speech the text.
View AudioCue.kt
package com.example;
import android.content.Context
import android.content.Context.AUDIO_SERVICE
import android.media.AudioAttributes
import android.media.AudioFocusRequest
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
import android.speech.tts.TextToSpeech
@anhtuank7c
anhtuank7c / react-native-reanimated-drag-sort_apple-music.jsx
Created March 22, 2022 01:31 — forked from eveningkid/react-native-reanimated-drag-sort_apple-music.jsx
React Native Reanimated 2 Multiple Drag and Sort: Apple Music Example
View react-native-reanimated-drag-sort_apple-music.jsx
// Expo SDK40
// expo-blur: ~8.2.2
// expo-haptics: ~8.4.0
// react-native-gesture-handler: ~1.8.0
// react-native-reanimated: ^2.0.0-rc.0
// react-native-safe-area-context: 3.1.9
import React, { useState } from 'react';
import {
Image,
View regex-vietnamese-phone-number-updated-2018.js
/*
Before Septemper 15 2018, Vietnam has phone number start with 09*, 01(2|6|8|9).
After that, the phone number can start with 03, 05, 07 or 08.
So this function provide a way to validate the input number is a Vietnamese phone number
*/
function isVietnamesePhoneNumber(number) {
return /(03|05|07|08|09|01[2|6|8|9])+([0-9]{8})\b/.test(number);
}
@anhtuank7c
anhtuank7c / VehicleMarker.js
Created February 18, 2022 07:51 — forked from zhenguet/data.js
Journey
View VehicleMarker.js
import React, {memo, useEffect, useState} from 'react';
import {Animated, Platform, StyleSheet} from 'react-native';
import {AnimatedRegion, Marker} from 'react-native-maps';
import {Car} from '../../../../../Assets/Images';
function VehicleMarker({
data,
tripIndex,
initLatDelta,
initLongDelta,
View url-schemes-settings-ios.mkd

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.