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
| var background: SKSpriteNode | |
| if (won) { | |
| background = SKSpriteNode(imageNamed: "YouWin") | |
| } else { | |
| background = SKSpriteNode(imageNamed: "YouLose") | |
| } | |
| // do sth to background | |
| // in swift 1.2, this can be applied for `let`! |
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
| func sFunc_imageFixOrientation(img:UIImage) -> UIImage { | |
| // No-op if the orientation is already correct | |
| if (img.imageOrientation==UIImageOrientation.Up) { | |
| return img; | |
| } | |
| // We need to calculate the proper transformation to make the image upright. | |
| // We do it in 2 steps: Rotate if Left/Right/Down, and then flip if Mirrored. | |
| var transform:CGAffineTransform = CGAffineTransformIdentity | |
| if (img.imageOrientation==UIImageOrientation.Down | |
| || img.imageOrientation==UIImageOrientation.DownMirrored) { |
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 | |
| let string = "/var/controller_driver/secret_photo.png" | |
| let components = string.pathComponents | |
| //引入了Foundation之后String和NSString会自动转换! |
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
| if(deltaPosition == CGPointMake(0, 0)){return} | |
| var radian:CGFloat | |
| if(deltaPosition.y == 0){ | |
| if(deltaPosition.x > 0){radian = 0} | |
| else{radian = -CGFloat(M_PI)} | |
| }else if(deltaPosition.y > 0){ | |
| if(deltaPosition.x > 0){radian = atan(deltaPosition.y / deltaPosition.x)} | |
| else if(deltaPosition.x == 0){radian = CGFloat(M_PI_2)} | |
| else{radian = -atan(deltaPosition.y / deltaPosition.x) - CGFloat(M_PI)} |
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 ViewController: UIViewController,UITextFieldDelegate { | |
| var pressed = false | |
| @IBOutlet weak var sampleView: UIView! | |
| var initTransform:CATransform3D{ | |
| return CATransform3DScale(CATransform3DMakeTranslation(0, self.sampleView.layer.bounds.height / 2 , 0), 1, 0, 1); | |
| } | |
| var normalTransform:CATransform3D{ | |
| return CATransform3DMakeTranslation(0, self.sampleView.layer.bounds.height/2, 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
| Process: Xcode [2124] | |
| Path: /Applications/Xcode.app/Contents/MacOS/Xcode | |
| Identifier: com.apple.dt.Xcode | |
| Version: 6.4 (7720) | |
| Build Info: IDEFrameworks-7720000000000000~8 | |
| App Item ID: 497799835 | |
| App External ID: 813293765 | |
| Code Type: X86-64 (Native) | |
| Parent Process: ??? [1] | |
| Responsible: Xcode [2124] |
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 DDTableViewController: UITableViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.tableView.estimatedRowHeight = 60 | |
| self.tableView.rowHeight = UITableViewAutomaticDimension | |
| self.tableView.registerNib(UINib(nibName: "DDTableViewCell", bundle: nil), forCellReuseIdentifier: "DDTableViewCell") | |
| } | |
| } |
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
| 1.运行/停止镜像 | |
| 从images里读docker-whale镜像,然后运行bin/bash.[CMD] | |
| $ docker run -i -t docker-whale /bin/bash | |
| 2.重启镜像 | |
| $ docker start kickass_sammet | |
| 3.附着到镜像. | |
| $ docker attach kickass_sammet | |
| (kickass_sammet是系统随机给的container名字,之后可以换掉,然后可以用id来代替名字唤起docker命令.) |
OlderNewer