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
@main | |
struct ListBugApp: App { | |
var body: some Scene { | |
WindowGroup { | |
NavigationView { // comment out navigation view and list works | |
ContentView() | |
Text("Detail") | |
} | |
} | |
} |
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
require 'mechanize' | |
require 'moving_average' | |
mechanize = Mechanize.new | |
login_page = mechanize.get 'https://www.myfitnesspal.com/account/login' | |
form = login_page.forms.first | |
# noinspection RubyResolve | |
form.field_with(id: 'username').value = "username" | |
form.field_with(id: 'password').value = "pass" | |
form.submit |
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
-(float) get_free_memory { | |
mach_port_t host_port; | |
mach_msg_type_number_t host_size; | |
vm_size_t pagesize; | |
host_port = mach_host_self(); | |
host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); | |
host_page_size(host_port, &pagesize); | |
vm_statistics_data_t vm_stat; | |
if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) { |
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
# For training rest 5 min on compounds, 3-5 minutes on smaller ones | |
# Training A (first set to failure, second set -10% weight + 1 rep): | |
# Deadlift - 2x4-5 | |
# Overhead Press - 1x6-8 | |
# Weighted Chinup - 2x4-6 | |
# Chest-Supported Rows - 2x6-8 | |
# Close-grip chinup - 1x6-10 | |
# Training B (first set to failure, second set -10% weight + 1 rep): |
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
button.onTouchUpInside(context: self) { context in | |
// doStuff | |
} |
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
// swiftlint:disable file_length | |
fileprivate func compareOptionals<T>(lhs: T?, rhs: T?, compare: (_ lhs: T, _ rhs: T) -> Bool) -> Bool { | |
switch (lhs, rhs) { | |
case let (lValue?, rValue?): | |
return compare(lValue, rValue) | |
case (nil, nil): | |
return true | |
default: | |
return false |
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 Krzysztof Zabłocki | |
@interface UITableViewCell (representedObject) | |
@property (nonatomic, strong) id representedObject; | |
@end | |
#import "UITableViewCell+representedObject.h" | |
#import <objc/runtime.h> | |
static char RepresentedObjectKey; |
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 XCPlayground | |
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true | |
func perform(initial: Int) { | |
var value: Int = initial | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1), dispatch_get_main_queue()) { [myConstant = value] in | |
print("constant in first block \(myConstant)") | |
print("captured \(value)") | |
value = initial * 2 |
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
+ (UIImage *)decompressedImageWithImage:(UIImage *)image resizeTo:(CGSize)targetSize | |
{ | |
CGImageRef imageRef = image.CGImage; | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef); | |
BOOL sameSize = NO; | |
if (CGSizeEqualToSize(targetSize, CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)))) { | |
targetSize = CGSizeMake(1, 1); | |
sameSize = YES; | |
} |