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 printNum(i: Int) { | |
| print(i, separator: "", terminator: ", ") | |
| } | |
| func printFizz(i: Int) { | |
| print("Fizz", separator: "", terminator: ", ") | |
| } |
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
| for currentView in tableView.subviews { | |
| if currentView.isKindOfClass(UIScrollView) { | |
| (currentView as? UIScrollView)?.delaysContentTouches = false | |
| break | |
| } | |
| } |
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 titleLabel = UILabel(frame: CGRectMake(0, 0, 0, 0)) | |
| titleLabel.backgroundColor = UIColor.clearColor() | |
| titleLabel.textColor = UIColor.blackColor() | |
| titleLabel.font = titleLabel.font.fontWithSize(18) | |
| titleLabel.text = "Title" | |
| titleLabel.sizeToFit() | |
| let subTitleLabel = UILabel(frame: CGRectMake(0, 20, 0, 0)) | |
| subTitleLabel.backgroundColor = UIColor.clearColor() | |
| subTitleLabel.textColor = UIColor.blackColor() |
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
| <script type="text/javascript"> | |
| function init() { | |
| if (arguments.callee.done) return; | |
| arguments.callee.done = true; | |
| $('.main').show(); | |
| }; | |
| window.onload = init; | |
| </script> |
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
| //for metropolis | |
| float lastXmetr=intervalA+(intervalB-intervalA)/2.0; | |
| //float lastXmetr=[[MCData sharedStore] maxValueOfFunction]; | |
| float curXmetr=(intervalB-intervalA)/2.0; | |
| float alphaMetr=(intervalB-intervalA)/4.0; | |
| if (metropolisActive) { | |
| //metropolis | |
| float valRand3; |
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
| while true { | |
| var metropolisValue = 0.0 | |
| var lastXDistance = Double(self.intervalBeginTextField.text!)! + (Double(self.intervalEndTextField.text!)! - | |
| Double(self.intervalBeginTextField.text!)!) / 2.0 - 2.0 | |
| let alphaXDistance = (Double(self.intervalEndTextField.text!)! - | |
| Double(self.intervalBeginTextField.text!)!) / 4.0 | |
| let currentXDistance = lastXDistance + alphaXDistance * (-1.0 + 2 * Double.random(0.0, max: 1.0)) | |
| if currentXDistance < Double(self.intervalBeginTextField.text!)! || | |
| currentXDistance > Double(self.intervalEndTextField.text!)! { |
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 data = [ | |
| [2.0, 3.0, 8.0, 1.0, 5.0], // 19 | |
| [4.0, 2.0, 7.0, 5.0, 3.0], // 21 | |
| [8.0, 9.0, 4.0, 6.0, 7.0], // 34 | |
| [1.0, 2.0, 7.0, 8.0, 2.0], // 20 | |
| [1.0, 4.0, 7.0, 4.0, 8.0] // 24 | |
| ] | |
| // Количество итераций для статистики |
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
| override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, | |
| forRowAtIndexPath indexPath: NSIndexPath) { | |
| if editingStyle == .Delete { | |
| // doing something with data | |
| tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic) | |
| } | |
| UIView.transitionWithView(tableView, duration: 0.35, options: .TransitionFlipFromRight, animations: { () -> Void in | |
| self.tableView.reloadData() | |
| }, completion: 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
| extension String { | |
| subscript(index: Int) -> Character { | |
| get { | |
| return self[self.startIndex.advancedBy(index)] | |
| } | |
| } | |
| } | |
| // Вместо этого | |
| // let greeting = "Guten Tag!" |
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
| public extension Double { | |
| public static func random() -> Double { | |
| return Double(arc4random()) / 0xFFFFFFFF | |
| } | |
| public static func random(min: Double, max: Double) -> Double { | |
| return Double.random() * (max - min) + min | |
| } | |
| var degreesToRadians : Double { |