Skip to content

Instantly share code, notes, and snippets.

Frank Rausch frankrausch

Block or report user

Report or block frankrausch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@frankrausch
frankrausch / SFUI-HighLegibilityFontDescriptor.swift
Created May 26, 2020
UIFontDescriptor for SF UI high-legibility figures
View SFUI-HighLegibilityFontDescriptor.swift
func fontDescriptorWithHighLegibilityMonospacedFigures(for fontDescriptor: UIFontDescriptor) -> UIFontDescriptor {
return fontDescriptor.addingAttributes(
[
UIFontDescriptor.AttributeName.featureSettings:
[
[ // High legibility 6 and 9
UIFontDescriptor.FeatureKey.featureIdentifier: kStylisticAlternativesType,
UIFontDescriptor.FeatureKey.typeIdentifier: kStylisticAltOneOnSelector,
],
[ // High legibility 4
@frankrausch
frankrausch / gist:572a3368c50b77be854265a8c91a77b2
Created May 13, 2020
Convert UIKeyCommand from deprecated init syntax to iOS 13 SDK syntax
View gist:572a3368c50b77be854265a8c91a77b2
# Regex:
UIKeyCommand\(input: (.+)\, modifierFlags: (.+), action: #selector\((.+)\), discoverabilityTitle: (.+)\),
# Replace:
UIKeyCommand(title: $4,
image: nil,
action: #selector($3),
input: $1,
modifierFlags: $2,
propertyList: nil,
View Typesetting Libraries and Plugins.md

Typesetting Libraries and Plugins

These are tools that improve typographic details like microtypography and typographic syntax automatically.

Additions welcome!

Name Language/Platform
JoliTypo PHP
PHP SmartyPants PHP
View FR.alfredappearance
{
"alfredtheme" : {
"result" : {
"textSpacing" : 4,
"subtext" : {
"size" : 12,
"colorSelected" : "#FFFFFFFF",
"font" : "CamingoCode",
"color" : "#7F7F7FFF"
},
@frankrausch
frankrausch / Alfred Create New File.scpt
Last active Mar 22, 2019
Alfred Workflow AppleScript to create an empty file in the current Finder window
View Alfred Create New File.scpt
on alfred_script(q)
set title to "Untitled.txt"
if q is not equal to "" then set title to q
tell application "Finder" to make new file at (the target of the front window) as alias with properties {name: title}
end alfred_script
@frankrausch
frankrausch / change-speed-of-mp3.sh
Last active Mar 31, 2018
Slow down or speed up all MP3 files in a folder with FFmpeg.
View change-speed-of-mp3.sh
#/bin/sh
speed="0.7"
mkdir "speed-${speed}x"
for f in *.mp3
do ffmpeg -i "$f" -filter:a "atempo=${speed}" "./speed-${speed}x/$f"
done
@frankrausch
frankrausch / CustomDocumentWindow.swift
Last active Sep 4, 2018
Prevent NSPopover from stealing an NSTextField’s focus when using the popover to display live search results. Swift adaption of Wil Shipley’s solution (https://stackoverflow.com/a/21111462)
View CustomDocumentWindow.swift
protocol PopoverFirstResponderStealingSuppression {
var suppressFirstResponderWhenPopoverShows: Bool { get }
}
class CustomDocumentWindow: NSWindow {
override func makeFirstResponder(_ responder: NSResponder?) -> Bool {
if responder != self.firstResponder,
let newFirstResponder = responder as? NSView {
let newFirstResponderWindow = newFirstResponder.window
@frankrausch
frankrausch / make-icons.sh
Last active Dec 16, 2017
Compile individual SVG icons into one SASS file as data URIs
View make-icons.sh
sourceFiles="../assets/icons/*.svg"
destFile="../assets/sass/_icons.svg.scss"
classPrefix=".icon-"
echo "Compiling icons from "$sourceFiles" into "$destFile""
echo "" > $destFile
for fileWithPath in ../assets/icons/*.svg;
do
contents=$(cat $fileWithPath)
@frankrausch
frankrausch / String+Hyphenation.swift
Last active Apr 9, 2020
Returns a String with soft hyphens (U+00AD)
View String+Hyphenation.swift
import Foundation
extension String {
func hyphenated(languageCode: String) -> String {
let locale = Locale(identifier: languageCode)
return self.hyphenated(locale: locale)
}
func hyphenated(locale: Locale) -> String {
You can’t perform that action at this time.