Skip to content

Instantly share code, notes, and snippets.

View JakeSteam's full-sized avatar
🤖

Jake Lee JakeSteam

🤖
View GitHub Profile
@JakeSteam
JakeSteam / AndroidManifest.xml
Created April 28, 2019 21:13
"How to programmatically change your Android app icon and name" for http://blog.jakelee.co.uk/programmatically-changing-app-icon
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="uk.co.jakelee.dynamiciconchanging">
<application
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
@JakeSteam
JakeSteam / clean_stumbleupon_metadata.py
Last active January 11, 2026 17:18
Bulk downloading from Archive.org's Wayback Machine and extracting data into CSVs (e.g. StumbleUpon)
import pandas as pd
import csv
df = pd.read_csv('data-parsed/parsed.csv')
df = df.drop_duplicates(subset='id', keep='last')
df.to_csv('data-parsed/parsed-cleaned.csv', index=False, quoting=csv.QUOTE_NONNUMERIC)
@JakeSteam
JakeSteam / ForceUpdateHandler.kt
Last active July 23, 2025 09:59
Forcing app updates on Android using Google's in-app update library https://blog.jakelee.co.uk/implementing-google-in-app-updates-for-android/
// Adapted from https://developer.android.com/guide/playcore/in-app-updates/kotlin-java
class ForceUpdateHandler @Inject constructor(
private val abTestManager: ABTestManager // Optional
) {
fun forceUpdateIfNeeded(activity: ComponentActivity) {
// Optional, an optimisation / safety check
val minimumAllowedVersion = abTestManager.remoteConfigLong(FirebaseRemoteConfigKeys.minimum_version)
if (BuildConfig.VERSION_CODE >= minimumAllowedVersion) {
return
@JakeSteam
JakeSteam / MyFragment.kt
Last active January 9, 2025 11:28
Remotely configurable in-app Play Store review prompt in Kotlin
class MyFragment {
val navToBookings: () -> Unit = {
findNavController().navigate(MyFragmentDirections.toBookings())
}
fun eventHandler(event: TicketConfirmationEvents) {
when (event) {
is TicketConfirmationEvents.OnLookAtMyTicket -> {
viewModel.onLookAtMyTicket(navToBookings)
@JakeSteam
JakeSteam / Icons.kt
Last active December 23, 2024 21:32
compose-material-dialogs forwardport for Compose 1.7.1+
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@JakeSteam
JakeSteam / artist_parse.py
Last active December 7, 2024 20:42
Script to parse all years & artists from "by artist1, artist2, artist3" in GitHub's Octodex feed
import xml.etree.ElementTree as ET
from collections import Counter
import re
# Source: https://octodex.github.com/atom.xml
tree = ET.parse('atom.xml')
root = tree.getroot()
artists = re.findall(r' by ([\w\s,]+)\n', ET.tostring(root, encoding='unicode', method='text'), re.IGNORECASE)
@JakeSteam
JakeSteam / home.html
Created November 30, 2024 18:03
How to add automatic webp post banners to Jekyll for faster load times
...
<a class="post-link" href="{{ post.url | relative_url }}">
{% include custom/webp.html path=post.image alt=post.title %}
</a>
...
@JakeSteam
JakeSteam / calendar.html
Last active October 11, 2024 17:41
Jekyll / Liquid calendar with custom events
<div class="calendar-container">
{% assign current_year = 'now' | date: '%Y' %}
{% for month in (1..12) %}
<!-- Month prep -->
{% assign month_str = month | prepend: '0' | slice: -2, 2 %}
{% assign month_start_date = current_year | append: '-' | append: month_str | append: '-01' %}
{% assign month_start_timestamp = month_start_date | date: "%s" %}
{% assign first_day_found = false %}
<div class="calendar-month">
Red Page
Red Page (dirty)
Yellow Page
Yellow Page (dirty)
Green Page
Green Page (dirty)
Blue Page
Blue Page (dirty)
Pink Page
Pink Page (dirty)
@JakeSteam
JakeSteam / Car.kt
Last active September 4, 2024 17:15
How to extract a Room list column into a new linked table, migrating data https://blog.jakelee.co.uk/how-to-extract-a-room-list-column-into-a-new-linked-table-migrating-data/
class Car(
@Embedded
val metadata: CarMetadata,
@Relation(
parentColumn = "id", // The name of the CarMetadata ID field
entityColumn = "carId" // The name of the Component's car ID field
)
var components: List<Component>
)