Skip to content

Instantly share code, notes, and snippets.

@thuydao
thuydao / react-native awesome.md
Last active February 28, 2024 15:30
Guide to development React Native
@thuydao
thuydao / import_from_gist.py
Created February 18, 2024 08:19 — forked from koji-kojiro/import_from_gist.py
[Python] import from Gist
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def load_gist(gist_id):
"""translate Gist ID to URL"""
from json import load
from urllib import urlopen
gist_api = urlopen("https://api.github.com/gists/" + gist_id)
@thuydao
thuydao / gitclean
Created November 29, 2022 07:59
gitclean
alias gitclean="git branch --merged | grep -v \* | xargs git branch -D && git remote update origin --prune"
@thuydao
thuydao / OTPService.dart
Last active September 5, 2021 04:28
Flutter firebase OTP Service
///
/// OTPService
/// cloud_firestore: ^0.12.9
/// firebase_storage: ^3.0.6
/// firebase_auth: ^0.14.0
///
import 'package:firebase_auth/firebase_auth.dart';
typedef void PhoneSubmitCallBack(String status);
@thuydao
thuydao / Version number definition.md
Last active March 29, 2021 09:42
Version number definition

A version number has three components, major.minor.patch e.g. 1.2.13. You decide which to increment based on the changes you have made since the last version.

major.minor.patch

  1. Patch is for minor changes or bug fixes

  2. Minor is for new functionality

@thuydao
thuydao / mergegenstrings.py
Created March 1, 2021 16:09 — forked from yoichitgy/mergegenstrings.py
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8
@thuydao
thuydao / go_remote_ip.go
Created January 25, 2021 09:09
go_remote_ip
func _ip(r *http.Request) string {
//Get IP from the X-REAL-IP header
ip := r.Header.Get("X-REAL-IP")
netIP := net.ParseIP(ip)
if netIP != nil {
return ip
}
//Get IP from X-FORWARDED-FOR header
ips := r.Header.Get("X-FORWARDED-FOR")
@thuydao
thuydao / go_mac_adr.go
Last active January 25, 2021 09:10
go_mac_adr
package main
import (
"bytes"
"strconv"
"net"
)
func main() {
print(macAdrr())