##Adding Swift Build System
- Open Sublime Text 3
- Go To
Preferences > Browse Packages... - Add a file named
Swift.sublime-buildinsidePackagesdirectory. - Copy the following script in
Swift.sublime-buildfile.
{
"shell_cmd": "xcrun swift $file",
| extension String { | |
| func size(withAttributes attrs: [String:AnyObject], constrainedTo box: NSSize) -> NSRect { | |
| let storage = NSTextStorage(string: self) | |
| let container = NSTextContainer(containerSize: NSSize(width: box.width, height: box.height)) | |
| let layout = NSLayoutManager() | |
| layout.addTextContainer(container) | |
| storage.addLayoutManager(layout) | |
| storage.addAttributes(attrs, range: NSMakeRange(0, storage.length)) | |
| container.lineFragmentPadding = 0.0 | |
| let _ = layout.glyphRangeForTextContainer(container) |
##Adding Swift Build System
Preferences > Browse Packages...Swift.sublime-build inside Packages directory.Swift.sublime-build file.{
"shell_cmd": "xcrun swift $file",
| import Cocoa | |
| struct Person { | |
| var name: String = "John" | |
| var age: Int = 50 | |
| var dutch: Bool = false | |
| var address: Address? = Address(street: "Market St.") | |
| } | |
| struct Address { |
return keyword. Don't add semicolons except where syntactically demanded in statements or to separate statements on the same line.var when let is appropriate, especially for properties. The compiler better optimizes let statements for items whose values will not change during their lifetime. For example, Apple writes, "It is good practice to create immutable collections in all cases where the collection does not need to change. Doing so enables the Swift compiler to optimize the performance of the collections you create."| #pragma mark - App Singleton | |
| - (instancetype)init { | |
| ... | |
| [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:nil]; | |
| ... | |
| } | |
| - (void)dealloc { | |
| [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| import Foundation | |
| class Box<T> { | |
| let unbox: T | |
| init(_ value: T) { self.unbox = value } | |
| } | |
| struct Notification<A> { | |
| let name: String | |
| } |
| require 'mechanize' | |
| require 'moving_average' | |
| mechanize = Mechanize.new | |
| login_page = mechanize.get 'https://www.myfitnesspal.com/account/login' | |
| form = login_page.forms.first | |
| # noinspection RubyResolve | |
| form.field_with(id: 'username').value = "username" | |
| form.field_with(id: 'password').value = "pass" | |
| form.submit |
SSH into Root
$ ssh root@123.123.123.123
Change Root Password
| Copyright 2015 Chris Eidhof | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE |
| // See: https://devforums.apple.com/message/1000934#1000934 | |
| import Foundation | |
| // Logic | |
| operator prefix ¬ {} | |
| @prefix func ¬ (value: Bool) -> Bool { | |
| return !value | |
| } |