Skip to content

Instantly share code, notes, and snippets.

Avatar

Stuart Kent stkent

View GitHub Profile
@stkent
stkent / bookmarklet-source.js
Created Jan 9, 2021
Bookmarklet: copy markdown-formatting link to Trello card
View bookmarklet-source.js
var title = document.getElementsByClassName("card-detail-title-assist")[0].textContent;
var link = document.getElementsByClassName("js-short-url")[0].value;
var mdLink = "[" + title + "](" + link + ")";
navigator.clipboard.writeText(mdLink);
console.log("Copied text " + mdLink + " to clipboard.");
@stkent
stkent / shortcuts.md
Last active Jan 3, 2020
Favorite Android Studio Shortcuts, v2 (Mac)
View shortcuts.md

Exploring

Description Shortcut
Previous/next cursor position Cmd [ / Cmd ]
Open recently used file Cmd E
Open class Cmd O
Open file Cmd Shift O
Open symbol Cmd Opt O
Find string/regex in file Cmd F
@stkent
stkent / android-bluetooth-low-energy-resources.md
Last active Feb 15, 2021
Android Bluetooth Low Energy (BLE) Resources
View android-bluetooth-low-energy-resources.md
View Android Color Control Cheat Sheet
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21.
To use the support version of these attributes, remove the android namespace.
For instance, "android:colorControlNormal" becomes "colorControlNormal".
These attributes will be propagated to their corresponding attributes within the android namespace
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
@stkent
stkent / BlockingIntentService
Created Sep 2, 2016 — forked from SeanPONeil/BlockingIntentService.java
An extension of the IntentService class that will block an Intent from entering the queue if the same Intent is already in the queue.
View BlockingIntentService
package com.atami.mgodroid.util;
import java.util.LinkedList;
import android.app.IntentService;
import android.content.Intent;
/**
* An extension of the IntentService class that will block
@stkent
stkent / intellij-config.md
Last active Aug 25, 2020
IntelliJ configuration
View intellij-config.md

I've tried to sync IntelliJ/Android Studio configurations across installs/machines using several different methods (including the built-in settings repository), and none seem to work as reliably as I would like.

This is a manual setup checklist that replaces those methods.

Last checked: IntelliJ Ultimate 2020.2

IntelliJ Configuration

In Editor -> Font:

  • Set Size to 15.
@stkent
stkent / gpg-import-and-export-instructions.md
Created Apr 23, 2016 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys
View gpg-import-and-export-instructions.md

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/
# or, instead of backing up trustdb...
View keybase.md

Keybase proof

I hereby claim:

  • I am stkent on github.
  • I am stkent (https://keybase.io/stkent) on keybase.
  • I have a public key whose fingerprint is 6E27 DB4B 0E5D A898 4FC8 7ED6 CAA7 CCEA 88BF 876B

To claim this, I am signing this object:

@stkent
stkent / themes-debug.xml
Last active Aug 27, 2015 — forked from dlew/themes-debug.xml
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
View themes-debug.xml
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
View colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>