Skip to content

Instantly share code, notes, and snippets.

@macneko-ayu
macneko-ayu / private.xml
Created May 22, 2018 08:31 — forked from kickbase/private.xml
Karabiner private.xml for Emacs, Vim, VSCode, Unity, Houdini.
<?xml version="1.0"?>
<root>
<appdef>
<appname>TERMINAL</appname>
<equal>com.apple.Terminal</equal>
</appdef>
<appdef>
<appname>ITERM2</appname>
<equal>com.googlecode.iterm2</equal>
</appdef>
@macneko-ayu
macneko-ayu / InterfaceController.swift
Last active April 25, 2020 13:05
WKInterfaceLabel to automatically scroll horizontally
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
@IBOutlet var notEndlessLabel: WKInterfaceLabel!
@IBOutlet var endlessLabel: WKInterfaceLabel!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
@macneko-ayu
macneko-ayu / UIAlertControllerExtension.swift
Last active July 5, 2021 10:36
Sample calling a delegate method like UIAlertView when UIAlertController's UIAlertAction is executed. Available with Swift and Objective-C.
import UIKit
@objc protocol AlertControllerDelegate: class {
func alertController(_ alert: UIAlertController, tappedIndex: Int) -> Void
}
private var DelegateKey: UInt8 = 0
private var TagKey: UInt8 = 0
extension UIAlertController {
@macneko-ayu
macneko-ayu / UINavigationBar+Height.swift
Created March 16, 2017 10:16 — forked from siberianisaev/UINavigationBar+Height.swift
Change height of UINavigationBar
import Foundation
private var AssociatedObjectHandle: UInt8 = 0
extension UINavigationBar {
var height: CGFloat {
get {
if let h = objc_getAssociatedObject(self, &AssociatedObjectHandle) as? CGFloat {
@macneko-ayu
macneko-ayu / LayerObjectCount.jsx
Created January 30, 2016 01:58
Illustratorのレイヤーに配置されたオブジェクトの数を数えてファイルに書き出すJavaScript Raw
main();
function main() {
var str = layerObjectCount(app.activeDocument);
writeFile(str);
}
function layerObjectCount(docObj) {
var mergeStrings = "";
for (var i = 0, iLen = docObj.layers.length; i < iLen ; i++) {