Skip to content

Instantly share code, notes, and snippets.

View fallroot's full-sized avatar

Chookeun Moon fallroot

  • dlp Studio Inc.
  • Seoul, Korea
View GitHub Profile
@fallroot
fallroot / getAppList.js
Created September 19, 2019 04:08
Get running apps ordered by most recently used first in macOS
ObjC.import('Cocoa')
const windows = ObjC.deepUnwrap($.CGWindowListCopyWindowInfo($.kCGWindowListOptionOnScreenOnly | $.kCGWindowListExcludeDesktopElements, $.kCGNullWindowID))
Array.from(new Set(windows.map(w => w.kCGWindowOwnerName)))
@fallroot
fallroot / search.js
Created March 15, 2019 06:00
Tiny Fuzzzy Search
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)
@fallroot
fallroot / getPasteboardItemsAsString.js
Created February 25, 2019 06:18
Simple Clipboard Viewer in macOS
/*
* Simple Clipboard Viewer in macOS
* Run with Script Editor
*/
ObjC.import('AppKit')
function getPasteboardItemsAsString () {
const items = $.NSPasteboard.generalPasteboard.pasteboardItems
@fallroot
fallroot / manipulating-plist-in-macos-cli.md
Created August 7, 2017 06:08
Manipulating Property List in macOS Command Line

Manipulating Property List in macOS Command Line

Tools

⚠️ defaults 명령어는 홈 경로(~)는 인식하지만 상대 경로(., ..)는 인식하지 않는다.

@fallroot
fallroot / git-cherry-diff.md
Last active February 27, 2019 08:21
Diff two branch what was not cherry-picked and cherry-pick with -c option Raw

Git Cherry Diff

Git Cherry

git cherry [-v] [<upstream> [<head> [<limit>]]]

git-cherry - Find commits yet to be applied to upstream

@fallroot
fallroot / cherry_diff.sh
Created January 13, 2017 10:35
Diff two branch what was not cherry-picked and cherry-pick with -c option
#!/bin/sh
while getopts "c" opt
do
case $opt in
c)
do_cherry_pick=true
;;
esac
done
@fallroot
fallroot / css-selector-minifier.rb
Created December 9, 2016 01:56
Simple CSS Selector Minifier
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
@fallroot
fallroot / open-notification-center-with-jxa.js
Created February 12, 2015 19:00
Open OSX Notification Center with JXA
Application('System Events')
.processes['SystemUIServer']
.menuBars
.menuBarItems
.whose({
name: 'Notification Center'
})
.menuBarItems()
.reduce(function(a, b) {
return a.concat(b);
@fallroot
fallroot / gist:1892514
Created February 23, 2012 11:46
Sublime Text 2 Keymap to Markdown
#!/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']