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 swift | |
| import Foundation | |
| guard let pathToMe = URL(string: "\(#file)", relativeTo: URL(fileURLWithPath: FileManager.default.currentDirectoryPath))?.path else { | |
| print("Error: current path of #file") | |
| exit(-1) | |
| } | |
| print( "path to me: \(pathToMe)" ) // path to me: /Users/uchcode/Desktop/path-to-me.swift |
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/osascript | |
| delay(3) //歯車アイコン確認用 | |
| App = Application.currentApplication() | |
| App.includeStandardAdditions = true | |
| App.doShellScript('ls ~/', {alteringLineEndings:false}) |
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
| brew install ruby |
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') | |
| function UserInterface() { | |
| this.okButton = Button(300, 10, 90, 26); { | |
| this.okButton.title = 'OK' | |
| } | |
| this.cancelButton = Button(210, 10, 90, 26); { | |
| this.cancelButton.title = 'Cancel' | |
| this.cancelButton.keyEquivalent = '\u{1b}' | |
| } |
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') | |
| ObjC.import('WebKit') | |
| MyWindow = WebViewWindow('http://www.youtube.com/') | |
| MyWindow.makeKeyAndOrderFront(null) | |
| //===================================================================== | |
| function Window(x, y, width, height) { | |
| let r = $.NSMakeRect(x, y, width, height) |
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') | |
| App = Application.currentApplication() | |
| App.includeStandardAdditions = true | |
| MyAction = SimpleSubclass('Action', { | |
| mewmew(sender) { | |
| App.displayAlert('🐱 mew mew') | |
| }, | |
| quit(sender) { |
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 MenuItem(title, action, target) { | |
| if (!title && !action && !target) return $.NSMenuItem.separatorItem | |
| let i = $.NSMenuItem.alloc.init | |
| i.title = title | |
| i.action = action | |
| i.target = target | |
| return i | |
| } | |
| function StatusItem() { |
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') | |
| class UserInterface { | |
| constructor() { | |
| this.lateLabel = Label(10, 110, 160, 26); { | |
| this.lateLabel.alignment = $.NSRightTextAlignment | |
| this.lateLabel.stringValue = 'Exchange Rate per $1:' | |
| } | |
| this.dollersLabel = Label(10, 80, 160, 26); { | |
| this.dollersLabel.alignment = $.NSRightTextAlignment |
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') | |
| App = Application.currentApplication() | |
| App.includeStandardAdditions = true | |
| const RESOURCE = $.NSBundle.mainBundle.resourcePath.js | |
| const HOST = 'localhost' | |
| const PORT = 8080 | |
| const ADDR = `${HOST}:${PORT}` | |
| const DIR = `${RESOURCE}/public_html/` |