Skip to content

Instantly share code, notes, and snippets.

View olgusirman's full-sized avatar

olgusirman olgusirman

View GitHub Profile
# xcode-version-bump.sh
# @desc Auto-increment the version number (only) when a project is archived for export.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Check the checkbox "Run script only when installing"
# 6. Drag the "Run Script" below "Link Binaries With Libraries"
@olgusirman
olgusirman / OOP_Musician_Approach.swift
Created August 28, 2020 18:35
Sample OOP approach
/**
* Copyright (c) 2017 Razeware LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@olgusirman
olgusirman / FontProtocol.swift
Created August 28, 2020 18:30
Protocol Oriented approach for font usage
protocol CustomFontsProtocol {
func size(size: CGFloat) -> UIFont?
}
extension CustomFontsProtocol where Self: RawRepresentable, Self.RawValue == String {
func size(size: CGFloat) -> UIFont? {
return UIFont(name: rawValue, size: size)
}
@olgusirman
olgusirman / RemoveDuplicates.swift
Created August 28, 2020 16:53
Remove duplicates
public extension Array where Element: Hashable {
func removeDuplicates() -> [Element] {
var items = Set<Element>
return self.filter { items.insert($0).inserted }
}
}
// [1,2,5,5,2,4,3].removeDuplicates()
@olgusirman
olgusirman / uploadFirebaseCrashlytics.sh
Created August 16, 2020 08:38
Use for manually upload dsym files to Firebase
sudo {path/FirebaseCrashlytics/upload-symbols} -gsp {{path/GoogleService-Info.plist}} -p ios {dsym'sPath}
@olgusirman
olgusirman / sample.dart
Created August 15, 2020 17:41
Sample dart codes from RayWenderlich tutorial
void main() {
var myAge = 35;
print(myAge); // 35
// This is a comment.
print(myAge); // This is also a comment.
/*
And so is this.
*/
int yourAge = 27;
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
EventHeader()
ImagePlaceholder().layoutPriority(-1) // added
.frame( minHeight: 100)
Text(makeDescription())
//Text(makeDescription()).layoutPriority(1) // removed
// Documentation
https://developer.apple.com/documentation/os/logging
https://www.avanderlee.com/debugging/oslog-unified-logging/
// Don't forget the open console actions for info and debug
// Filter with subsystem and category
// subsystem: BundleId
// Category: static
// Handy extension
@olgusirman
olgusirman / updateBuildNumberAndPushTag.sh
Last active April 25, 2020 22:03
Gets latest tag, increment build number, set a commit with this tag and push
#!/bin/bash
echo "Please set an input your tag description, ticket number etc."
read TAG_DESCRIPTION
# get latest tag number
VERSION=`git describe --abbrev=0 --tags`
echo "CURRENT VERSION => $VERSION"
#replace . with space so can split into an array
@olgusirman
olgusirman / updateVersionNumberAndPushTag.sh
Last active April 25, 2020 22:03
Gets latest tag, increment build number and version number, set a commit with this tag and push
#!/bin/bash
# Get Tags Latest number, increment and set build and version number
echo "Please set an input your tag description, ticket number etc."
read TAG_DESCRIPTION
# get latest tag number
VERSION=`git describe --abbrev=0 --tags`
echo "CURRENT VERSION => $VERSION"