Skip to content

Instantly share code, notes, and snippets.

View saket's full-sized avatar

Saket Narayan saket

View GitHub Profile
@apkelly
apkelly / Results.md
Last active February 1, 2024 18:53
Annotated String resources in Kotlin and for Jetpack Compose UI

The code below renders the following text in both Android Views and in Jetpack Compose UI.

Contact our team on 555 555 555 Opt 3 to activate.

import androidx.compose.animation.*
import androidx.compose.animation.core.tween
import androidx.compose.material.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.onCommit
import androidx.compose.ui.Modifier
@OptIn(ExperimentalAnimationApi::class, ExperimentalMaterialApi::class)
@Composable
fun <T> AnimatedSwipeDismiss(
@Ribesg
Ribesg / !README.md
Last active June 20, 2022 15:00
How to use an iOS Framework in a Kotlin MPP library published to Maven

This gist demonstrates how to build a Kotlin MPP library so that the iOS sourceSet depends on and uses an iOS Framework as a dependency.

Key ideas:

  • We use [Carthage] to retrieve/build the iOS Framework.
  • We use [cinterop] to create bindings allowing us to use the iOS Framework from Kotlin
  • We build and publish the library using ./gradlew publishToMavenLocal
  • We build and publish [klib] artifacts for both the arm64 and x86_64 architectures, you can easily add arm32 if you need.
  • Note that the publish process also publishes a cinterop klib artifact, allowing dependents to also know about the iOS Framework headers.

You can find a gist explaining how to use such library in an iOS app [here][ios-app].

How Do I Into Git?

a helpful primer for users sick of git's poorly-named commands

I've used Git since 2011, and this is the stuff that I've always had to Google to remember. I hope it helps you not hate Git so much.

Learning About the Repo

Learning About History

@mttkay
mttkay / Pager.java
Created November 4, 2015 15:46
A simple Rx based pager
public class Pager<I, O> {
private static final Observable FINISH_SEQUENCE = Observable.never();
private PublishSubject<Observable<I>> pages;
private Observable<I> nextPage = finish();
private Subscription subscription = Subscriptions.empty();
private final PagingFunction<I> pagingFunction;
private final Func1<I, O> pageTransformer;
@witt3rd
witt3rd / brew-sync.sh
Last active February 25, 2024 12:04 — forked from jpawlowski/brew-sync.sh
Sync Homebrew installations between Macs via Dropbox
#!/bin/bash
# Sync Homebrew installations between Macs via Dropbox
#
BREW="/usr/local/bin/brew"
# first get local settings
echo "Reading local settings ..."
rm -f /tmp/brew-sync.*
@pgloaguen
pgloaguen / gist:10b69882a6f721ce98f6
Last active January 12, 2023 04:52
PhotographicPrintAnimator realize a beautiful photographic print animation as described in the Material design spec (http://www.google.com/design/spec/patterns/loading-images.html#loading-images-loading-images)
import android.animation.ValueAnimator;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.ImageView;
import java.lang.ref.SoftReference;
public class PhotographicPrintAnimator {
@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 9, 2024 13:54
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@Cheesebaron
Cheesebaron / Activity1.cs
Last active September 15, 2020 14:21
Sample showing how to use Spannables to replace text with Images in Mono for Android.
using Android.App;
using Android.Text;
using Android.Text.Style;
using Android.Widget;
using Android.OS;
namespace MonoDroid.TextViewWithImages
{
[Activity(Label = "Text with Images", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity