This file contains 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
#!/usr/bin/swift | |
print("Hello, world!") |
This file contains 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
CATransaction.begin() | |
CATransaction.setDisableActions(true) | |
let frame = CGRect(x: 0.0, | |
y: 0.0, | |
width: 300.0, | |
height: 300.0) | |
self.layer.frame = frame |
This file contains 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 attributedString = NSMutableAttributedString(string: "<green>1234</green>5678<green>91011</green>") | |
let storage = attributedString.mutableString | |
let startRange = storage.range(of: "<green>") | |
let endRange = storage.range(of: "</green>") | |
storage.deleteCharacters(in: endRange) | |
storage.deleteCharacters(in: startRange) |
This file contains 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
#!/usr/bin/env zx | |
import os from 'os'; | |
$.verbose = false; | |
const networkInterfaces = os.networkInterfaces(); | |
const externalAddress = Object.values(networkInterfaces).flatMap(value => value).find(value => value.family === 'IPv4' && value.internal === false).address; |