Skip to content

Instantly share code, notes, and snippets.

View MTattin's full-sized avatar
:octocat:

Masakiyo Tachikawa MTattin

:octocat:
View GitHub Profile
@MTattin
MTattin / file0.txt
Last active June 24, 2019 08:42
Firebase のプッシュ通知をcurlで実行 ref: https://qiita.com/MTattin/items/e6ebb18ec620ed89425e
curl \
--header "Authorization: key=ご自身のAPI_KEY" \
--header Content-Type:"application/json" \
https://fcm.googleapis.com/fcm/send \
-d "{
\"to\" : \"/topics/何か適当に\",
\"time_to_live\" : 0,
\"restricted_package_name\" : \"bundle id\",
\"notification\" : {
\"sound\" : \"default\",
let _0_delay = 3.0 * Double(NSEC_PER_SEC)
let _0_time = DispatchTime.now() + Double(Int64(_0_delay)) / Double(NSEC_PER_SEC)
DispatchQueue.main.acyncAfter(deadline: _0_time, execute: {
})
DispatchQueue.main.acyncAfter(deadline: DispatchTime.now() + Double(Int64(3.0 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: {
})
@MTattin
MTattin / file0.txt
Created July 2, 2016 02:02
CFBundleVersionをReleaseビルドの時だけ更新 ref: http://qiita.com/MTattin/items/159e09e859f797429f9f
if [[ ${CONFIGURATION} == "Release" ]]; then
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PRODUCT_SETTINGS_PATH}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PRODUCT_SETTINGS_PATH}"
echo "[UpdateBuildNumber Release] CFBundleVersion Increment ${buildNumber}"
else
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PRODUCT_SETTINGS_PATH}")
echo "[UpdateBuildNumber Debug] CFBundleVersion Not Increment ${buildNumber}"
fi
@MTattin
MTattin / file0.swift
Created August 1, 2016 12:07
UIPopoverPresentationControllerの画面回転対応メモ ref: http://qiita.com/MTattin/items/39f578610b295e9535b3
///
/// UIPopoverPresentationControllerDelegate
///
/// 画面の回転対応
///
func popoverPresentationController(_ popoverPresentationController: UIPopoverPresentationController, willRepositionPopoverTo rect: UnsafeMutablePointer<CGRect>, in view: AutoreleasingUnsafeMutablePointer<UIView>) {
let baseView = 起点としたいView
view.pointee = baseView
rect.pointee = baseView.bounds
@MTattin
MTattin / file0.swift
Created October 8, 2016 01:40
swift3の文字列操作(String.substring)メモ ref: http://qiita.com/MTattin/items/bf32562cd7d03c49026f
let Str: String = "123456789"
///
/// 先頭1文字 - 1
///
print("\(Str.substring(to: Str.index(after: Str.startIndex)))")
///
/// 先頭1文字以外 - 23456789
///
print("\(Str.substring(from: Str.index(after: Str.startIndex)))")
@MTattin
MTattin / file0.swift
Created October 10, 2016 01:51
swift3でのUIView.animateの挙動の違いについてのメモ ref: http://qiita.com/MTattin/items/3d541901db4b36e646d1
///
/// アニメーション表示
///
self.constraintBottom.constant = 0
UIView.animate(withDuration: 0.1, animations: { [weak self] in
self?.layoutIfNeeded()
}, completion: nil)
///
/// アニメーション非表示
@MTattin
MTattin / file0.swift
Created October 17, 2016 11:13
UIVideoEditorControllerの「保存」のテキスト変更 ref: http://qiita.com/MTattin/items/a4563ce8e55dc0919c54
///
/// CstmVideoEditorController
///
class CstmVideoEditorController: UIVideoEditorController {
///
/// will appear
///
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
for v in self.navigationBar.subviews {
@MTattin
MTattin / file0.swift
Created November 9, 2016 20:27
Swift3 動画をカメラロールに保存 ref: http://qiita.com/MTattin/items/ebb321adabe5282f0ebf
import UIKit
import AVFoundation
import Photos
///
/// アルバム保存コントローラーサンプル
///
class SaveAlbumSample: NSObject {
@MTattin
MTattin / file0.swift
Last active November 22, 2016 22:10
テーブルビューコントローラーのデリゲートメモ ref: http://qiita.com/MTattin/items/08f648b051ebec45604e
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
/// 0.0だと33pxの余白が発生したので0.1を定義
@MTattin
MTattin / file0.swift
Created February 26, 2017 10:09
Cocoaでswift3.0の画像リサイズ ref: http://qiita.com/MTattin/items/39bd9fd729adef67b205
#!/usr/bin/swift
import Cocoa
class fileMG {
var dir: String
var file: String