Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Tuan Nguyen anhtuank7c

🎯
Focusing
View GitHub Profile
@zhenguet
zhenguet / data.js
Last active February 22, 2022 01:28
Journey
View data.js
export const Cartrip = [
{
TripInfoID: 33798,
driver: "347722874183",
CarID: 646,
Speed: 4.0,
Lt: 20.800825,
Ln: 106.903534,
Oil: 427,
Acc: "Bật",
@eveningkid
eveningkid / react-native-reanimated-drag-sort_apple-music.jsx
Last active August 7, 2023 18:59
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 hive_store.dart
import 'package:firedart/firedart.dart';
import 'package:hive/hive.dart';
/// Stores tokens using a Hive store.
/// Depends on the Hive plugin: https://pub.dev/packages/hive
class HiveStore extends TokenStore {
static const keyToken = "auth_token";
static Future<HiveStore> create() async {
// Make sure you call both:
View com.apple.private.health.heart-rhythm.plist
<?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>
View watermelon-sync-logger.js
// @flow
import { map, is } from 'rambdax'
import type { DirtyRaw } from '@nozbe/watermelondb/RawRecord'
import type { SyncLog } from '@nozbe/watermelondb/sync'
// beginning, end, length
const censorValue = (value: string): string =>
`${value.slice(0, 2)}***${value.slice(-2)}(${value.length})`
const shouldCensorKey = (key: string): boolean =>
@afollestad
afollestad / BroadcastReceiver.kt
Last active April 3, 2023 12:27
A Lifecycle components aware BroadcastReceiver DSL (Kotlin)
View BroadcastReceiver.kt
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
@tungvn
tungvn / regex-vietnamese-phone-number-updated-2018.js
Last active July 8, 2023 08:11
Vietnamese phone number Regex validation
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);
}
@algera
algera / slugify.swift
Created September 19, 2018 14:12
Slugify routine in Swift 4.1
View slugify.swift
////
// Slugify
// A String extension that converts a text string into a valid URL
// Derived from https://github.com/paulyoung/Slugify/blob/master/Slugify/Slugify.swift
// By Jeff Algera - jeffalgera.com
////
extension String {
private static let allowedCharacters = NSCharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-")
@leesc22
leesc22 / MainActivity.kt
Created July 5, 2018 06:21
Android TextToSpeech in Kotlin
View MainActivity.kt
package com.example.android.texttospeech
import android.os.Build
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.speech.tts.TextToSpeech
import android.util.Log
import kotlinx.android.synthetic.main.activity_main.*
import java.util.*
@CodingDoug
CodingDoug / README.md
Last active November 6, 2022 09:29
Example code from the video "Use async/await with TypeScript in Cloud Functions"
View README.md