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
+(NSString*)sanitizeString:(NSString *)originalString | |
{ | |
// example string | |
// NSString *unfilteredString = @"!@#$%^&*()_+|abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; | |
// define the characters you want to allow | |
NSString *allowedChars =@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; | |
// makes an inverted set based on your setting | |
NSCharacterSet *notAllowedChars = [[NSCharacterSet characterSetWithCharactersInString:allowedChars] invertedSet]; |
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)makeCountriesJSON | |
{ | |
NSArray<NSString*> *localeIds = @[@"pt", @"en"]; | |
NSArray<NSString*> *countryCodesArray = [NSLocale ISOCountryCodes]; | |
NSMutableString *json = [NSMutableString stringWithString:@"{"]; | |
[localeIds enumerateObjectsUsingBlock:^(NSString * localeId, NSUInteger localeIndex, BOOL * _Nonnull stop) { | |
NSLocale *locale = [NSLocale localeWithLocaleIdentifier:localeId]; |
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
#!/usr/bin/env bash | |
rm -rf "${HOME}/Library/Caches/CocoaPods" | |
rm -rf "`pwd`/Pods/" | |
pod update |
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
// get off main thread and execute costly code | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ | |
// jump back to main thread and update your UI | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
}); | |
}); |
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
#!/bin/bash | |
PROCESS=Contents/MacOS/Xcode | |
WORKSPACE={Your Workspace/Project Path} | |
CACHE=~/Library/Developer/Xcode/DerivedData | |
# -------- | |
previousHead=$1 | |
currentHead=$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
import SwiftUI | |
// MARK: - UIKit.UIView -> SwiftUI.View | |
public extension NSObjectProtocol where Self: UIView { | |
/// Creates a wrapper for a UIKit view that you use to integrate that view into your | |
/// SwiftUI view hierarchy. | |
/// | |
/// For best results set sensible values for [content compression resistance](https://developer.apple.com/documentation/uikit/uiview/1622526-setcontentcompressionresistancep), | |
/// and [content hugging priority](https://developer.apple.com/documentation/uikit/uiview/1622485-setcontenthuggingpriority) in your content view and it's immediate subviews. |
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
alias: Luz Sala Jantar | |
description: "" | |
trigger: | |
- type: motion | |
platform: device | |
device_id: 0f52625e2f8107945c7039224cd45b8c | |
entity_id: ba6fd12b9550964f2645da6481182867 | |
domain: binary_sensor | |
id: motion_on | |
for: |