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
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |
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
| function onEdit() { | |
| //Get active sheet | |
| var activeSheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); | |
| if(activeSheet.getName() == "Transactions") { | |
| Logger.log("onEdit Transactions sheet") | |
| applyTransactionCategoryDropdown() | |
| } | |
| } | |
| function applyTransactionCategoryDropdown() { |
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 MediaItem { | |
| var name: String | |
| init(name: String) { | |
| self.name = name | |
| } | |
| } | |
| class Movie: MediaItem { | |
| var director: String | |
| init(name: String, director: String) { | |
| self.director = director |
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
| // Value type example | |
| struct S { | |
| var data: Int = -1 | |
| } | |
| var a = S() | |
| var b = a // a is copied to b | |
| a.data = 42 // Changes a, not b | |
| print("\(a.data), \(b.data)") //prints "42, -1" | |
| // Reference type example | |
| class C { |
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
| // Defining a Base Class | |
| class Vehicle { | |
| var currentSpeed = 0.0 | |
| var description: String { | |
| return "traveling at \(currentSpeed) miles per hour" | |
| } | |
| func makeNoise() { | |
| // do nothing - an arbitrary vehicle doesn't necessarily make a noise | |
| } | |
| } |
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 swapTwoInts(_ a: inout Int, _ b: inout Int) { | |
| let temporaryA = a | |
| a = b | |
| b = temporaryA | |
| } | |
| var someInt = 3 | |
| var anotherInt = 107 | |
| swapTwoInts(&someInt, &anotherInt) | |
| print("someInt is now \(someInt), and anotherInt is now \(anotherInt)") |
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
| <plist version="1.0"> | |
| <dict> | |
| ... | |
| <key>FacebookAppID</key> | |
| <string>{your-app-id}</string> | |
| <key>FacebookDisplayName</key> | |
| <string>{your-app-name}</string> | |
| <key>AccountKitClientToken</key> | |
| <string>{your-account-kit-client-token}</string> | |
| <key>CFBundleURLTypes</key> |
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 application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
| // Override point for customization after application launch. | |
| // Initialize Google sign-in | |
| GIDSignIn.sharedInstance().clientID = "YOUR_CLIENT_ID" // get from Google Developer | |
| // Initialize Facebook/AccountKit sign-in | |
| FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) | |
| return true | |
| } |
OlderNewer