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 / final_keyword.dart
Last active June 18, 2022 15:02
Exploring final keyword in 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.
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
// 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,
/*
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
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,

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 / Install php 5.6 ubuntu 16
Created June 7, 2016 02:21
Install php 5.6 ubuntu 16
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6
you can install more php5.6 module
sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-intl php5.6-intl php5.6-mbstring php-apcu php-uuid php5.6-cgi php5.6-cli php5.6-gd php5.6-ldap php5.6-sqlite3 php-uploadprogress
@anhtuank7c
anhtuank7c / BroadcastReceiver.kt
Created November 16, 2020 03:24 — forked from afollestad/BroadcastReceiver.kt
A Lifecycle components aware BroadcastReceiver DSL (Kotlin)
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import androidx.lifecycle.Lifecycle.Event.ON_START
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent
import android.content.BroadcastReceiver as StockReceiver
@anhtuank7c
anhtuank7c / BroadcastReceiver.kt
Created November 16, 2020 03:24 — forked from afollestad/BroadcastReceiver.kt
A Lifecycle components aware BroadcastReceiver DSL (Kotlin)
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import androidx.lifecycle.Lifecycle.Event.ON_START
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent
import android.content.BroadcastReceiver as StockReceiver
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>HKAtrialFibrillationDetectionOnboardingCompleted</key>
<integer>1</integer>
<key>HKElectrocardiogramOnboardingCompleted</key>
<integer>3</integer>
</dict>
</plist>