This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <!-- https://www.ajaxtower.jp/ini/http/index3.html --> | |
| <!-- 同期通信によるファイルの取得 --> | |
| <html lang="ja"> | |
| <head> | |
| <meta http-equiv="Content-Type" Content="text/html;charset=UTF-8"> | |
| <meta http-equiv="Content-Script-Type" content="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| renameDirectories () { | |
| for i in `find . -name \*$oldProject\* -type dir` | |
| do | |
| oldFile=$i | |
| newFile=`echo $i | sed -e s/$oldProject/$newProject/g` | |
| echo "mv $oldFile $newFile" | |
| mv $oldFile $newFile | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| if [ $# -ne 1 ]; then | |
| echo "making 120, 180px icons at current directory from specified file." | |
| echo "usage: makeicon file, one args required"; | |
| exit; | |
| fi | |
| BASEFILE=$1 | |
| echo $1 | |
| echo $BASEFILE | |
| sips -Z 120 $BASEFILE --out [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let vc = ParamViewController(nibName : "ParamViewController", bundle : nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // case 1 | |
| //AppDelegate#application:didFinishLaunchingWithOptions | |
| NSSetUncaughtExceptionHandler {e in | |
| print(">>>>> ExceptionHandler OK") | |
| let log = NSString(format:"%@, %@", e.name, e.reason!) | |
| NSUserDefaults.standardUserDefaults().setValue(log, forKey: "failLog") | |
| } | |
| // case 2 | |
| // Closureを渡さなくても、swift関数の関数名を渡しても良い。ただし、NSSetUncaughtExceptionHandlerと同じスコープ内に | |
| // swift関数が無いとコンパイルエラー⁉️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| func iterateEnum<T: Hashable>(_: T.Type) -> AnyGenerator<T> { | |
| var cast: (Int -> T)! // reference to clousure | |
| //print(($0).dynamicType) | |
| // what is $0 ?, Int, 0, 1, 2, 3, 4 for nil | |
| switch sizeof(T) { | |
| case 0: return anyGenerator(GeneratorOfOne(unsafeBitCast((), T.self))) | |
| case 1: cast = { unsafeBitCast(UInt8(truncatingBitPattern: $0), T.self) } | |
| // print($0.dynamicType);print($0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| enum Vehicle { | |
| case Car(windows: Int, wheels: Int) | |
| case Ship(windows: Int, funnels: Int, anchors: Int) | |
| case Plane(windows: Int, wheels: Int, wings: Int, engines: Int) | |
| } | |
| var aPlane: Vehicle = .Plane(windows: 1, wheels: 9, wings: 8, engines: 4) | |
| var voidPtr: UnsafePointer<Vehicle> = unsafeBitCast(&aPlane, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class KeyClass { | |
| var value:String | |
| init(_ value:String) { | |
| self.value = value | |
| } | |
| } | |
| extension KeyClass : Hashable { | |
| var hashValue: Int { | |
| return self.value.hashValue | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| // class clusterの例:2種のクラスのインスタンスを生成できるfactory | |
| class MyColor { | |
| // var r: Int = 0, g: Int = 0, b: Int = 0 | |
| class func createWithColor(n: Int) -> MyColor { | |
| var res: MyColor? | |
| switch n { | |
| case 0: | |
| res = RedMyColor() | |
| case 1: |