Skip to content

Instantly share code, notes, and snippets.

View anzfactory's full-sized avatar
:octocat:
Working from home

anz anzfactory

:octocat:
Working from home
View GitHub Profile
@anzfactory
anzfactory / swiftgen_template.stencil
Created April 30, 2021 10:49
テストケースを自動生成させるためのテンプレート
//
// 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 January 22, 2021 14:07
DeepLを開くXcode Source Editor Extension
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 November 15, 2020 03:51
特定の画像表示でクラッシュする 🤔
/*
[✓] 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 September 27, 2020 12:16
Swift製の静的サイトジェネレーター「Publish」でビルドしつつ、Firebase HostingにデプロイするGitHub Actionsのワークフロー
name: Publish
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
@anzfactory
anzfactory / DeleteApp.swift
Last active April 1, 2020 05:16
XCUITestでアプリ削除するやつ
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 February 11, 2020 06:40
バウンスエリアの背景色を変えたい
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 December 3, 2019 13:14
bitrise.ymlをダウンロードしてきて差異があればPRをつくるやつ。Scriptステップでつかえる。
#!/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 October 21, 2019 22:58
リロードしたときにテキストが下にずれ込むっていう話
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 October 16, 2019 15:08
Alternate Icons - iPhone, iPad, iPad Pro(3rd)
<?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 September 2, 2019 13:26
WKWebViewでUserAgentをいじるあれこれ
// 1. UserDefaultsを使う方法
// didFinishLaunchingWithOptions 内でやること
let userDefaults = UserDefaults.standart
userDefaults.register(defaults; [
"UserAgent": "custom user agent..."
])
// 2. WKWebView.customUserAgentを使う方法
// ロード開始する前に指定しておくこと