Skip to content

Instantly share code, notes, and snippets.

@hyvyys
hyvyys / typographic.ahk
Created Nov 11, 2020
Extend Windows keyboard layout with typographic quotes, dashes and others
View typographic.ahk
; print endash
!-::
Send {Asc 0150}
return
; print emdash
+!-::
Send {Asc 0151}
return
@hyvyys
hyvyys / fontlab.ahk
Last active Nov 13, 2020
AutoHotKey script for FontLab
View fontlab.ahk
; prevent Alt-zooming from triggering top menu
Alt::
KeyWait, Alt
return
LAlt Up::
if (A_PriorKey = "Alt")
return
return
@hyvyys
hyvyys / CSS_KEYWORD_COLORS.js
Last active Sep 13, 2020
List of CSS color keywords and corresponding hex values
View CSS_KEYWORD_COLORS.js
const CSS_KEYWORD_COLORS = {
"AliceBlue": "#f0f8ff",
"AntiqueWhite": "#faebd7",
"Aqua": "#00ffff",
"Aquamarine": "#7fffd4",
"Azure": "#f0ffff",
"Beige": "#f5f5dc",
"Bisque": "#ffe4c4",
"Black": "#000000",
"BlanchedAlmond": "#ffebcd",
@hyvyys
hyvyys / MarkToLigature.py
Last active Feb 10, 2020
Generate lookups for mark feature from anchors in ligature glyphs named "top.1", "top.2", etc.
View MarkToLigature.py
#FLM: Mark to ligature
from FL import *
classes = [ 'top', 'bottom', 'ogonek', 'right' ];
f = fl.font
glyphs = f.glyphs
for anchorClass in classes:
print ''
@hyvyys
hyvyys / ChordRegex.js
Created Oct 14, 2019
Regular expression to match Chord symbol / name
View ChordRegex.js
function chordRegex() {
const note = '[A-G][b#]?';
const altered = `(?:5|dim(5|7)?|aug5?|\\+5?|-5?)`;
const minor = '(?:mi?n?)';
const major = '(?:maj?|Ma?j?)';
const majorableExt = `(?:6|7|9|11|13)`;
const ext = `(?:4|6|7|9|11|13|6\\/9)`;
const _mod = '(?:[b-](5|6|9|13)|[#+](4|5|9|11))';
const mod = `(?:\\(${_mod}\\)|${_mod})`
const sus = '(?:sus(2|4|24|2sus4)?)';
@hyvyys
hyvyys / SyllableRegex.js
Last active Oct 6, 2019
Syllable regular expression (English)
View SyllableRegex.js
function syllableRegex() {
const consonants = "[bcdfghjklmnpqrstvwxyz']";
const vowels = "[aeiouy]";
const separators = "[ \\.,:;!?]|$";
const wordSep = `(?=${separators})`;
const wordSepOrConsonant = `(?=${separators}|${consonants})`;
return new RegExp(
`${consonants}*${vowels}{1,3}` +
`(${consonants}*e${wordSep}|${consonants}*${wordSepOrConsonant})`,
@hyvyys
hyvyys / Chord line regex.txt
Last active Sep 29, 2019
Regular expression to match lines with guitar chords in a guitar tab
View Chord line regex.txt
^ *([A-Z\.majdimsusaug()b#1-9/]+ +)*([A-Z\.majdimsusaug()b#1-9/]+)\r\n
@hyvyys
hyvyys / CaseFilter.js
Created Sep 22, 2019
Remove lowercase or uppercase letters from a string, using `grapheme-splitter` to handle languages using combining diacritical marks.
View CaseFilter.js
import GraphemeSplitter from "grapheme-splitter";
export default {
lower(str) {
let splitter = new GraphemeSplitter();
let graphemes = splitter.splitGraphemes(str);
return graphemes.filter(g => g.toLowerCase() === g).join("");
},
upper(str) {
let splitter = new GraphemeSplitter();