🐱 にゃーん
Context:
@objc protocol ExampleActions: AnyObject { | |
func pushUIKitViewController() | |
} | |
struct ExampleView: View { | |
@FirstResponder private var firstResponder | |
var body: some View { | |
Button { | |
firstResponder.sendAction(#selector(ExampleActions.pushUIKitViewController)) |
extension String { | |
/// Finds matching groups and replace them with a template using an intuitive API. | |
/// | |
/// This example will go through an input string and replace all occurrences of "MyGreatBrand" with "**MyGreatBrand**". | |
/// | |
/// let regex = try! NSRegularExpression(pattern: #"(MyGreatBrand)"#) // Matches all occurrences of MyGreatBrand | |
/// someMarkdownDocument.replaceGroups(matching: regex, with: #"**$1**"#) // Surround all matches with **, formatting as bold text in markdown. | |
/// print(someMarkdownDocument) | |
/// | |
/// - Parameters: |
let textView = UITextView(frame: view.bounds) | |
textView.autoresizingMask = [.flexibleWidth, .flexibleHeight] | |
let text = NSMutableAttributedString(string: "test") | |
text.addAttributes([ | |
.font: UIFont.systemFont(ofSize: 20.0), | |
.foregroundColor: UIColor.label, | |
.underlineStyle: 0 | |
], range: NSRange(location: 0, length: text.length)) |
🐱 にゃーん
Context:
#!/usr/bin/env bash | |
set -e | |
VOLUME_PATH=/Volumes/installer | |
while getopts ":d:h" opts; do | |
case $opts in | |
d) | |
VOLUME_PATH=$OPTARG | |
;; |
app = Application("CotEditor") | |
app.includeStandardAdditions = true | |
doc = app.documents()[0] | |
function replaceSelectedText1(newText) { | |
selectedRange = doc.selection.range() | |
if(!selectedRange[1]){ | |
// omit | |
return newText | |
} |
# GPG on Tower |
//disable TOC button | |
window.HelpViewer.showTOCButton(false); | |
//enable TOC button | |
//If you call this on window load it will flash active for a brief second and then disable again. | |
//Call if after a delay of 250ms and is works fine | |
//Not sure what the second variable does yet, but passing false works fine | |
window.HelpViewer.showTOCButton( true, false, function() { | |
//do something to toggle TOC in your webpage | |
}); |
Unfortunately, xcode does not yet have support for importing OSX crash logs and symbolizing them. Therefore, you must use the command line and a little bit of manual work.