Skip to content

Instantly share code, notes, and snippets.

View jcraane's full-sized avatar

Jamie Craane jcraane

View GitHub Profile
// Usage:
// blacklist
String[] blacklist = new String[]{"com.any.package", "net.other.package"};
// your share intent
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "some text");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "a subject");
// ... anything else you want to add
// invoke custom chooser
@graydon
graydon / country-bounding-boxes.py
Created April 23, 2014 00:03
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@DinosaurDad
DinosaurDad / aws-s3-delete-files-with-extension.sh
Created January 15, 2018 20:57
AWS - S3 - Delete files with extension
aws s3 rm s3://somebucket/somefolder/ --recursive --dryrun --exclude "*" --include "*.json"
@codan-telcikt
codan-telcikt / geometry_geojson.yaml
Last active September 3, 2023 11:47 — forked from bubbobne/geometry_geojson.yaml
An OpenAPI definition for GeoJSON with Geometry and Features.
# MIT License
#
# Copyright (c) 2017 Daniele Andreis <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@ErikHellman
ErikHellman / LoginScreenWithCompose.kt
Created December 16, 2019 17:51
A simple demo of using Jetpack Compose to build a Login screen
package se.hellsoft.jetpackcomposeintro
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.Composable
import androidx.compose.Model
import androidx.compose.state
import androidx.compose.unaryPlus
import androidx.ui.core.*
import androidx.ui.foundation.shape.border.Border
@MarkusKramer
MarkusKramer / Base64.kt
Last active October 29, 2024 14:53
Kotlin Multiplatform Base64 - no extra dependencies. Based on Java's implementation.
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
@dhermes
dhermes / README.md
Last active January 30, 2024 21:45
Understanding Cross-Account ECR Options

Understanding Cross-Account ECR Options

Executive Summary

  • Common to split environments into multiple AWS accounts; e.g. sandbox:111111111111 and prod:222222222222
  • Common to have multiple Kubernetes clusters in a given account; e.g. dev and sandbox clusters in sandbox:111111111111 and beta and prod clusters in prod:222222222222
  • Centralize ECR images in a dedicated registry (one registry per AWS region);
@Aidanvii7
Aidanvii7 / NavControllerComposeUtils.kt
Last active August 13, 2023 16:38
Compose Navigation with Parcelable arguments
@file:Suppress("UnnecessaryVariable", "PackageDirectoryMismatch")
package androidx.navigation
import android.os.Bundle
import android.os.Parcelable
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
fun NavController.navigate(
@AlexGladkov
AlexGladkov / Example.swift
Created July 26, 2021 08:22
SwiftUI + Kotlin Flow
struct ExampleView: View {
let viewModel: AuthViewModel = AuthViewModel()
var body: some View {
ObservingView(statePublisher: asPublisher(viewModel.viewStates()),
actionPublisher: asPublisher(viewModel.viewActions()),
content: { state, action in
// your view here
})
@c5inco
c5inco / MaterialMotionTransitions.kt
Last active December 7, 2023 08:12
Reusable transitions that map to Material 2 motion system - https://material.io/develop/android/theming/motion
// Requires Compose 1.1.0-alpha02+
// Best used with navigation animation transitions in Accompanist 0.17.0+
import androidx.compose.animation.*
import androidx.compose.animation.core.FastOutLinearInEasing
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.tween
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.dp