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
import CoreLocation | |
extension CLLocationCoordinate2D: Codable { | |
public func encode(to encoder: Encoder) throws { | |
var container = encoder.unkeyedContainer() | |
try container.encode(longitude) | |
try container.encode(latitude) | |
} | |
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
// flow-typed signature: 7f1a115f75043c44385071ea3f33c586 | |
// flow-typed version: 358375125e/redux_v3.x.x/flow_>=v0.33.x | |
declare module 'redux' { | |
/* | |
S = State | |
A = Action | |
D = Dispatch |
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
# Ignore escape sequences %% | |
(?<!%) | |
# Match % | |
% | |
# Match extended attributes supported by OSLog, ie: {public, uuid_t} | |
# See https://developer.apple.com/documentation/os/logging for built-in value decoders | |
(?:\{([\w-,\s]+)\}){0,1} |
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
class UnfairLock: NSLocking { | |
private var _lock = os_unfair_lock() | |
func lock() { | |
os_unfair_lock_lock(&_lock) | |
} | |
func unlock() { | |
os_unfair_lock_unlock(&_lock) | |
} |
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
caffeinate & | |
CAFFEINATE_PID=$! | |
for FILE in *.mkv; do | |
OUTPUT=$(echo $FILE | sed -r "s/[ ]*[\.-\(]?(480p|720p|1080p|WEB|576p|HDTV|Xvid).*(\.[a-z4]+)$/\2/I") | |
if [ "$OUTPUT" = "$FILE" ]; then | |
OUTPUT=$(echo $OUTPUT | sed -r "s/(\.[a-z4]+)$/.converted\1/I") | |
fi |
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
class FormsheetPresentationController: UIPresentationController { | |
private static let dimmingViewOpacityWhenPresented = 0.5 | |
private var isPresented = false | |
private let dimmingView: UIView = { | |
let dimmingView = UIView() | |
dimmingView.backgroundColor = .black | |
return dimmingView | |
}() |
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
extension UIPresentationController { | |
static let presentationTransitionWillBegin = Notification.Name( | |
"UIPresentationControllerPresentationTransitionWillBeginNotification" | |
) | |
static let presentationTransitionDidEndNotification = Notification.Name( | |
"UIPresentationControllerPresentationTransitionDidEndNotification" | |
) | |
static let dismissalTransitionWillBeginNotification = Notification.Name( |
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
import NetworkExtension | |
extension NetworkExtension.NWPath { | |
var interfaceName: String? { | |
let interface = self.value(forKeyPath: "_internalPath.direct") as? nw_interface_t | |
return interface.map { String(cString: nw_interface_get_name($0)) } | |
} | |
} |
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
import UIKit | |
import PlaygroundSupport | |
extension NSAttributedString { | |
enum MarkdownElement { | |
case paragraph, bold | |
} | |
struct MarkdownStylingOptions { | |
var font: UIFont |
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
unsafe fn any_as_u8_slice<T: Sized>(p: &T) -> &[u8] { | |
::core::slice::from_raw_parts( | |
(p as *const T) as *const u8, | |
::core::mem::size_of::<T>(), | |
) | |
} | |
let bytes: &[u8] = unsafe { any_as_u8_slice(&req) }; | |
for byte in bytes { | |
print!("{:02x} ", byte); |
OlderNewer