This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ObjC.import('Cocoa') | |
const windows = ObjC.deepUnwrap($.CGWindowListCopyWindowInfo($.kCGWindowListOptionOnScreenOnly | $.kCGWindowListExcludeDesktopElements, $.kCGNullWindowID)) | |
Array.from(new Set(windows.map(w => w.kCGWindowOwnerName))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function search (text, keyword) { | |
let start = 0 | |
text = text.toLowerCase() | |
keyword = keyword.toLowerCase() | |
for (let i = 0; i < keyword.length; ++i) { | |
const char = keyword[i] | |
const index = text.indexOf(char, start) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Simple Clipboard Viewer in macOS | |
* Run with Script Editor | |
*/ | |
ObjC.import('AppKit') | |
function getPasteboardItemsAsString () { | |
const items = $.NSPasteboard.generalPasteboard.pasteboardItems |
git cherry [-v] [<upstream> [<head> [<limit>]]]
git-cherry - Find commits yet to be applied to upstream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while getopts "c" opt | |
do | |
case $opt in | |
c) | |
do_cherry_pick=true | |
;; | |
esac | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CHARS = [*'A'..'Z', *'a'..'z'] | |
def index_to_shortcut(number, base = 52) | |
quotient, remainder = number.divmod(base) | |
if quotient.zero? | |
CHARS[remainder] | |
else | |
index_to_shortcut(quotient - 1, base) + CHARS[remainder] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Application('System Events') | |
.processes['SystemUIServer'] | |
.menuBars | |
.menuBarItems | |
.whose({ | |
name: 'Notification Center' | |
}) | |
.menuBarItems() | |
.reduce(function(a, b) { | |
return a.concat(b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#encoding: utf-8 | |
require 'json' | |
old_keymap = JSON.parse IO.read('keymap-file') | |
result = "Key|Description\n---|---\n" | |
old_keymap.each do |keymap| | |
keys = keymap['keys'] |