Skip to content

Instantly share code, notes, and snippets.

View OksanaFedorchuk's full-sized avatar
🐙
Working hard

Oksana Fedorchuk OksanaFedorchuk

🐙
Working hard
View GitHub Profile
@marekswiecznik
marekswiecznik / migrate_localizable_strings_to_swiftgen.py
Created October 6, 2022 10:37
Migrate NSLocalizedString occurences in Swift code to SwiftGen
#!/usr/bin/env python3
import os
import re
import string
def to_camel_case(snake_str):
components = snake_str.split('_')
return components[0] + ''.join(string.capwords(x) for x in components[1:])
@protspace
protspace / Swift_5.7_Generics
Last active June 12, 2022 09:43
Design protocol interfaces in Swift
//
// File.swift
// SP
//
// Created by Yevgen Sagidulin on 12.06.2022.
//
import Foundation
protocol AnimalFeed {
@nicholascross
nicholascross / ArrayBuilder.swift
Created June 16, 2021 22:35
Generic array builder using swift 5.4 result builder
@resultBuilder
enum ArrayBuilder<OutputModel> {
static func buildEither(first component: [OutputModel]) -> [OutputModel] {
return component
}
static func buildEither(second component: [OutputModel]) -> [OutputModel] {
return component
}
{
"rules": {
"users" : {
"$user_id" : {
".read" : "auth != null && $user_id === auth.uid",
".write" : "auth != null && $user_id === auth.uid"
}
}
}
}
struct KeychainItem {
// MARK: Nested Types
enum KeychainError: Error {
case noPassword
case unexpectedPasswordData
case unexpectedItemData
case unhandledError(status: OSStatus)
}
@rxhanson
rxhanson / gist:df0f2b49f402ea181f5ed61b20f9cd8d
Last active March 28, 2024 13:17 — forked from bhumphrey/gist:3764983
Cherry-picking from another fork
git remote add <other-fork-alias> <other-fork-URL>
git checkout <branch>
git fetch <other-fork-alias>
git cherry-pick <commit-hash>
git push <your-fork-alias>
git remote remove <other-fork-alias>
git remote -v
@Harry-Harrison
Harry-Harrison / ContentView.swift
Last active July 11, 2023 10:42
Haptic Feedback Vibrations in SwiftUI
// This prints a list of buttons that on tap will fire a different type of haptic vibration
import SwiftUI
struct ContentView: View {
let generator = UINotificationFeedbackGenerator()
var body: some View {
VStack(alignment: .center, spacing: 30.0) {
Button(action: {
localeIdentifier Description
eu Basque
hr_BA Croatian (Bosnia & Herzegovina)
en_CM English (Cameroon)
en_BI English (Burundi)
rw_RW Kinyarwanda (Rwanda)
ast Asturian
en_SZ English (Swaziland)
he_IL Hebrew (Israel)
ar Arabic
@KyleGoslan
KyleGoslan / UIView+Extension.swift
Last active August 9, 2023 08:47
UIView extension to easily add and remove a blur (UIVisualEffectView)
import UIKit
extension UIView {
func blurView(style: UIBlurEffect.Style) {
var blurEffectView = UIVisualEffectView()
let blurEffect = UIBlurEffect(style: style)
blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = bounds
addSubview(blurEffectView)
}
@bhumphrey
bhumphrey / gist:3764983
Created September 22, 2012 03:10
Cherry-picking from another fork
git checkout <branch>
git fetch <other-fork-alias>
git cherry-pick <commit-hash>
git push <your-fork-alias>