Skip to content

Instantly share code, notes, and snippets.

View anhtuank7c's full-sized avatar
🎯
Focusing

Tuan Nguyen anhtuank7c

🎯
Focusing
View GitHub Profile
@tungvn
tungvn / regex-vietnamese-phone-number-updated-2018.js
Last active January 16, 2024 07:45
Vietnamese phone number Regex validation
/*
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
////
// 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-")
@mraaroncruz
mraaroncruz / steps.md
Last active April 16, 2024 07:22
Get the Telegram channel ID

To get the channel id

  1. Create your bot with botfather
  2. Make you bot an admin of your channel

Simplest way (via @anhtuank7c)

Go to Telegram web and open a channel, get the ID from -[channel id] from hash in the path

https://web.telegram.org/k/#-9999999999999

@btxtiger
btxtiger / AesUtil.ts
Last active April 8, 2024 16:19 — forked from AndiDittrich/AesUtil.js
Node.js - AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
/**
* Cryptography Functions
*
* Forked from AndiDittrich/AesUtil.js
* https://gist.github.com/AndiDittrich/4629e7db04819244e843
*/
import crypto, { CipherGCM, CipherGCMTypes, DecipherGCM } from 'crypto';
import { Password } from './types';
@leesc22
leesc22 / MainActivity.kt
Created July 5, 2018 06:21
Android TextToSpeech in Kotlin
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"

Example code from the video "Use async/await with TypeScript in Cloud Functions"

This is the example code from my video about using async/await with Cloud Functions. I've placed it here in a gist so it's easier to compare the "before" and "after" states for each case.

Watch the video here

The code in this project is licensed under the Apache License 2.0.

Copyright 2018 Google LLC
@mrbar42
mrbar42 / README.md
Last active March 28, 2024 18:06
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster
@dideler
dideler / bot.rb
Last active April 10, 2024 18:19
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
# When using RN in combination with Cocoapods, a lot of
# things are broken. These are the fixes we had to append
# to our Podfile when upgrading to ReactNative@0.55.3.
#
# WARNING: Check those line numbers when you're on a different version!
def change_lines_in_file(file_path, &change)
print "Fixing #{file_path}...\n"
contents = []
@EmmanuelGuther
EmmanuelGuther / BadgeTabLayout.kt
Last active December 14, 2022 03:08
Add badge to tab layout
package es.cityride.mantapp
import android.content.Context
import android.graphics.PorterDuff
import android.graphics.drawable.Drawable
import android.support.design.widget.TabLayout
import android.util.AttributeSet
import android.util.SparseArray
import android.view.LayoutInflater
import android.view.View