Skip to content

Instantly share code, notes, and snippets.

Frank Rausch frankrausch

View GitHub Profile
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 1, 2019
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.