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
const std = @import("std"); | |
const posix = std.posix; | |
const c = std.c; | |
pub const SCM_MAX_FD = 253; | |
// Taken from https://git.musl-libc.org/cgit/musl/tree/include/sys/socket.h | |
pub const SCM_RIGHTS = 0x01; | |
pub const SCM_CREDENTIALS = 0x02; |
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
// Created by Umur Gedik on 27.12.2023. | |
import Foundation | |
public extension StringProtocol { | |
func compact(occurencesOf needle: Character, to maxNeedles: Int) -> String { | |
var parts: [Self.SubSequence] = [] | |
var cursor: String.Index = startIndex | |
while let needleIndex = self[cursor...].firstIndex(of: needle) { | |
if needleIndex != cursor { |
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 Cocoa | |
enum HTTPMethod: String { | |
case get | |
case put | |
case post | |
case delete | |
} | |
protocol Request { |
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 AppKit | |
import NukeUI | |
import PinLayout | |
final class FeedMediaGrid: BaseNSView { | |
let imageView1 = LazyImageView() | |
let imageView2 = LazyImageView() | |
let imageView3 = LazyImageView() | |
let imageView4 = LazyImageView() |
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
| "OS Build Version" = "21G115" | |
+-o J293AP <class IOPlatformExpertDevice, id 0x100000227, registered, matched, active, busy 0 (12390 ms), retain 34> | |
| | | | "perf-states" = <0000000090010000007b9a175e02000000a4781f7d0200000054ea2a9f020000001f1337f702000000ea3b434503000080bb2c4c87030000> | |
| | | | "gfx-shared-region-base" = <0080f7ff09000000> | |
| | | | "gpu-num-perf-states" = <06000000> | |
| | | | "AGXParameterBufferMaxSizeEverMemless" = 293076992 | |
| | | | "AGXParameterBufferMaxSizeNeverMemless" = 146538496 | |
| | | | "gpu-core-count" = 8 | |
| | | | "AGXParameterBufferMaxSize" = 439615488 | |
| | | | "GPUConfigurationVariable" = {"gpu_gen"=13,"num_gps"=4,"num_cores"=8,"core_mask_list"=(255),"num_frags"=8,"num_mgpus"=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
import Foundation | |
import Darwin | |
var logID: Int64 = 0 | |
enum Errors: String, Error { | |
case couldntOpenFile | |
case failedToWrite | |
} |
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
use std::{ | |
fs, | |
io::{self, BufWriter, Write}, | |
time::Instant, | |
}; | |
fn main() -> io::Result<()> { | |
println!("Hello, world!"); | |
let file = fs::File::create("output.txt")?; |
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 Foundation | |
import Darwin | |
var logID: Int64 = 0 | |
enum Errors: String, Error { | |
case couldntOpenFile | |
case failedToWrite | |
} |
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
- (void)drawRect:(NSRect)dirtyRect { | |
[super drawRect:dirtyRect]; | |
CGContextRef ctx = [NSGraphicsContext currentContext].CGContext; | |
[NSColor.blackColor setFill]; | |
CGContextFillRect(ctx, CGRectMake(0, self.label.frame.size.height, self.label.frame.size.width, self.label.frame.size.height)); | |
CFIndex stringLen = CFStringGetLength(text); | |
CTFontRef font = CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, 24.0f, nil); |
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 FlippedClipView: NSClipView { | |
var stickyView: NSView? | |
var trailingConstraint: NSLayoutConstraint? | |
override var isFlipped: Bool { true } | |
override func layout() { | |
super.layout() | |
if trailingConstraint == nil, let scrollView = enclosingScrollView, let stickyView = stickyView { | |
trailingConstraint = stickyView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor, constant: 0) | |
trailingConstraint?.isActive = true |
NewerOlder