Skip to content

Instantly share code, notes, and snippets.

View hsleedevelop's full-sized avatar
🔥

HS Lee hsleedevelop

🔥
View GitHub Profile
@bobspryn
bobspryn / preferredFontDescriptorWithTextStyle sizes and styles
Created December 11, 2013 01:12
Apple iOS7 sizes and traits for all UIFontTextStyle's and UIContentSizeCategory's
UIContentSizeCategoryExtraSmall
FontStyle: UICTFontTextStyleBody
Point size 14.000000
Family Name .AppleSystemUIBody
FontStyle: UICTFontTextStyleHeadline
Point size 14.000000
Family Name .AppleSystemUIHeadline
Bold
FontStyle: UICTFontTextStyleSubhead
Point size 12.000000
@sooop
sooop / Monads.swift
Last active February 3, 2020 16:20
Monad in Swift : 모나드 개념을 Swift로 구현해본다.
/*
모나드는 특정한 타입을 감싸는 타입이며,
raw한 값을 감싸는 함수와
raw한 값을 모나드 값으로 바꾸는 어떤 함수에 바인딩된다.
이를 바탕으로 모나드 프로토콜을 정의하면 다음과 같다.
*/
protocol Monad {
@davbeck
davbeck / WKUIDelegate.m
Last active September 28, 2023 06:59
Boilerplate implementation of WKUIDelegate to support Javascript alerts.
#pragma mark - WKUIDelegate
- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)())completionHandler
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
message:message
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
completionHandler();
@yamaya
yamaya / xcode-swift-vers
Last active May 20, 2024 16:56
Xcode swift version record
# Xcode 6.2 (6C131e)
Swift version 1.1 (swift-600.0.57.4)
Target: x86_64-apple-darwin14.1.0
# Xcode 6.3 (6D570)
Apple Swift version 1.2 (swiftlang-602.0.49.3 clang-clang-602.0.49)
Target: x86_64-apple-darwin14.1.0
# Xcode 6.3.1 (6D1002)
Apple Swift version 1.2 (swiftlang-602.0.49.6 clang-602.0.49)
@chriseidhof
chriseidhof / json.swift
Last active March 21, 2019 07:45
Reflection
import Cocoa
struct Person {
var name: String = "John"
var age: Int = 50
var dutch: Bool = false
var address: Address? = Address(street: "Market St.")
}
struct Address {
@alanzeino
alanzeino / lldb-debugging.md
Last active May 29, 2024 03:18
LLDB debugging with examples

LLDB Debugging Cheat Sheet

Commands

LLDB Commands

LLDB comes with a great set of commands for powerful debugging.

help

Your starting point for anything. Type help to get a list of all commands, plus any user installed ones. Type 'help for more information on a command. Type help to get help for a specific option in a command too.

@steipete
steipete / ios-xcode-device-support.sh
Last active December 12, 2023 03:36
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
public protocol PaginationServiceType {
associatedtype Element
init(elementProvider: (page: Int, numberOfElements: Int) -> SignalProducer<[Element], NoError>)
func fetchNextPage(numberOfElements: Int) -> SignalProducer<[Element], NoError>
}
@asmallteapot
asmallteapot / Dictionary.Value+RangeReplaceableCollection.swift
Last active March 28, 2023 07:40
Swift: Append an element to an array in a dictionary value, creating the array/value if needed
import Foundation
extension Dictionary where Value: RangeReplaceableCollection {
public mutating func append(element: Value.Iterator.Element, toValueOfKey key: Key) -> Value? {
var value: Value = self[key] ?? Value()
value.append(element)
self[key] = value
return value
}
}
@JulianAlonso
JulianAlonso / Regex&Matcher-Playground.swift
Last active March 7, 2023 06:22
Mapping URL (Deep linking) on iOS.
import Foundation
extension String {
//Know if self is only composed by numbers
var isNumber: Bool {
return !self.isEmpty && CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: self))
}
}
//Struct to check Regular Expresions