Skip to content

Instantly share code, notes, and snippets.

View mtsd's full-sized avatar

Kosuke Matsuda mtsd

  • Tokyo, Japan
View GitHub Profile
@mtsd
mtsd / xc_build_alert.sh
Last active May 15, 2018 16:21
Warning script in swift project
# http://bendodson.com/weblog/2014/10/02/showing-todo-as-warning-in-swift-xcode-project/
TAGS="TODO:|FIXME:|WARNING:"
echo "searching ${SRCROOT} for ${TAGS}"
# find "${SRCROOT}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
find "${SRCROOT}/${PROJECT_NAME}" \( -name "*.swift" ! -type d \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
@mtsd
mtsd / gist:6b661167e4152bfa350f
Last active June 9, 2016 01:24
Xcode環境変数、xcodebuild
# http://qiita.com/matsukaz/items/42d1372c9e4e31e611f5
# http://nanoka.wpcloud.net/?p=943
# http://hachinobu.hateblo.jp/entry/2014/02/19/140659
$ xcodebuild -showBuildSettings
@mtsd
mtsd / BadgeLabel.swift
Created November 9, 2015 03:18
A badge label for iOS
import UIKit
/**
* [Badge.swift](https://gist.github.com/yonat/75a0f432d791165b1fd6) をベース
*/
class BadgeLabel: UILabel {
var badgeColor: UIColor = UIColor.redColor()
convenience init(badge: String?, color: UIColor = UIColor.redColor()) {
self.init()
@mtsd
mtsd / gist:627b3c95494017827a39
Last active August 29, 2015 14:16
iOSアプリのバイナリのアーキテクチャーを調べる
$ xcrun lipo
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: one of -create, -thin <arch_type>, -extract <arch_type>, -remove <arch_type>, -replace <arch_type> <file_name>, -verify_arch <arch_type> ... , -info or -detailed_info must be specified
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo [input_file] ... [-arch <arch_type> input_file] ... [-info] [-detailed_info] [-output output_file] [-create] [-arch_blank <arch_type>] [-thin <arch_type>] [-remove <arch_type>] ... [-extract <arch_type>] ... [-extract_family <arch_type>] ... [-verify_arch <arch_type> ...] [-replace <arch_type> <file_name>] ...
/**
Simulator
*/
// Xcodeの環境設定>Locations>Derived DataからDerived Dataを元に該当するアプリのディレクトリに移動
$ cd /Users/xxxxx/Library/Developer/Xcode/DerivedData/<App name>-<xxxxxxxxxxxx>/Build/Products/<Configuration>-iphones
Pod::Spec.new do |s|
s.name = "XSWI"
s.version = "1.0.5"
s.summary = "XML stream writer for iOS"
s.description = <<-DESC
The XSWI project hosts a simple, standalone XML stream writer for iOS implemented in Objective-C.
The project is inspired by the kXML and StAX serializers from the Java world.
DESC
@mtsd
mtsd / gist:c247ec590b0b828bc7ab
Last active August 29, 2015 14:11
UIViewController's Workaround
@interface UIViewController (XXX)
/**
iOS8 && iPadの時にmodalPresentationStyleの種類によっては
horizontalSizeClassがUIUserInterfaceSizeClassCompactになるので
TraitCollectionを書き換える。
現在判明しているのは
* UIModalPresentationFormSheet
*/

Keybase proof

I hereby claim:

  • I am matsuda on github.
  • I am matsuda (https://keybase.io/matsuda) on keybase.
  • I have a public key whose fingerprint is 40A5 FC4E 4C6B 842C C4A9 B057 E06B 2B70 F9EF E01E

To claim this, I am signing this object:

@mtsd
mtsd / NSData+AES.h
Created February 25, 2014 07:14
Objective-C code for encrypt and decrypt by AES-128 encryption.
/**
http://mythosil.hatenablog.com/entry/20111017/1318873155
http://blog.dealforest.net/2012/03/ios-android-per-aes-crypt-connection/
*/
@interface NSData (AES)
- (NSData *)AES128EncryptedDataWithKey:(NSString *)key;
- (NSData *)AES128DecryptedDataWithKey:(NSString *)key;
- (NSData *)AES128EncryptedDataWithKey:(NSString *)key iv:(NSString *)iv;
@mtsd
mtsd / 1_install_homebrew.log
Last active December 29, 2015 05:39
log of setup Homebrew and install development tools in Marvericks
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press ENTER to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir /usr/local
WARNING: Improper use of the sudo command could lead to data loss
@mtsd
mtsd / gist:7298311
Last active December 27, 2015 08:39
Mac tips
# Safariでdeleteキ−で「戻る」
# http://www.aivy.co.jp/BLOG_TEST/nagasawa/c/2012/07/safari-6delete.html
#
$ defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool YES
# クイックルックでテキストを選択できるようにする
$ defaults write com.apple.finder QLEnableTextSelection -bool TRUE; killall Finder