Skip to content

Instantly share code, notes, and snippets.

@ace-dent
ace-dent / markdown-test.md
Last active January 21, 2023 14:08
Testing GitHub Flavour Markdown (GFM) - Parsing of #headers to create anchors / auto-links

hyphenminus - test0

-

2hyphenminus -- test1

--

3hyphenminus --- test2

---

endash – test3

2endash –– test4

––

@ace-dent
ace-dent / BMO.py
Last active April 29, 2024 01:37
BMO for Thumby
from machine import freq, reset, lightsleep
freq(250_000_000) # Speed up CPU for faster imports
import thumbyGraphics
from thumbyButton import actionPressed
# Tweaks for extended battery life
freq(24_000_000) # Lowest stable CPU frequency
thumbyGraphics.display.brightness(1) # Low brightness
thumbyGraphics.display.setFPS(0) # Minimal frame rate: draws buffer without delay
@ace-dent
ace-dent / TODAY service
Created April 3, 2015 22:19
Insert today's date in Mac OS X. Add as a Service via Automator using AppleScript, to create a Shortcut.
on run
# TODAY - Returns today's date!
# Create your own Service, to avoid 3rd Party software (WordService, etc.)
# In Automator:
# > Service receives 'no input' in 'any application'
# > Output replaces selected text
# Add Shortcut (e.g. Ctrl+Cmd+T - it's hard to find a free shortcut!):
# > Preferences > Keyboard > Keyboard Shortcuts > Services
# When setting up Keyboard Shortcut, *exit* the target app before testing. (It seems shortcuts are only refreshed when app is launched)
# Adjust 'Short' Date format
@ace-dent
ace-dent / string_pack.php
Last active January 2, 2016 15:49
Pack small strings or Codes (e.g. 2 letter ISO country codes), into a compact 'magic string' minimized by: 1> Running Codes into each other (eliminating matching first and last letters) 'AB'+'BA' => 'ABA' ; 2> Avoiding spaces / code break characters, by joining Codes 'AA,BB' => 'AABB';Only where 1&2 generates allowable sequences (unique, with no…
<?php
/**
* MAGICSTRINGPACKER
*
* Pack small strings or Codes (e.g. 2 letter ISO country codes), into a compact 'magic string' minimized by:
* 1> Running Codes into each other (eliminating matching first and last letters) 'AB'+'BA' => 'ABA' ;
* 2> Avoiding spaces / code break characters, by joining Codes 'AA,BB' => 'AABB';
* Only where 1&2 generates allowable sequences (unique, with no collisions).
* This is useful for matching data against a compact reference (magic string), where hashing isn't an option.
* E.g. Checking country codes in a spreadsheet against the list of EU countries.