Skip to content

Instantly share code, notes, and snippets.

View kishikawakatsumi's full-sized avatar
🏠
Working from home

Kishikawa Katsumi kishikawakatsumi

🏠
Working from home
View GitHub Profile
lane :sync_bitrise_yml do
if !ENV['CI']
next
end
Dir.chdir("#{ENV['PWD']}") do
sh "curl -O -H 'Authorization: token #{ENV['BITRISE_ACCESS_TOKEN']}' 'https://api.bitrise.io/v0.1/apps/#{ENV['BITRISE_APP_SLUG']}/bitrise.yml'"
unless system('git diff --quiet --exit-code')
sh 'git add bitrise.yml'
#!/bin/bash
set -exo pipefail
PROJECT_ROOT=$(cd $(dirname $0); cd ..; pwd)
PODS_ROOT="$PROJECT_ROOT/Pods"
PODS_PROJECT="$PODS_ROOT/Pods.xcodeproj"
SYMROOT="$PODS_ROOT/Build"
(cd "$PROJECT_ROOT"; bundle install --path=vendor/bundle --binstubs=vendor/bin)
platform :ios, '10.3'
install! 'cocoapods', integrate_targets: false
inhibit_all_warnings!
use_modular_headers!
target 'Shared' do
use_frameworks!
#!/usr/bin/env bash
git reset --hard
git checkout $1
xcodebuild build -scheme Demo -sdk iphonesimulator -derivedDataPath build
xcrun simctl install 89955894-3580-47CE-86FD-5C3E41850418 ~/work/Demo/build/Build/Products/Debug-iphonesimulator/Demo.app
xcrun simctl install F28EC412-2D31-4F56-9705-670823B8B554 ~/work/Demo/build/Build/Products/Debug-iphonesimulator/Demo.app
#!/bin/sh
set -ex
bundle install --path=vendor/bundle --binstubs=vendor/bin
bundle exec pod install
carthage checkout
carthage build --no-use-binaries --platform ios --cache-builds BonMot
carthage build --no-use-binaries --platform ios --cache-builds bugsnag-cocoa
@kishikawakatsumi
kishikawakatsumi / UIScrollView+UIPageControl.swift
Created April 29, 2018 15:21
UIScrollView + UIPageControl with RxSwift
import RxSwift
import RxCocoa
fileprivate extension Reactive where Base: UIScrollView {
fileprivate var currentPage: Observable<Int> {
return didEndDecelerating.map({
let pageWidth = self.base.frame.width
let page = floor((self.base.contentOffset.x - pageWidth / 2) / pageWidth) + 1
return Int(page)
})
@kishikawakatsumi
kishikawakatsumi / OptionParser.swift
Created April 5, 2018 15:57
SwiftPM ArgumentParser usage
let parser = ArgumentParser(commandName: "swiftfmt", usage: "swiftfmt filename [options]", overview: "Format Swift source code")
let filenameArgument = parser.add(positional: "filename", kind: String.self)
let configrationOption = parser.add(option: "--configuration", kind: String.self)
let versionOption = parser.add(option: "--version", kind: Bool.self)
let verboseOption = parser.add(option: "--verbose", kind: Bool.self, usage: "Show more debugging information")
let result = try parser.parse(Array(CommandLine.arguments.dropFirst()))
if let version = result.get(versionOption) {
print("Swiftfmt 0.1.0")
@kishikawakatsumi
kishikawakatsumi / Info.plist
Created October 5, 2016 05:02
NSAllowsArbitraryLoads=YES on debug build
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>

Keybase proof

I hereby claim:

  • I am kishikawakatsumi on github.
  • I am kishikawakatsumi (https://keybase.io/kishikawakatsumi) on keybase.
  • I have a public key whose fingerprint is BE27 F270 E0AB 074F 5673 354D 5DB1 8678 5A47 C1FF

To claim this, I am signing this object:

@kishikawakatsumi
kishikawakatsumi / ReorderingRealmListInTableView.swift
Created July 27, 2016 04:59
Reorder Realm List in UITableView
import UIKit
import RealmSwift
class Data: Object {
dynamic var name = ""
...
}
class DataWrapper: Object {
let list = List<Data>()