Skip to content

Instantly share code, notes, and snippets.

View prongbang's full-sized avatar
🏠
Working from home

prongbang prongbang

🏠
Working from home
View GitHub Profile
@prongbang
prongbang / countries.csv
Created February 7, 2022 12:37 — forked from zspine/countries.csv
Country Code, ISO and Nationality ( Please use https://mledoze.github.io/countries/ )
CCA2 Name CCA3 Nationality
AD Andorra AND Andorran
AE United Arab Emirates ARE Emirati
AF Afghanistan AFG Afghan
AG Antigua and Barbuda ATG Antiguan, Barbudan
AI Anguilla AIA Anguillian
AL Albania ALB Albanian
AM Armenia ARM Armenian
AN Netherlands Antilles ANT Dutch
AO Angola AGO Angolan
@prongbang
prongbang / MainActivity.kt
Created November 28, 2021 17:05
How to make a dynamic start destination in the Android Navigation Component
class MainActivity : AppCompatActivity {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main_activity)
initNavGraphStartDestination()
}
private fun initNavGraphStartDestination() {
# Create token: https://github.com/settings/tokens
# How to use:
# make add_remote_origin_token username=<username> token=<token> repository=<repository>
add_remote_origin_token:
	git remote set-url origin https://$(username):$(token)@github.com/$(username)/$(repository).git
@prongbang
prongbang / Preview a link before clicked.md
Created June 27, 2021 06:52
Preview a link before clicked link bit.ly
@prongbang
prongbang / README.md
Created June 23, 2021 03:36
Create a Flutter .apk and .ipa file to upload to Firebase App Distribution

Android

  • APK
flutter build apk -t lib/main_production.dart --flavor production --release --obfuscate --split-debug-info=./
  • App bundle

Build :

docker build --no-cache --progress=plain -t prongbang/crypto:latest --build-arg ENV=prod .

Run. :

docker run -p 8080:8080 prongbang/crypto:latest
@prongbang
prongbang / RotationUtility.kt
Created May 29, 2021 06:21
RotationUtility.kt
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Matrix
import androidx.exifinterface.media.ExifInterface
import java.io.File
interface RotationUtility {
fun autoRotate(file: File): Bitmap
}

Golang

func Upload(c *fiber.Ctx) error {
  if form, err := c.MultipartForm(); err == nil {
    files := form.File["image"]
    for _, file := range files {
      fmt.Println(file.Filename, file.Size, file.Header["Content-Type"][0])
      _ = c.SaveFile(file, fmt.Sprintf("./%s", file.Filename))
 }

Run these commands from inside the server/ directory!

Create a certificate authority

openssl genrsa -out root-ca.privkey.pem 2048

Sign the certificate authority

@prongbang
prongbang / LazyView.swift
Created November 27, 2020 18:41 — forked from chriseidhof/LazyView.swift
LazyView
struct LazyView<Content: View>: View {
let build: () -> Content
init(_ build: @autoclosure @escaping () -> Content) {
self.build = build
}
var body: Content {
build()
}
}