The Line Record Format (LRF) is a human-friendly, line-oriented data format designed for simplicity of both human editing and machine parsing. Every LRF document is also a valid Markdown document, making it suitable for embedding structured data in plain-text documentation.
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
| // Example of printing a source code line at an error position | |
| // (based on an index within the entire source code) | |
| // | |
| // By Andrew Kingdom | |
| // MIT license | |
| // (and use at own risk) | |
| // | |
| // Example prints: | |
| // | |
| // DEFGH |
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
| // Android build.gradle | |
| // How to auto-increment the version. | |
| // There are many ways to do this - this is only one example. Its downside is that it updates the gradle file (which will ask for a Sync when opened). | |
| // Note that the 10001 (rather than just 1) is ensure there are enough digits to prevent comparison/sorting issues. | |
| // | |
| // By Andrew Kingdom | |
| // MIT license | |
| // (and use at own risk) | |
| // |
Add the App Sandbox capability to an Xcode project when it is missing from the standard capabilities area.
(Straightforward to do but a pain to remember.)
- If your project lacks a
.entitlementsfile, create a new one:
- Menu:
View>Navigators>Project - Select the root level (project icon) of your project
- Menu:
File>New>File... - Use the
Property Listtemplate
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
| // Objective C | |
| // Display initial screen before final UIViewController loads (e.g. Login credentials) | |
| // | |
| // By Andrew Kingdom | |
| // MIT license | |
| // | |
| // Instructions: | |
| // | |
| // On the main storyboard, create your login screen as, say, a subclass of UIViewController. | |
| // Make sure it is the initial scene (check Is Initial View Controller). |
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
| // Android Java | |
| // How to programmatically control whether the screen may or may not turn off. | |
| // | |
| // By Andrew Kingdom | |
| // MIT license | |
| // | |
| package com.example.sample; | |
| import android.os.Bundle; |
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
| // Android Java | |
| // How to check if the app is a debug build versus a release build. | |
| // | |
| // By Andrew Kingdom | |
| // MIT license | |
| // | |
| public class MainActivity extends AppCompatActivity { | |
| // Returns true if the app is debuggable |
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
| // Swift 5.0 + Javascript | |
| // How to use 'new <classtype>' in Javascript to instantiate a Swift object (from JavaScriptCore). | |
| // | |
| // I couldn't find this clearly documented in any one place. | |
| // | |
| // By Andrew Kingdom | |
| // MIT license | |
| // | |
| @objc | |
| public protocol SampleProtocol: JSExport { |
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
| // Objective C++ | |
| // Detects whether this is an initial or subsequent launch of this app. | |
| // | |
| // By Andrew Kingdom | |
| // MIT license | |
| // | |
| static BOOL _appDidLaunchPreviously; | |
| static BOOL _appDidLaunchPreviously_known; | |
| static NSString * kAppDidLaunchPreviously = @"priorLaunch"; | |
| static NSString * vAppDidLaunchPreviously = @"Y"; |