Skip to content

Instantly share code, notes, and snippets.

View creativedrewy's full-sized avatar

Andrew Watson creativedrewy

View GitHub Profile
@creativedrewy
creativedrewy / App.tsx
Created November 20, 2023 19:50
R3f Native Orbit Controls Test
import {Canvas, MeshProps, useFrame, useLoader} from "@react-three/fiber/native"
// import useControls from "r3f-native-orbitcontrols"
import { useRef, useState } from "react"
import { View } from "react-native"
import { GLTFLoader } from "three-stdlib";
import { Suspense } from "react";
import { useGLTF } from '@react-three/drei/native'
import useControls from "r3f-native-orbitcontrols";
export default function App() {
@creativedrewy
creativedrewy / gltf-export.py
Created August 30, 2022 18:05
Bake image textures and export GLB using bake
from cmath import exp
import bpy
##### :: Script-Specific Functions :: #####
def deselect_all():
bpy.ops.object.select_all(action='DESELECT')
def active_object(name):
print(name)
@creativedrewy
creativedrewy / RoundedDiamondFabShape.kt
Created August 2, 2021 22:54
Diamond-shaped FAB with rounded corners. Extends Shape interface for FAB background and cutout.
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Outline
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.LayoutDirection
class RoundedDiamondFabShape(
@creativedrewy
creativedrewy / 07-24-19-link.md
Created July 24, 2019 21:28
## Semantic UI for React
@creativedrewy
creativedrewy / LoadingPreferenceRow.kt
Last active July 24, 2019 21:28
## Indeterminate Progress Bar on Android Preferences Screen
package com.your.package.structure.here
/**
* Custom Preference that provides an indeterminate progress bar for showing loading/long-running operations.
* Set checked to to "true" to show the progress bar and "false" to hide it.
*/
class LoadingPreferenceRow constructor(
context: Context, attrs: AttributeSet? = null
): SwitchPreference(context, attrs) {
@creativedrewy
creativedrewy / 07-21-19-link.md
Last active July 24, 2019 21:29
## Fancy link previewing in React
@creativedrewy
creativedrewy / .bash_profile
Last active October 26, 2021 08:57
My Config Files
alias ls='ls -l'
alias weather='curl wttr.in/SanFrancisco?n'
alias nuget="mono /usr/local/bin/nuget.exe"
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"
export PATH=$PATH:/Users/<user>/Library/Android/sdk/platform-tools
export PATH=$PATH:/Users/<user>/Library/Android/sdk/emulator
export PATH=$PATH:/usr/local/bin
@creativedrewy
creativedrewy / BlockCommentDetector.kt
Created January 11, 2019 22:18
//BLOCK comment lint rule
class BlockCommentDetector : Detector(), Detector.UastScanner {
companion object {
val ISSUE: Issue = Issue.create(
"BlockComment",
"BLOCK comment found, cannot continue build.",
"Please resolve all BLOCK commented code before merging.",
Category.CORRECTNESS,
6,
Severity.ERROR,
Implementation(BlockCommentDetector::class.java, Scope.JAVA_FILE_SCOPE)
/**
* Execute a lambda with two verified non-null values
*/
inline fun <T : Any, U : Any, W : Any> Pair<T?, U?>.bothNotNull(block: (one: T, two: U) -> W) {
first?.let { one ->
second?.let { two ->
block(one, two)
}
}
}
@creativedrewy
creativedrewy / pairTo.kt
Created January 11, 2019 22:15
pairTo.kt
/**
* Combine two objects into a Pair
*/
infix fun <A, B> A.pairTo(that: B): Pair<A, B> = Pair(this, that)
/**
* Combine three objects into a Triple (by way of one Pair and a new value)
*/
infix fun <A, B, C> Pair<A, B>.tripleTo(that: C) = Triple(first, second, that)