Skip to content

Instantly share code, notes, and snippets.

View MehdiChennoufi's full-sized avatar

Mehdi Chennoufi MehdiChennoufi

  • France
View GitHub Profile
//
// StoreReviewHelper.swift
// Template1
//
// Created by Apple on 14/11/17.
// Copyright © 2017 Mobiotics. All rights reserved.
//
import Foundation
import StoreKit
@vincent-peng
vincent-peng / Data+HexEncodedString.swift
Last active November 26, 2023 14:28
Convert Data to hex string in Swift
// http://stackoverflow.com/a/40089462
extension Data {
func hexEncodedString() -> String {
return map { String(format: "%02hhx", $0) }.joined()
}
}
@simme
simme / UNNotification+Reschdule.swift
Created November 17, 2016 09:43
Exntension to `UNNotification` for "snoozing" a notification.
//
// UNNotification+Reschedule.swift
// Meal Plan
//
// Created by Simon Ljungberg on 17/11/16.
// License: MIT
//
import UIKit
import UserNotifications
@khanlou
khanlou / MD5StringTest.swift
Last active April 12, 2019 09:18
MD5 and SHA1 on String in Swift 3
import XCTest
@testable import <#project#>
class StringMD5Test: XCTestCase {
func testMD5() {
let string = "soroush khanlou"
XCTAssertEqual(string.md5, "954d741d14b14002d1ba88f600eee635")
@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;
}
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active July 3, 2025 05:23
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S