Skip to content

Instantly share code, notes, and snippets.

View Wooder's full-sized avatar

Jochen Holzer Wooder

  • Karlsruhe, Germany
View GitHub Profile
Requirement IDFA IDFV
User permission(ATT) needed Yes No
Same ID in all Apps of same device Yes No
Same ID in all Apps of vendor on same device Yes Yes
Same ID on different devices No No
Can be used for Ad Attribution Yes No
Can be used for Ad Frequency Capping Yes No (under certain circumstances yes - see article)
Can be used for Audience Targeting Yes Yes
sonarqube-check:
stage: test
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
# See https://docs.sonarqube.org/7.2/AnalysisParameters.html for documentation
sonar.projectKey=your_project_key
sonar.organization=default
sonar.links.homepage=https://gitlab.com/aaa/bbb
sonar.projectBaseDir=.
sonar.sources=YourApp/Classes
sonar.host.url=https://sonarqube-instance.yourdomain.com/
sonar.report.export.path=sonar-report.json
#sonar.login= add this if running sonar-client locally
sonar.qualitygate.wait=true
# record video from iOS simulator
xcrun simctl io booted recordVideo appVideo.mov
import Foundation
public class EmailValidator {
public init() {
}
public func validateEmailAddress(_ email: String) -> Bool {
let emailTest = NSPredicate(format: "SELF MATCHES %@", String.emailValidationRegEx)
return emailTest.evaluate(with: email)
extension Int {
init?(doubleVal: Doube) {
guard (doubleVal <= Double(Int.max).nextDown) && (doubleVal >= Double(Int.min).nextUp) else {
return nil
}
self.init(doubleVal)
}
Date in current timezone as string:
let longDateString = Date().description(with: .current)
let shortDateString DateFormatter.localizedString(from: expiryDate, dateStyle: .medium, timeStyle: .short)
### which shell is used?
echo $SHELL
echo $0
@Wooder
Wooder / IsDebuggerAttached.swift
Created November 21, 2017 15:32
Swift Code that check if the debugger is attached to your iOS Device (App runs in XCode) while running your app
#if DEV
fileprivate func 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
}
#endif
private func urlEncodeString(_ string: String) -> String {
#if swift(>=3.0)
let allowedCharacterSet = (CharacterSet(charactersIn: "!*'();:@&=+$,/?%#[] ").inverted)
if let escapedString = string.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) {
return escapedString
}
#else
let allowedCharacterSet = (NSCharacterSet(charactersInString: "!*'();:@&=+$,/?%#[] ").invertedSet)
if let escapedString = string.stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacterSet) {
return escapedString