Skip to content

Instantly share code, notes, and snippets.

View mono0926's full-sized avatar
🐶
( ´・‿・`)

mono — Masayuki Ono mono0926

🐶
( ´・‿・`)
View GitHub Profile

storyboard上で、initial view controllerから他のview controllerに対してrelationshipを確立します。同様に、それらのview controllerから他のview controllerにrelationshipを確立します。最終的に、storyboard上のほとんど、あるいは全てのview controllerを一つのグラフに接続します。接続されたview controllerが、iOSによっていつインスタンス化されるかは、relationshipのタイプによって決まります。

/// <reference path="../../typings/tsd.d.ts" />
function HelloWorldController($scope) {
$scope.message = 'Hello World!!';
}
function SampleController($scope) {
$scope.simple = '簡易記法を使った方法';
$scope.directive = 'ディレクティブを使った方法';
}
function SampleController2($scope) {
$scope.text = 'TextBox';
.red
color red
.blue
color blue
.solid-border
border 1px solid black
.dotted-border
border 1px dotted black
li
margin-top 10px
:lipstick::lipstick: when improving the format/structure of the code
:racehorse::racehorse: when improving performance
:non-potable_water::non-potable_water: when plugging memory leaks
:memo::memo: when writing docs
:penguin::penguin: when fixing something on Linux
:apple::apple: when fixing something on Mac OS
:checkered_flag::checkered_flag: when fixing something on Windows
:bug::bug: when fixing a bug
:fire::fire: when removing code or files
:green_heart::green_heart: when fixing the CI build
@mono0926
mono0926 / gist:5af3fcdc872eb506002f
Last active August 29, 2015 14:15
Register and remove notification
// extension
extension UIViewController {
func observeDidBecomeActive(action: Selector) -> () -> () {
return observeNotification(action, name: UIApplicationDidBecomeActiveNotification)
}
private func observeNotification(action: Selector, name: String) -> () -> () {
NSNotificationCenter.defaultCenter().addObserver(self, selector: action, name: name, object: nil)
return {
return NSNotificationCenter.defaultCenter().removeObserver(self, name: name, object: nil)
}
@mono0926
mono0926 / file0.swift
Last active August 29, 2015 14:15
Notificationの登録を簡単にするextension ref: http://qiita.com/mono0926/items/e3a76dc95046f0eeeb29
extension UIViewController {
// こんな感じの公開メソッドを増やしていく
func observeKeyboard(willShowSelector: Selector, willHideSelector: Selector) -> () -> () {
return observeNotification([
(action: willShowSelector, name: UIKeyboardWillShowNotification),
(action: willHideSelector, name: UIKeyboardWillHideNotification)])
}
func observeDidBecomeActive(action: Selector) -> () -> () {
return observeNotification(action, name: UIApplicationDidBecomeActiveNotification)
}
goto loc_100000f00;
loc_100000f00:
COND = OVERFLOW(rax);
if (COND) goto loc_100000f1f;
loc_100000f09:
rbx = rbx + 0x1;
if (rbx != 0x65) goto loc_100000f00;
let params: [String: AnyObject!] = [
"avatarData": avatarData,
"displayName": member.displayName,
"currentCharacterId": member.currentCharacterId,
"profileView.birthday": member.birthday,
"sex": member.sex.rawValue,
"profileView.bloodType": member.bloodType.rawValue,
"address.country": member.address.country.rawValue, // "address: account.address!.dictはbindされないので。通常のrequestならOK"
"profileView.address.prefectures": member.address.prefectures.rawValue,
"profileView.hometown.country": member.hometown.country.rawValue,
typedef NS_ENUM (<#enumeration type#>, <#enumeration name#>) {
<#enumerator1#> = <#value1#>,
};
@mono0926
mono0926 / .gitignore
Last active December 19, 2015 10:39 — forked from adamgit/.gitignore
gitignore for ios_cocoapods
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,