Skip to content

Instantly share code, notes, and snippets.

View matsuda's full-sized avatar

Kosuke Matsuda matsuda

  • Tokyo, Japan
View GitHub Profile

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:

@matsuda
matsuda / gist:c247ec590b0b828bc7ab
Last active August 29, 2015 14:11
UIViewController's Workaround
@interface UIViewController (XXX)
/**
iOS8 && iPadの時にmodalPresentationStyleの種類によっては
horizontalSizeClassがUIUserInterfaceSizeClassCompactになるので
TraitCollectionを書き換える。
現在判明しているのは
* UIModalPresentationFormSheet
*/
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
@matsuda
matsuda / 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
# github_api.rb
require 'rubygems'
require 'uri'
require 'net/http'
require 'yaml'
Net::HTTP.version_1_2
class GitHubApi
def repository(user_name, repos_name)
# github_api_test.rb
require 'rubygems'
require 'test/unit'
require 'fakeweb'
require File.join(File.dirname(__FILE__), 'github_api.rb')
class Test::Unit::TestCase
end
class GitHubApiTest < Test::Unit::TestCase
#!/usr/bin/env ruby
# =======================================================
# 外部連携するRails開発において外部サーバのモックアプリとRailsアプリを同時起動するスクリプト
#
# ex.)
# RAILS_ROOT/lib/external_server/server.rb
#
# $ ruby script/external_server
# => Rails'command run 'script/server'
#!/usr/bin/env ruby
require 'optparse'
require "rubygems"
require "activerecord"
host = 'localhost'
password = ''
username = db = nil
help = ''
@matsuda
matsuda / schema_dumper_extension.rb
Created December 7, 2009 10:31
MyISAMテーブルの場合はMyISAMオプションを付けてダンプ
module SchemaEngine
module SchemaDumper #:nodoc:
def self.included(mod)
mod.module_eval do
alias_method_chain :table, :schema_engine
end
end
private
def table_with_schema_engine(table, stream)
#
# 検索用クラス
# ActiveFormプラグインに似ている
#
# これまでのActiveSearchをモジュール化し、ActiveFormを拡張するようにしました
# selectable_attrがインクルードされています
# ------------------------------------------------------
# 使い方
# SearchFormクラスを継承
# Ext::ActiveSearch::Baseモジュールをインクルード