Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Working from home

anz anzfactory

:octocat:
Working from home
View GitHub Profile
@anzfactory
anzfactory / swiftgen_template.stencil
Created Apr 30, 2021
テストケースを自動生成させるためのテンプレート
View swiftgen_template.stencil
//
// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen
//
{% macro allValuesBlock assets prefix %}
{% for asset in assets %}
{% if asset.items %}
{% set newPrefix %}{{prefix}}{{asset.name|swiftIdentifier:"pretty"|escapeReservedKeywords}}.{% endset %}
{% call allValuesBlock asset.items newPrefix %}
{% elif asset.type != "group" %}
_ = Asset.{{prefix}}{{asset.name|swiftIdentifier:"pretty"|lowerFirstWord}}.{{asset.type}}
@anzfactory
anzfactory / SourceEditorCommand.swift
Last active Jan 22, 2021
DeepLを開くXcode Source Editor Extension
View SourceEditorCommand.swift
import AppKit
import Foundation
import XcodeKit
final class SourceEditorCommand: NSObject, XCSourceEditorCommand {
func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void ) -> Void {
defer {
completionHandler(nil)
@anzfactory
anzfactory / main.dart
Created Nov 15, 2020
特定の画像表示でクラッシュする 🤔
View main.dart
/*
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.7 19H2, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.51.1)
[✓] Connected device (1 available)
*/
@anzfactory
anzfactory / publish.yml
Last active Sep 27, 2020
Swift製の静的サイトジェネレーター「Publish」でビルドしつつ、Firebase HostingにデプロイするGitHub Actionsのワークフロー
View publish.yml
name: Publish
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
@anzfactory
anzfactory / DeleteApp.swift
Last active Apr 1, 2020
XCUITestでアプリ削除するやつ
View DeleteApp.swift
func deleteApp() {
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
springboard.activate()
let appName = "MyApp"
// ホームから該当アプリ探す
let appIcon = springboard.icons[appName]
guard appIcon.exists else {
return
@anzfactory
anzfactory / custom_bance_area_example.dart
Last active Feb 11, 2020
バウンスエリアの背景色を変えたい
View custom_bance_area_example.dart
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class ListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('バウンスエリア色変えたいんじゃ'), elevation: 0.0,),
body: _Page(),
@anzfactory
anzfactory / sync_bitrise.yml.sh
Created Dec 3, 2019
bitrise.ymlをダウンロードしてきて差異があればPRをつくるやつ。Scriptステップでつかえる。
View sync_bitrise.yml.sh
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# download bitrise.yml
curl -O -H "Authorization: token ${BITRISE_API_ACCESS_TOKEN}" "https://api.bitrise.io/v0.1/apps/${BITRISE_APP_SLUG}/bitrise.yml"
# check diff
@anzfactory
anzfactory / MyViewController.swift
Created Oct 21, 2019
リロードしたときにテキストが下にずれ込むっていう話
View MyViewController.swift
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
private let container: UIView = {
let view = UIView(frame: .zero)
view.backgroundColor = .white
return view
@anzfactory
anzfactory / Info.plist
Last active Oct 16, 2019
Alternate Icons - iPhone, iPad, iPad Pro(3rd)
View Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>icon</key>
<dict>
@anzfactory
anzfactory / custom_useragent.swift
Created Sep 2, 2019
WKWebViewでUserAgentをいじるあれこれ
View custom_useragent.swift
// 1. UserDefaultsを使う方法
// didFinishLaunchingWithOptions 内でやること
let userDefaults = UserDefaults.standart
userDefaults.register(defaults; [
"UserAgent": "custom user agent..."
])
// 2. WKWebView.customUserAgentを使う方法
// ロード開始する前に指定しておくこと