Skip to content

Instantly share code, notes, and snippets.

🇬🇧
Work in the UK

Satoshi Namai ainame

🇬🇧
Work in the UK
Block or report user

Report or block ainame

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.swift
import Darwin
let string = "hello world"
var array = [UInt8]()
string.withCString { ptr in
print("strlen: \(strlen(ptr))")
let length = strlen(ptr)
var currentPtr = ptr
@ainame
ainame / string-api-changes.swift
Last active Jun 6, 2017
Is this a bug on the Swift4?
View string-api-changes.swift
import Foundation
let array: [String?] = ["a", "b", "c", "e"]
print(array) // => [Optional("a"), Optional("b"), Optional("c"), Optional("e")]
let strings = array.flatMap { $0! }
print(type(of: strings)) // => Array<Character>
@ainame
ainame / update-xcode-plugin
Created Dec 10, 2015 — forked from kakikubo/update-xcode-plugin
Xcodeをバージョンアップした際に、プラグインも新バージョン側に適用させる
View update-xcode-plugin
#!/usr/bin/env sh
UUID=$(defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID)
echo Xcode DVTPlugInCompatibilityUUID is $UUID
for MyPlugin in ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/*
do
UUIDs=$(defaults read "$MyPlugin"/Contents/Info DVTPlugInCompatibilityUUIDs)
echo $MyPlugin
if echo "${UUIDs[@]}" | grep -w "$UUID" &>/dev/null; then
echo "The plug-in's UUIDs has contained the Xcode's UUID."
else
@ainame
ainame / matome.md
Last active Oct 4, 2017
井戸端iOS飯で過去に見た動画まとめ
View matome.md

井戸端iOS飯

とは?

井戸端iOS飯とは、昼休み1時間+MTG分の30分の計1時間30分を利用して、 NBFオフィスのコラボのプロジェクターとスクリーンを利用して、 最新のスマホアプリ開発技術に関する動画を見ながらご飯を食べて、 交流する場です。

ぜひお気軽にご参加ください。

@ainame
ainame / identity.rb
Last active Sep 17, 2015
.idがidenitityを提供するということを示すmixinモジュールの名前どれが良いか
View identity.rb
# 1
class Coriander
include MyApp::Entity::HasId
end
# 2
class Coriander
include MyApp::Entity::Identifiable
end
@ainame
ainame / chain_query.rb
Created Aug 27, 2015
ChainQuery allow you to build query by method chains.
View chain_query.rb
class ChainQuery
def initialize(init_value)
@init_value = init_value
@filters = []
end
def add_filter(&block)
@filters << block
self
end
View gist:26664acc3ad08372b02d

住所

〒 153-0064 東京都目黒区下目黒5-11-24 シェアハウス(中村・矢口・荻原宅)

行き方

best practice

@ainame
ainame / file0.txt
Last active Jun 20, 2016
ActiveRecord::Enumで陥りがちなミスを避ける ref: http://qiita.com/ainame/items/a097558e74bf7d5087b9
View file0.txt
class NotifyEndpoint
enum platform: [:apns, :gcm]
end
@ainame
ainame / aws.rb
Last active Aug 29, 2015
AWS SDKのラッパーを作るとき用の便利concern ref: http://qiita.com/ainame/items/ae6fa3ed3df87d51e523
View aws.rb
module MyApp
module AWS
class SNS
def self.stub_configuration
AWS::Core::Configuration.new(
access_key_id: 'ACCESS_KEY_ID',
secret_access_key: 'SECRET_ACCESS_KEY',
stub_requests: true,
)
View bug.rb
user = {
id: 1,
name: 'ainame',
}
if flag
user[:gender] = 'male', # ← 末尾にカンマが入ってしまっていたけどシンタックスエラーにはならない
user[:age] = 100
end
You can’t perform that action at this time.