Skip to content

Instantly share code, notes, and snippets.

@gitbricho
gitbricho / osx_ui_01.swift
Last active February 21, 2016 13:38
OS X Graphic
import Cocoa
//青色のオブジェクトを作成
let blue = NSColor.blueColor()
blue.setFill()
//100x100 の4角形を作成
let r = NSRect(x:0, y:0, width:100, height:100)
@gitbricho
gitbricho / IosImageView01.swift
Created February 4, 2016 14:45
IosImageView
import UIKit
class ViewController: UIViewController, UIImagePickerControllerDelegate , UINavigationControllerDelegate {
// Mark:プロパティ
@IBOutlet weak var photoImageVIew: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
@gitbricho
gitbricho / tableview01.swift
Last active January 29, 2016 08:07
xcodeの使い方
import UIKit
class MyTableViewController: UITableViewController {
// MARK:プロパティ
let items:[String] = ["項目1","項目2","項目3"]
override func viewDidLoad() {
super.viewDidLoad()
// プレゼンテーション中に選択を維持するにはコメントを取る
@gitbricho
gitbricho / ViewController01.swift
Last active January 21, 2016 07:59
xc-ui_control_01
class ViewController: NSViewController {
// MARK:プロパティ
@IBOutlet weak var vテキスト: NSTextField!
@IBOutlet weak var vラベル: NSTextField!
@IBOutlet weak var vボタン: NSButton!
...
}
@gitbricho
gitbricho / 0_reuse_code.js
Created January 9, 2016 15:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@gitbricho
gitbricho / regEx01_01.swift
Last active January 14, 2016 16:20
swift:RegularExpression
import UIKit
//## 予約文字
// [] () \ * + ? {} ^ $ . | /
//# 予約文字そのものを探すにはエスケープする
// \\[ \\] \\( \\) \\* \\+ \\? \\{ \\} \\^ \\$ \\. \\| \\/
let l検査文字列 = "[] () * + ? {} ^ $ . | /"
let lRgxArry = [
"\\[", "\\]", "\\(", "\\)", "\\*", "\\+", "\\?",
@gitbricho
gitbricho / MyJson.txt
Last active September 27, 2016 21:34
swift:r100
[
{
"fPath": "/_contents/video/Music/jazz/artist1-title1.mp4",
"group": "artist1",
"title": "title1",
"fType": "video",
"cType": "Music",
"zWhen": "",
"zWhere": "",
"tags": [ "jazz",
@gitbricho
gitbricho / string_01.swift
Last active August 19, 2016 07:02
swift 2.1 基本:文字列と文字
//## 文字列 #####
//## 長さ
"abcde".characters.count //5
"アイウエオ".characters.count //5
@gitbricho
gitbricho / file01_01.swift
Last active May 7, 2016 10:44
swift 2.1 ファイル
import UIKit
//## iOS:ファイルシステム #####
//標準ディレクトリ ( Documents/, Library/, tmp/ ... )
//## OS X:ファイルシステム #####
//ローカルドメイン ( Applications/Utilities, Developer/, Library/ )
//ユーザードメイン ( Users/user1, ... )
//ファイルまたはディレクトリのパス
@gitbricho
gitbricho / func01_01.swift
Last active June 17, 2016 12:48
swift:func
import Foundation
//## シンタックス: (パラメータリスト) -> (戻り値)
//## 定義と呼び出し
// 1. (String) -> (String)
func f挨拶(名前: String) -> String {
let l挨拶 = 名前 + "さん、今日は"
return l挨拶
}
// 呼び出し