This file contains hidden or 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 subprocess | |
from dataclasses import dataclass | |
from itertools import groupby | |
from docx import Document | |
from docx.shared import Inches, Pt, Mm | |
from docx.enum.text import WD_BREAK, WD_ALIGN_PARAGRAPH | |
from docx.oxml import OxmlElement, parse_xml, ns | |
from docx.oxml.ns import nsdecls, qn | |
@dataclass |
This file contains hidden or 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 URLRequest { | |
/// Prints the request as "raw" String | |
/// | |
/// Like: | |
/// ``` | |
/// GET /path HTTP/1.1 | |
/// Host: host | |
/// Header: Value | |
/// Header: Value | |
/// |
This file contains hidden or 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 ExpansionHandler<T: Equatable>: ObservableObject { | |
@Published private (set) var expandedItem: T? | |
func isExpanded(_ item: T) -> Binding<Bool> { | |
return Binding( | |
get: { item == self.expandedItem }, | |
set: { self.expandedItem = $0 == true ? item : nil } | |
) | |
} |
This file contains hidden or 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
/// Stores value types on the heap | |
/// | |
/// Arrays are stored on the heap and only the pointer (8 bytes) to the array remains on the stack. | |
/// This behaviour is used to wrap another type into an array, and therefore move it to the heap. | |
/// | |
/// Example usage: | |
/// ``` | |
/// @StoredOnHeap var hugeStruct: HugeStruct | |
/// ``` | |
@propertyWrapper |
This file contains hidden or 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
/// Stores value types on the heap | |
/// | |
/// Arrays are stored on the heap and only the pointer (8 bytes) to the array remains on the stack. | |
/// This behaviour is used to wrap another type into an array, and therefore move it to the heap. | |
/// | |
/// Example usage: | |
/// ``` | |
/// @StoredOnHeap var hugeStruct: HugeStruct | |
/// ``` | |
@propertyWrapper |
This file contains hidden or 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
// This method requires ImageIO.framework | |
#import <ImageIO/ImageIO.h> | |
- (CGSize)sizeOfImageAtURL:(NSURL *)imageURL | |
{ | |
// With CGImageSource we avoid loading the whole image into memory | |
CGSize imageSize = CGSizeZero; | |
CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)imageURL, NULL); | |
if (source) { | |
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCGImageSourceShouldCache]; |
This file contains hidden or 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
#!/bin/sh | |
# execute this in your repo's root dir | |
git rm --cached -r . | |
git reset --hard |