Skip to content

Instantly share code, notes, and snippets.

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

Tuan Luong r0b0t3d

🏠
Working from home
View GitHub Profile
@r0b0t3d
r0b0t3d / setup_plugins.sh
Created May 28, 2025 10:52
Setup plugins for asdf
#!/bin/bash
# Default versions
DEFAULT_RUBY="3.2.2"
DEFAULT_NODE="20.11.1"
# Use args or defaults
RUBY_VERSION="${1:-$DEFAULT_RUBY}"
NODE_VERSION="${2:-$DEFAULT_NODE}"
@r0b0t3d
r0b0t3d / setup_dev_env.sh
Last active May 28, 2025 10:54
Setup dev env
#!/bin/bash
set -e
# Detect architecture
ARCH=$(uname -m)
echo "Detected architecture: $ARCH"
# Detect shell
CURRENT_SHELL=$(basename "$SHELL")
@r0b0t3d
r0b0t3d / useCallback.md
Created July 10, 2021 09:06
Use of useCallback and useMemo

1. Use

1.1. in callback

const handlePress = useCallback(() => {
	// handle press
}, [])

Good 👍

<Button onPress={handlePress} />
@r0b0t3d
r0b0t3d / react-native-bootsplash+2.2.5.patch
Last active July 18, 2023 03:06
Add option for react-native-bootsplash to use custom xml
diff --git a/node_modules/react-native-bootsplash/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplash.java b/node_modules/react-native-bootsplash/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplash.java
index 83dbff8..aae4fae 100644
--- a/node_modules/react-native-bootsplash/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplash.java
+++ b/node_modules/react-native-bootsplash/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplash.java
@@ -4,6 +4,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.Activity;
import android.content.Context;
+import android.view.LayoutInflater;
import android.view.View;
@r0b0t3d
r0b0t3d / FileHelper.java
Created June 17, 2020 08:13
Get file path from Uri
import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
@r0b0t3d
r0b0t3d / toIso2.json
Created April 3, 2020 15:49
A JSON file that maps ISO2 country codes to ISO3 country codes and vice versa
{
"AND": "AD",
"ARE": "AE",
"AFG": "AF",
"ATG": "AG",
"AIA": "AI",
"ALB": "AL",
"ARM": "AM",
"AGO": "AO",
"ATA": "AQ",
@r0b0t3d
r0b0t3d / react-native+0.62.0.patch
Last active July 6, 2022 05:58
[ios] Trigger onRequestClose when swiping down a pageSheet
diff --git a/node_modules/react-native/React/Views/RCTModalHostView.h b/node_modules/react-native/React/Views/RCTModalHostView.h
index e16dd22..97f24a6 100644
--- a/node_modules/react-native/React/Views/RCTModalHostView.h
+++ b/node_modules/react-native/React/Views/RCTModalHostView.h
@@ -17,7 +17,7 @@
@protocol RCTModalHostViewInteractor;
-@interface RCTModalHostView : UIView <RCTInvalidating>
+@interface RCTModalHostView : UIView <RCTInvalidating, UIAdaptivePresentationControllerDelegate>
import Foundation
import UIKit
// Usage Examples
let shadowColor = Color.shadow.value
let shadowColorWithAlpha = Color.shadow.withAlpha(0.5)
let customColorWithAlpha = Color.custom(hexString: "#123edd", alpha: 0.25).value
enum Color {
import Foundation
import UIKit
// Usage Examples
let system12 = Font(.system, size: .standard(.h5)).instance
let robotoThin20 = Font(.installed(.RobotoThin), size: .standard(.h1)).instance
let robotoBlack14 = Font(.installed(.RobotoBlack), size: .standard(.h4)).instance
let helveticaLight13 = Font(.custom("Helvetica-Light"), size: .custom(13.0)).instance
struct Font {
@r0b0t3d
r0b0t3d / Utility.swift
Created October 6, 2017 03:31
Swift Utilities methods
class Utility {
/// Logs all available fonts from iOS SDK and installed custom font
class func logAllAvailableFonts() {
for family in UIFont.familyNames {
print("\(family)")
for name in UIFont.fontNames(forFamilyName: family) {
print(" \(name)")
}
}