Skip to content

Instantly share code, notes, and snippets.

@gitbricho
gitbricho / string_01.swift
Last active August 19, 2016 07:02
swift 2.1 基本:文字列と文字
//## 文字列 #####
//## 長さ
"abcde".characters.count //5
"アイウエオ".characters.count //5
@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 / regEx01_01.swift
Last active January 14, 2016 16:20
swift:RegularExpression
import UIKit
//## 予約文字
// [] () \ * + ? {} ^ $ . | /
//# 予約文字そのものを探すにはエスケープする
// \\[ \\] \\( \\) \\* \\+ \\? \\{ \\} \\^ \\$ \\. \\| \\/
let l検査文字列 = "[] () * + ? {} ^ $ . | /"
let lRgxArry = [
"\\[", "\\]", "\\(", "\\)", "\\*", "\\+", "\\?",
@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 / 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 / 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 / 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 / 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 / PdfDef.swift
Last active March 6, 2016 05:49
osx pdf create
import Cocoa
//MARK: 定数定義
let L行高 = CGFloat(10.2)
let L行数 = 80
let Lマージン上 = CGFloat(10.0) //mm 単位
let Lマージン左 = CGFloat(10.0)
let Lマージン右 = CGFloat(10.0)
let Lマージン下 = CGFloat(10.0)
// 70DPI -> 70dot/25.4mm = 2.756
@gitbricho
gitbricho / AppDef.swift
Created March 9, 2016 11:26
テンプレート:スプリットビューコントローラ
import Foundation
let LWinX = CGFloat(20)
let LWinY = CGFloat(20)
let LWinW = CGFloat(800)
let LWinH = CGFloat(600)
let LWinSize = CGSize(width: LWinW, height: LWinH)
let LWinTitle = "App Title"