Skip to content

Instantly share code, notes, and snippets.

@akaleeroy
akaleeroy / README.md
Last active Jun 10, 2019
d3.js – Automatic label placement with d3-labeler
View README.md

d3.js v3 + tinker10/D3-Labeler: D3 plug-in for automatic label placement using simulated annealing.

Trying to get good auto-placing of labels on a map.

Am I doing something wrong? It doesn't completely avoid overlaps...
I don't want to have to manually go in and fix overlaps. That way these SVGs can be exported automatically by a build system.

⚠️ Give it a refresh so that the webfont loads from cache.
I didn't take the time to fix orchestration here because I have Montserrat v5 installed, I don't care about running it on the web.

@akaleeroy
akaleeroy / fluxautomation.ahk
Last active Mar 12, 2019
Disable f.lux when specific display connected
View fluxautomation.ahk
; Listens for display connected and checks its name against TARGET_DISPLAYS
; then automates "disable for fullscreen apps" option
; CONFIGURE your projector/TV here. Use the names from Screen resolution control panel
global TARGET_DISPLAYS := "MP-CL1A,SONY TV XV" ; MatchList
; [Beginner question and script for dual monitors](https://autohotkey.com/boards/viewtopic.php?t=6035)
OnMessage(0x7E, "onDisplayChange")
onDisplayChange() {
@akaleeroy
akaleeroy / youtube-badtitles.js
Last active Nov 21, 2019
Parsing song titles on YouTube
View youtube-badtitles.js
/* eslint-disable */
// YouTube Music Uploader Hall of Shame
// Trying to grok the range of malformed input in song title strings
[
'BPC335 - Maxime Iko "Concilium"', // wrong order (catalog number before everything else), extra info (catalog number), bad separator `"`, bad extra separator `-`
'"Pollution" by Tom Lehrer', // wrong order (`Artist - Title` reversed), quotes, bad separator `by`
'DIS IZ WHY I\'M HOT (zef remix) - Die Antwoord', // `Artist - Title` reversed, bad case
'Man with no name - Teleport (Original mix). HQ', // bad case, noisy `(Original mix)`, extra info `HQ`, bad extra separator `.`
'Varg — Under Beige Nylon', // uneven spaces, bad separator `—`
'varg - under beige nylon - 46bpm', // bad case, bad extra separator `-`, extra info `46bpm`
@akaleeroy
akaleeroy / Quick Folder Aliases.md
Last active Jan 20, 2019
Quick Folder Aliases - Self-shortcut aliases to help you find a folder by several names
View Quick Folder Aliases.md

Quick Folder Aliases

Windows AutoHotkey Usability Accelerator

Quick Folder Aliases with Hotkey

In Windows Explorer press Win + F2 or Win + ; to create a self-shortcut alias for the currently opened folder.

View taskbar-quick-close.ahk
; Taskbar Quick Close
; Quick closing windows from the taskbar with Middle-click.
; Ctrl + Middle-click for original action (new window)
#If ShouldActivateMButton()
; Control + Middle-click does the middle-click action (new window)
^MButton::MButton
; Middle-click to close, for quicker one-handed use
MButton::
MouseClick, Right
@akaleeroy
akaleeroy / Slick-Scrollbars.md
Last active May 30, 2018
Slick Scrollbars Userstyle
View Slick-Scrollbars.md

Slick Scrollbars Userstyle

Replace the appalling default Windows scrollbars with these good ones.

Slick Scrollbars Userstyle Demo

They are thin and unobtrusive but by using border: 5px solid transparent they are just as easy to hit.
No need to change width on hover and reflow contents!

@akaleeroy
akaleeroy / pre-commit
Last active Jan 12, 2020
OpenSCAD Export git pre-commit hook
View pre-commit
#!/usr/bin/sh
# Requires OpenSCAD on $PATH
# Automatically re-exports all changed .scad files pre-commit
git diff --cached --name-only | grep ".scad$" | while read -r file; do
basename="${file%.*}"
echo "Exporting $file to $basename.stl..."
openscad -o "$basename.stl" "$file"
done
@akaleeroy
akaleeroy / Gulp-Replace-Only-Relevant-Files.md
Last active Apr 13, 2018
Gulp replace only relevant files
View Gulp-Replace-Only-Relevant-Files.md

gulp-replace only relevant files

gulp replace only relevant files demo

Piping to gulp.dest would re-write all input files. This checks for the pattern first and only passes along files that actually need to be processed, avoiding unnecessary overwriting with the same content. A benefit is that your files' timestamps stay meaningful.

@akaleeroy
akaleeroy / Cursor-Language-Indicator.md
Last active Mar 22, 2018
Cursor Language Indicator - Reflect keyboard layout changes in mouse pointer look.
View Cursor-Language-Indicator.md

Cursor Language Indicator

Windows AutoHotkey Usability

Reflect keyboard layout changes in mouse pointer look.

Cursor Language Indicator Demo

Description

@akaleeroy
akaleeroy / MovableBlank.ahk
Last active Nov 10, 2019
Movable Blank - Blank fullscren GUI window that's click-through
View MovableBlank.ahk
; Movable blank
; Blank fullscren GUI window that's click-through
; It's not power-saving but allows you to peek through when you need it.
; For power saving consider just switching (native Windows shortcut Win + P)
; Move it from screen to screen (native Windows shortcut Win + Shift + Left/Right)
; Make it translucent (Helpers enhancement Win + PgUp/PgDn or Win + WheelUp/WheelDn)
; Close it like a regular window (native Windows Alt + F4)
; Start multiple instances for multiple monitors
You can’t perform that action at this time.