Skip to content

Instantly share code, notes, and snippets.

@juliensagot
juliensagot / UIFont+smallCaps.swift
Last active April 9, 2022 18:43
Get UIFont with smallCaps feature (Swift 5.6, Xcode 13.3)
extension UIFont {
var withSmallCaps: UIFont {
let upperCaseFeature = [
UIFontDescriptor.FeatureKey.type : kUpperCaseType,
UIFontDescriptor.FeatureKey.selector : kUpperCaseSmallCapsSelector
]
let lowerCaseFeature = [
UIFontDescriptor.FeatureKey.type : kLowerCaseType,
UIFontDescriptor.FeatureKey.selector : kLowerCaseSmallCapsSelector
@gitaarik
gitaarik / git_submodules.md
Last active April 22, 2024 10:52
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@akshay1188
akshay1188 / whatsapp-image-compression
Last active June 10, 2023 16:42
Whatsapp like image compression
- (UIImage *)compressImage:(UIImage *)image{
float actualHeight = image.size.height;
float actualWidth = image.size.width;
float maxHeight = 600.0;
float maxWidth = 800.0;
float imgRatio = actualWidth/actualHeight;
float maxRatio = maxWidth/maxHeight;
float compressionQuality = 0.5;//50 percent compression
if (actualHeight > maxHeight || actualWidth > maxWidth) {