Skip to content

Instantly share code, notes, and snippets.

View karthikAdaptavant's full-sized avatar
🎯
Focusing

Karthik samy karthikAdaptavant

🎯
Focusing
  • 08:57 (UTC +05:30)
View GitHub Profile
@karthikAdaptavant
karthikAdaptavant / README.md
Last active April 20, 2022 10:50 — forked from brennanMKE/README.md
Create SSH Key on Mac for Xcode

Create SSH Key on Mac for Xcode

The docs for GitHub show a command to create a key with the ed25519 encryption method which is not allowed by Xcode. Even if you are not using the Source Control features in Xcode you will often need to use an account with GitHub when you are consuming Swift packages which are pulled from GitHub.

For SSH keys there are 4 algorithms.

  • 🚨 DSA: This is an older algorithm which is no longer supported and is superceded with more modern algorithms.
  • ⚠️ RSA: This algorithm was an improvement but it is now outdated and a more modern method should be used.
  • 👀 ECDSA: Another improvement which is dependent on your computer's ability to generate random numbers.
  • ✅: Ed25519: The most recommended public-key algorithm today which you should use with GitHub.
import UIKit
// According to article by John Sundell
// https://www.swiftbysundell.com/articles/caching-in-swift/
final class Cache<Key: Hashable, Value> {
private let wrapped = NSCache<WrappedKey, Entry>()
private let dateProvider: () -> Date
private let entryLifetime: TimeInterval
private let keyTracker = KeyTracker()
@karthikAdaptavant
karthikAdaptavant / singleton.dart
Created April 7, 2020 14:34 — forked from theburningmonk/singleton.dart
Using Dart's factory constructor feature to implement the singleton pattern
class MyClass {
static final MyClass _singleton = new MyClass._internal();
factory MyClass() {
return _singleton;
}
MyClass._internal() {
... // initialization logic here
}
//
// ProgrammerAssertions.swift
// Assertions
//
// Created by Mohamed Afifi on 12/20/15.
// Copyright © 2015 mohamede1945. All rights reserved.
//
import Foundation
// BASIC SWITCH
enum Media { case Book }
extension Media : CustomStringConvertible
{
var description: String {
switch self {
case .Book: return "bible"
}
import UIKit
import PluggableApplicationDelegate
@UIApplicationMain
class AppDelegate: PluggableApplicationDelegate
{
override var services: [ApplicationService] {
return [
LoggerApplicationService()
]
@karthikAdaptavant
karthikAdaptavant / AppLifecycleTracker.swift
Created June 2, 2019 12:46 — forked from andretodman/AppLifecycleTracker.swift
A Swift 4.0 class to keep track of the time an app is in background, foreground, terminated and suspended
//
// AppLifecycleTracker.swift
// A Swift 4.0 class to keep track of the time an app is in background, foreground, terminated and suspended
// Usage: var appLifecycleTracker:AppLifecycleTracker? = AppLifecycleTracker()
// Must enable CoreLocation update background mode to allow this to update in BG
// Privacy - Location Always and When In Use Usage Description must be in the plist
// Test by freeing ram while app is backgrounded to see last suspention time
//
// Created by Andre Todman on 10/19/18.
//