Skip to content

Instantly share code, notes, and snippets.

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

Indrajit Chakrabarty indyfromoz

🏠
Working from home
View GitHub Profile
@riggaroo
riggaroo / KeyframesWithSpline.kt
Created December 17, 2024 11:34
KeyframesWithSpline Example
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.VectorConverter
import androidx.compose.animation.core.animateValue
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.keyframesWithSpline
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
@riggaroo
riggaroo / AnimateBounds.kt
Last active December 27, 2024 08:07
Simple Modifier.animateBounds() example
@OptIn(ExperimentalSharedTransitionApi::class)
@Preview
@Composable
private fun AnimateBoundsSimple() {
// We need the SharedTransitionLayout in order for the animateBounds modifier to have a
// lookaheadScope to use.
SharedTransitionLayout {
var position by remember {
mutableStateOf(true)
}
@emeowj
emeowj / DialControl.kt
Last active November 4, 2024 23:34
DialControl Final Code
import androidx.annotation.FloatRange
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.VectorConverter
import androidx.compose.animation.core.spring
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
@tarrouye
tarrouye / AMAlbumDetailsView.swift
Created October 5, 2024 23:49
Sample code replicating the album details / track list screen from Apple Music
struct AMAlbumDetailsView: View {
let albumArt: Image
let title: String
let artist: String
let genre: String
let releaseYear: String
let quality: String
let tracks: [String]
@State private var playingTrack: String?
@dannguyen
dannguyen / README.openai-structured-output-demo.md
Last active April 14, 2025 16:56
A basic test of OpenAI's Structured Output feature against financial disclosure reports and a newspaper's police blotter. Code examples use the Python SDK and pydantic for the schema definition.

Extracting financial disclosure reports and police blotter narratives using OpenAI's Structured Output

tl;dr this demo shows how to call OpenAI's gpt-4o-mini model, provide it with URL of a screenshot of a document, and extract data that follows a schema you define. The results are pretty solid even with little effort in defining the data — and no effort doing data prep. OpenAI's API could be a cost-efficient tool for large scale data gathering projects involving public documents.

OpenAI announced Structured Outputs for its API, a feature that allows users to specify the fields and schema of extracted data, and guarantees that the JSON output will follow that specification.

For example, given a Congressional financial disclosure report, with assets defined in a table like this:

@emenjivar
emenjivar / AnimatedTypingIndicator.kt
Created June 23, 2024 17:39
Animated typing indicator in jetpack compose
/**
* Display an animated typing indicator with a configurable number of dots.
*
* @param modifier The modifier to be applied to the component.
* @param configuration The configuration for the component's appearance.
* @param totalDots The total number of dots displayed in the indicator.
*/
@Composable
fun AnimatedTypingIndicator(
modifier: Modifier = Modifier,
@akexorcist
akexorcist / BeakShape.kt
Last active July 6, 2024 22:34
Beak Shape for Jetpack Compose or Compose Multiplatform
import androidx.annotation.FloatRange
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.LayoutDirection
import kotlin.math.atan2
import kotlin.math.cos
import kotlin.math.pow
//
// SignatureAnimation.swift
// OpenSwiftUIAnimations
//
// Created by Amos Gyamfi on 11.5.2024.
//
import SwiftUI
struct SignatureAnimation: View {
//
// MeasuringHeartRate.swift
import SwiftUI
struct MeasuringHeartRate: View {
@State var measuring = false
let streamBlue = Color(#colorLiteral(red: 0, green: 0.3725490196, blue: 1, alpha: 1))
let streamRed = Color(#colorLiteral(red: 1, green: 0, blue: 0, alpha: 1))
//
// DateTimeTimerView..swift
import SwiftUI
struct DateTimeTimerView: View {
var body: some View {
NavigationStack {
List {
// 1. Month, day, year