Skip to content

Instantly share code, notes, and snippets.

@macneko-ayu
macneko-ayu / project.yml
Created December 15, 2021 01:38
Sample of generating a SwiftUI project file with XcodeGen
# 任意のProduct Nameに置き換える(Targetも同様)
name: FooProduct
options:
bundleIdPrefix: com.example
deploymentTarget:
iOS: 15.0
xcodeVersion: "13.1"
settings:
@macneko-ayu
macneko-ayu / not_working.js
Last active August 21, 2021 09:23
ダイアログを閉じたあとにInDesingを操作する処理を実行するとレインボーサークルになる
//@targetEngine "fooo"
(function () {
main();
})();
function main() {
var controls = {};
var dialog = new Window("dialog");
@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 / ViewController.swift
Last active June 3, 2021 01:20
「iOSでチラシっぽい価格レイアウトを再現してみた」のコード
//
// ViewController.swift
// Price
//
// Created by macneko on 2018/09/07.
// Copyright © 2018年 macneko. All rights reserved.
//
import UIKit
@macneko-ayu
macneko-ayu / illustrator-cmyk-plate-changer.jsx
Created July 29, 2018 08:21
Illustratorで選択しているオブジェクトのCMYK値を入れ替えるExtendScript
var palette = new Window('palette', 'colorChanger');
var lists = [], buttons = [];
(function () {
var titles = ['塗り:', '線 :'];
var selectListItems = ['変更しない', 'シアン←→マゼンタ', 'シアン←→イエロー', 'マゼンタ←→イエロー'];
var buttonTitles = ['キャンセル', 'OK'];
palette.add('staticText', undefined, 'CMYK版を入れ替えるJavaScript');
var listContainer = palette.add('group', undefined);
listContainer.alignChildren = ['fill', 'center'];
@macneko-ayu
macneko-ayu / Playground.swift
Created January 25, 2021 14:22
OperationQueue sample
import UIKit
final class SampleOperation: Operation {
let message: String
init(message: String) {
self.message = message
}
override func main() {
@macneko-ayu
macneko-ayu / aiver.swift
Last active November 22, 2020 07:08
Extract the creation application version and saved version of an Illustrator file (ai, eps) ref: https://gist.github.com/monokano/8bffac0c07401627c5a1ebf020b93b0e
import Cocoa
/// ファイルを指定されたバイト数分ずつ読み込む
final class StreamReader: NSObject, StreamDelegate {
let maxLength: Int
let inputStream: InputStream?
var readedAction: (Versions) -> Void = { _ in }
var createVersion = ""
var saveVersion = ""
@macneko-ayu
macneko-ayu / StreamReader.swift
Last active November 22, 2020 06:55
A sample file loading process using swift.
import Cocoa
final class Reader {
let fileUrl: URL
var data: Data?
init(filePath: String) {
fileUrl = URL(fileURLWithPath: filePath)
}
@macneko-ayu
macneko-ayu / create-font-sample.jsx
Last active June 10, 2020 23:58
Extendscript for creating font samples in Indesign
// sample movie: https://user-images.githubusercontent.com/5406126/49324964-f631aa80-f57c-11e8-9199-0ab51231422c.gif
main();
function main() {
// 関数定義
function applyFontToStory(targetFont) {
@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)