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
#if DEBUG | |
import Foundation | |
import SwiftUI | |
// MARK: - Public Interface | |
public extension View { | |
// swiftlint:disable identifier_name | |
/// Draw a frame around the view and print its size on screen. |
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 Utlity { | |
internal var isDebuggerAttached: Bool { | |
var info = kinfo_proc() | |
var mib : [Int32] = [CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()] | |
var size = MemoryLayout<kinfo_proc>.stride | |
let junk = sysctl(&mib, UInt32(mib.count), &info, &size, nil, 0) | |
assert(junk == 0, "sysctl failed") | |
return (info.kp_proc.p_flag & P_TRACED) != 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
class MyView : UIView { | |
func buildMyView() { | |
var indicatorView :UIActivityIndicatorView! | |
let indicatorSize : CGFloat = 120 | |
loadingIndicator = UIView(frame: CGRect(origin: CGPoint.zero, size: CGSize(width: indicatorSize, height: indicatorSize))) | |
loadingIndicator.backgroundColor = UIColor.darkGray.withAlphaComponent(0.7) | |
loadingIndicator.layer.cornerRadius = 10.0 | |
indicatorView = UIActivityIndicatorView(activityIndicatorStyle: .white) | |
indicatorView.hidesWhenStopped = 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
protocol ListableEnumeration { | |
associatedtype T | |
static var allItems :[T] { get } | |
} |
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
# Download the file manually from here https://launchpad.net/gcc-arm-embedded | |
# Note: `curl` command doesn't work | |
# I downloaded this one: "gcc-arm-none-eabi-4_7-2013q3-20130916-mac.tar.bz2" | |
# double click it to unzip it | |
# Make a place to install it to | |
mkdir /usr/local/gcc_arm | |
# Move the unzipped stuff there. |
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)doCodeSnippetWithCompletion:(void(^)())block{ | |
//dispatching to background queue | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ | |
NSString *code = @"Code", *test = @"Test"; | |
BOOL iterationPrinted = NO; | |
for (int x = 1; x<=100; x++) { | |
iterationPrinted = NO; | |
if(x % 3 == 0 && x % 5 == 0) | |
NSLog(@"%@%@",code,test); | |
else if(x % 5 == 0) |