Skip to content

Instantly share code, notes, and snippets.

View scottyab's full-sized avatar

Scott Alexander-Bown scottyab

View GitHub Profile
@scottyab
scottyab / meetup-graphql-query-variables.txt
Last active September 20, 2025 17:20
Query all the past events a meetup.com group has hosted. Meetup doesn’t great way of surfacing a meetup groups past events (paging through the calendar is PITA). This GraphQL query can be run from the MeetupAPI GraphQL playground https://www.meetup.com/api/playground/#graphQl-playground
{ "urlname": "YOUR URL PATH here, for https://www.meetup.com/swmobile the urlname is swmobile" }
@scottyab
scottyab / GetUserProfile.kt
Last active October 24, 2024 11:24
Simple way of determining is the app is running in the context of main user, managed profile, other (i.e private space) or unknown. Potentially useful for alerting users if your app should not be used in PrivateSpace.
import android.content.Context
import android.os.Build
import android.os.UserManager
// Enum to represent the user profile types
enum class UserProfile {
MAIN_USER,
MANAGED_PROFILE,
OTHER_PROFILE,
UNKNOWN
@scottyab
scottyab / precommit
Last active November 16, 2024 14:59
Git precommit hook deigned to run Gradle based static analysis checks for Ktlint and Detekt. Crated for Android Kotlin projects and is compatable with Windows/Mac. Requires Detekt and Ktlint Gradle plugins configured and installed on the project.
#!/bin/sh
echo "Running git pre-commit hook..."
echo "Checking if any kotlin files have changed..."
# Determine the platform
UNAME=$(uname)
# Exit early if no Kotlin files have changed.