Skip to content

Instantly share code, notes, and snippets.

@konnnn
konnnn / UICollectionView+CustomCell+Programmatically.swift
Last active January 3, 2023 06:55
Adding UICollectionView with Custom Cell to UIViewController programmatically
// Created by Evgeny Konkin on 17.06.2019.
class ViewController: UIViewController {
var collectionView: UICollectionView!
// MARK: - Views Life Cycles
override func viewDidLoad() {
super.viewDidLoad()
@sajoku
sajoku / testflight.sh
Created June 14, 2017 05:17 — forked from keith/testflight.sh
Upload an ipa to testflight using altool
#!/bin/bash
set -e
set -u
altool="$(dirname "$(xcode-select -p)")/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool"
ipa="path/to/foo.ipa"
echo "Validating app..."
time "$altool" --validate-app --type ios --file "$ipa" --username "$ITC_USER" --password "$ITC_PASSWORD"
@shaps80
shaps80 / cURL+Request.swift
Last active December 23, 2023 17:43
Generates a cURL command representation of a URLRequest in Swift.
import Foundation
extension URLRequest {
/**
Returns a cURL command representation of this URL request.
*/
public var curlString: String {
guard let url = url else { return "" }
var baseCommand = #"curl "\#(url.absoluteString)""#
@sohayb
sohayb / ArrayDeepCopy.swift
Last active October 13, 2023 07:58
Array deep copy in Swift
//Protocal that copyable class should conform
protocol Copying {
init(original: Self)
}
//Concrete class extension
extension Copying {
func copy() -> Self {
return Self.init(original: self)
}
@Integralist
Integralist / README.md
Last active September 4, 2018 13:28
How encryption with certificates and public/private keys work

PKI

  • PKI is based upon two keys (public and private)
  • Data can be securely encrypted using either the public or private keys
  • Data can only be decrypted when using the opposite key to that which encrypted the data
  • Use a Key Generator (e.g. ssh-keygen) to create your public/private keys
  • These keys are typically stored in ~/.ssh/
    • id_rsa (private key; do not share! typically used to decrypt data)
    • id_rsa.pub (public key; typically used to encrypt data)
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}