Skip to content

Instantly share code, notes, and snippets.

struct ContentView: View {
var body: some View {
VStack(alignment: .customAlignment) {
HStack {
Text("100 m").font(Font.body.bold())
Text("Usain Bolt").setCustomAlignmentToLeading()
}
HStack {
Text("5 km").font(Font.body.bold())
Text("Joshua Cheptegei").setCustomAlignmentToLeading()
//
// BottomSheetView.swift
//
// Created by Majid Jabrayilov
// Copyright © 2019 Majid Jabrayilov. All rights reserved.
//
import SwiftUI
fileprivate enum Constants {
static let radius: CGFloat = 16
@chriseidhof
chriseidhof / collectionview.swift
Last active January 31, 2024 19:00
SwiftUI Flow Layout
//
// ContentView.swift
// DeleteMe
//
// Created by Chris Eidhof on 02.02.21.
//
import SwiftUI
/*
@unnamedd
unnamedd / MacEditorTextView.swift
Last active May 26, 2024 17:49
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
/// Similar to a `Binding`, but this is also observable/dynamic.
@propertyDelegate
@dynamicMemberLookup
final class Derived<A>: BindableObject {
let didChange = PassthroughSubject<A, Never>()
fileprivate var cancellables: [AnyCancellable] = []
private let get: () -> (A)
private let mutate: ((inout A) -> ()) -> ()
init(get: @escaping () -> A, mutate: @escaping ((inout A) -> ()) -> ()) {
self.get = get
@discardableResult
public func with<T>(_ value: T, _ builder: (T) -> Void) -> T {
builder(value)
return value
}
@discardableResult
public func with<T>(_ value: T, _ builder: (T) throws -> Void ) rethrows -> T {
try builder(value)
return value
@arturdev
arturdev / URLRequest+Multipart.swift
Last active February 21, 2023 18:59
URLRequest with multipart support
//
// URLRequest+Multipart.swift
//
// Created by Artur Mkrtchyan on 1/16/19.
// Copyright © 2019 arturdev. All rights reserved.
//
import Foundation
import MobileCoreServices
@nickdiego
nickdiego / sync-chromium-behind-proxy.md
Last active October 10, 2023 15:30
Clone chromium sources behind corporate proxy + https certificate

The problem

Got the following error after trying to clone/sync chromium sources behing a corporate proxy/certificate (or something similar):

(venv) (develenv) ➜ chromium git:(master) ✗ gclient sync
Syncing projects: 100% (98/98), done.                                                        
Running hooks:  18% (14/75) binutils      
________ running '/home/nickp/sandbox/chromium/venv/bin/python src/third_party/binutils/download.py' in '/home/nickp/sandbox/chromium'
NOTICE: You have PROXY values set in your environment, but gsutil in depot_tools does not (yet) obey them.
1. Add symbolic breakpoint
2. Symbol: -[UIViewController dealloc]
3. Add 2 action, Log Message and Sound
4. Edit command on Log Message Action:
--- dealloc @(id)[$arg1 description]@ @(id)[$arg1 title]@
@rnystrom
rnystrom / ViewController.swift
Created May 29, 2018 01:16
Interactive NSAttributedString link highlighting with TextKit
import UIKit
public extension CGSize {
func snapped(scale: CGFloat) -> CGSize {
var size = self
size.width = ceil(size.width * scale) / scale
size.height = ceil(size.height * scale) / scale
return size
}