Skip to content

Instantly share code, notes, and snippets.

View asilturk's full-sized avatar
🤓
Talk is cheap, show me the code.

Burak Furkan Asiltürk asilturk

🤓
Talk is cheap, show me the code.
View GitHub Profile
@asilturk
asilturk / DispatchQueue.swift
Created October 21, 2021 19:28
DispatchQueue
// main queue
DispatchQueue.main
// high priority global queue
DispatchQueue.global(qos: .userInteractive)
// low priority global queue
DispatchQueue.global(qos: .background)

Videos

@asilturk
asilturk / AdapterPattern.swift
Last active April 23, 2021 22:00
Adapter Pattern
import UIKit
// MARK: - Base Protocol
typealias Result = ((Bool) -> Void)
typealias Err = ((Error?) -> Void)
protocol Share {
func post(image: UIImage?, text: String?, result: Result, error: Err?)
}
@asilturk
asilturk / notificationTappped.swift
Created October 5, 2020 07:17
notificationTapped
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
// Uygulama calisiyorken (on/arka planda) kullanici bildirime tikladiginda burdan yonlendirilir
NotificationCenter.default.post(name: Notification.Name("NotificationTapped"), object: nil, userInfo: userInfo)
// user tapped the notification bar when the app is in foreground
if(UIApplication.shared.applicationState == .active) { }
@asilturk
asilturk / jailBroken.swift
Created October 5, 2020 07:13
jailBroken.swift
static var isDeviceJailbroken: Bool {
guard TARGET_IPHONE_SIMULATOR != 1 else { return false }
// Check 1 : existence of files that are common for jailbroken devices
if FileManager.default.fileExists(atPath: "/Applications/Cydia.app")
|| FileManager.default.fileExists(atPath: "/Library/MobileSubstrate/MobileSubstrate.dylib")
|| FileManager.default.fileExists(atPath: "/bin/bash")
|| FileManager.default.fileExists(atPath: "/usr/sbin/sshd")
|| FileManager.default.fileExists(atPath: "/etc/apt")
@asilturk
asilturk / qosQueue.swift
Created July 25, 2020 16:37
qosQueue.swift
let queue = DispatchQueue.global (qos: .userInteractive)
@asilturk
asilturk / concurrentQueue.swift
Created July 25, 2020 16:29
concurrentQueue.swift
let queue = DispatchQueue(label: "feeQueue", attributes: .concurrent)
@asilturk
asilturk / feequeue.swift
Created July 25, 2020 16:21
feequeue.swift
let queue = DispatchQueue(label: "feeQueue")
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
versionLabel.text = "Version: " + "\(appVersion!)"
@asilturk
asilturk / corner_radius.xml
Last active June 2, 2020 08:16
Android corner radius xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="200dp"
android:layout_width="200dp">
<item>
<shape android:shape="rectangle">
<solid android:color="#edf2f6"/>