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
extension URLSession { | |
/* | |
* synchronousDataTask | |
* | |
* Httpデータを同期的に取得します。スレッドをブロックするので使用に注意してください。 | |
*/ | |
func dataTask(with request:URLRequest) -> (data:Data?, response:URLResponse?, error:Error?) { | |
let semaphore = DispatchSemaphore(value: 0) |
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
// JXA shell kit. | |
// uchcode. - MIT Licensed | |
ObjC.import('stdlib'); | |
ObjC.import('unistd'); | |
try { | |
CurrentApp; | |
} catch(e) { | |
CurrentApp = Application.currentApplication(); |
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 require(path) { | |
if(!path) throw new Error("require: missing argument: path") | |
function ItemPath(path) { | |
let p = $(path).stringByStandardizingPath.js | |
if ( !FileManager.fileExistsAtPath(p) ) { | |
if ( FileManager.fileExistsAtPath(p+'.js') ) { | |
return p+'.js' | |
} else { | |
return null | |
} |
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 read(fname, inDirectory) { | |
var d = inDirectory || '~/Library/Script Libraries' | |
var p = $(`${d}/${fname}`).stringByStandardizingPath | |
var u = $.NSUTF8StringEncoding | |
var e = $() | |
var c = $.NSString.stringWithContentsOfFileEncodingError(p, u, e).js | |
if (e.js) { | |
throw new Error($.NSString.stringWithFormat('%@', e).js) | |
} | |
return c |
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') | |
//////////////////////////////////////////////////////////////////////////////// | |
// View | |
//////////////////////////////////////////////////////////////////////////////// | |
class Window { | |
constructor(x, y, width, height) { | |
let f = $.NSMakeRect(x, y, width, height) | |
let s = $.NSTitledWindowMask | $.NSClosableWindowMask | $.NSMiniaturizableWindowMask |
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') | |
GreetButton = $.NSButton.alloc.initWithFrame($.NSMakeRect(10, 10, 110, 80)) | |
GreetButton.title = 'Hello!' | |
GreetButton.bezelStyle = $.NSRegularSquareBezelStyle | |
GreetButton.sound = $.NSSound.alloc.initWithContentsOfFileByReference('/System/Library/Sounds/Tink.aiff', true) | |
GoodbyeButton = $.NSButton.alloc.initWithFrame($.NSMakeRect(130, 10, 110, 80)) | |
GoodbyeButton.title = 'Goodbye!' | |
GoodbyeButton.bezelStyle = $.NSRegularSquareBezelStyle |
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') | |
//////////////////////////////////////////////////////////////////////////////// | |
// View | |
//////////////////////////////////////////////////////////////////////////////// | |
function Window(x, y, w, h) { | |
let f = $.NSMakeRect(x, y, w, h) | |
let s = $.NSTitledWindowMask | $.NSClosableWindowMask | $.NSMiniaturizableWindowMask// | $.NSResizableWindowMask | |
let b = $.NSBackingStoreBuffered |
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 Window(x, y, w, h) { | |
const f = $.NSMakeRect(x, y, w, h) | |
const s = $.NSTitledWindowMask | $.NSClosableWindowMask | $.NSMiniaturizableWindowMask// | $.NSResizableWindowMask | |
const b = $.NSBackingStoreBuffered | |
const d = false | |
const win = $.NSWindow.alloc.initWithContentRectStyleMaskBackingDefer(f, s, b, d) | |
win.releasedWhenClosed = false | |
return win |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Vue Component</title> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.12/vue.js"></script> | |
</head> | |
<body> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>reactive</title> | |
</head> | |
<body> | |
<div id="contents"></div> |