Skip to content

Instantly share code, notes, and snippets.

View bagus2x's full-sized avatar
🎯
Focusing

tubagus saifulloh bagus2x

🎯
Focusing
View GitHub Profile
This file has been truncated, but you can view the full file.
[
"{\"structValue\":{\"fields\":{\"raw_detection_scores\":{\"listValue\":{\"values\":[{\"listValue\":{\"values\":[{\"numberValue\":0.000935435295,\"kind\":\"numberValue\"},{\"numberValue\":0.00124356151,\"kind\":\"numberValue\"},{\"numberValue\":0.00174513459,\"kind\":\"numberValue\"},{\"numberValue\":0.00128659606,\"kind\":\"numberValue\"},{\"numberValue\":0.000911355,\"kind\":\"numberValue\"},{\"numberValue\":0.00494873524,\"kind\":\"numberValue\"},{\"numberValue\":0.000826954842,\"kind\":\"numberValue\"},{\"numberValue\":0.00328528881,\"kind\":\"numberValue\"},{\"numberValue\":0.0019146204,\"kind\":\"numberValue\"}]},\"kind\":\"listValue\"},{\"listValue\":{\"values\":[{\"numberValue\":0.00135439634,\"kind\":\"numberValue\"},{\"numberValue\":0.000440776348,\"kind\":\"numberValue\"},{\"numberValue\":0.000671267509,\"kind\":\"numberValue\"},{\"numberValue\":0.000405371189,\"kind\":\"numberValue\"},{\"numberValue\":0.000530421734,\"kind\":\"numberValue\"},{\"numberValue\":0.00103834271,\"kind\":\"numberVal
@bagus2x
bagus2x / ANDROID_RESOURCE.md
Last active May 11, 2022 00:08
list of common android dependencies

ANDROID DEPENDENCIES

C

dependencies {
  implementation("io.coil-kt:coil-compose:2.0.0")
}
@bagus2x
bagus2x / Indicator.kt
Created March 25, 2022 01:14
Simple custom view for viewpager indicator
package com.bagus2x.indicator
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
class Indicator : View {
@bagus2x
bagus2x / Stack.kt
Created February 5, 2022 11:05
exploring jetpack compose custom Layout
sealed class StackOrientation {
object Horizontal : StackOrientation()
object Vertical : StackOrientation()
}
@Composable
fun Stack(
modifier: Modifier = Modifier,
orientation: StackOrientation = StackOrientation.Vertical,
gap: Dp = 0.dp,
package com.bagus2x.mymovies.ui.detail.movie
import androidx.lifecycle.*
import com.bagus2x.mymovies.data.Movie
import com.bagus2x.mymovies.data.Result
import com.bagus2x.mymovies.data.source.MovieRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.launch
import javax.inject.Inject
@bagus2x
bagus2x / print-hello-word-syscall.go
Created August 31, 2021 03:18
hello world stdout golang syscall
package main
import (
"syscall"
"unsafe"
)
func main() {
str := []byte("Hello World")
syscall.Syscall(syscall.SYS_WRITE, uintptr(syscall.Stdout), uintptr(unsafe.Pointer(&str[0])), uintptr(len(str)))
mkdir ~/.go
echo "GOPATH=$HOME/.go" >> ~/.bashrc
echo "export GOPATH" >> ~/.bashrc
echo "PATH=\$PATH:\$GOPATH/bin # Add GOPATH/bin to PATH for scripting" >> ~/.bashrc
source ~/.bashrc
@bagus2x
bagus2x / cursor-based-pagination-example.txt
Created August 9, 2021 04:33
cursor based pagination example + non unique column
// Keunggulannya bisa untuk nonunique column timestamp
CREATE TABLE cek (
id SERIAL PRIMARY KEY,
name VARCHAR(50) NOT NULL,
created_at INT NOT NULL
);
INSERT INTO cek VALUES (DEFAULT, 'satu', 1);
INSERT INTO cek VALUES (DEFAULT, 'dua', 2);
@bagus2x
bagus2x / useIntersectionObserver.ts
Created August 5, 2021 18:10
simple Intersection Observer hook
import { MutableRefObject, useEffect, useRef } from 'react';
interface Options<Target> {
root?: MutableRefObject<any>;
enabled?: boolean;
rootMargin?: string;
threshold: number;
onIntersect: (entry?: IntersectionObserverEntry, target?: Target) => void;
}
@bagus2x
bagus2x / react-query-when-button-is-clicked.ts
Created August 5, 2021 06:59
react query example when button is clicked
import React from 'react';
import { useQuery } from 'react-query';
function Playground() {
const { data, refetch } = useQuery(
'RANDOM',
async () => {
const res = await new Promise<number>((resolve) => setTimeout(() => resolve(Math.random()), 1000));
return res;
},