Skip to content

Instantly share code, notes, and snippets.

View richimf's full-sized avatar
:octocat:
Coding...

Ricardo Montesinos richimf

:octocat:
Coding...
View GitHub Profile
@richimf
richimf / Github_action.yml
Last active January 29, 2021 18:25
Pull Request format regex
# '^(?:\[IMPROVEMENT\]|\[FEATURE\]|\[BUGFIX\])\[([A-Z])+\-(\d+)\]\s(\w){1,}(\w|\s|\-){1,}$'
# Github action for Jira ticket verification
name: JIRA Validation
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
jobs:
@richimf
richimf / NavigationStack_AppDelegate_SceneDelegate.swift
Created August 13, 2020 15:16
Add navigation Stack programatically Swift
// APPDELEGATE:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
@richimf
richimf / propWrapper.swift
Created August 2, 2020 23:28
Property Wrapper
@propertyWrapper struct WhiteSpacesTrimmed {
var projectedValue: String
var wrappedValue: String {
didSet {
self.projectedValue = wrappedValue
wrappedValue = wrappedValue.trimmingCharacters(in: .whitespaces)
}
}
@richimf
richimf / Load_ViewController_from_AppDelegate.swift
Last active August 13, 2020 15:06
Using Storyboard programmatically as main storyboard
/**
AppDelegate.swift
In Project settings set the "Main Interface" text field to empty.
With the Interface Builder implementation,
the app launches the initial view controller of the storyboard set in the target’s Main Interface.
To do something similar in code, you need to take a different approach.
Open AppDelegate.swift and replace the code inside application(_:didFinishLaunchingWithOptions:) with the following:”
import UIKit
class CustomView: UIView {
//Override the init() constructor so that you can call the function loadView()
override init(frame: CGRect) {
super.init(frame: frame)
loadView()
}
@richimf
richimf / HomeCustomLayout.swift
Created March 24, 2020 15:14
CollectionView Custom Layout
import UIKit
enum CollectionDisplay {
case list
case twoColumns
}
class HomeCustomLayout: c {
@richimf
richimf / gist:ad5b3b6b344aa45e6ac2c8ba487a4f27
Created March 3, 2020 19:50
How to Pod specific commit
pod 'Auth0', :git => 'https://github.com/auth0/Auth0.swift.git', :commit => 'e399d67a57b80879947682807c20419bc8af9dad'
@richimf
richimf / rx.swift
Created February 20, 2020 00:15
RxSwift Cheat Sheet
//
//let episodeV = "episodeV"
//
//example(of: "Creating observables") {
// let mostPopular: Observable<String> = Observable<String>.just(episodeV)
//}
import RxSwift
// MARK: OBSERVABLES
/**
@richimf
richimf / data.json
Last active December 23, 2019 23:00
JSON sesion 6 reto 3
{
"animals": [
{
"id": 1,
"name": "Cat",
"type": "cat",
"weight": 23,
"area": ["home", "street"],
"can_climb_trees": true,
"competence": [
@richimf
richimf / albums.json
Created December 13, 2019 19:02
albums json
[
{
"album": "Dark side of the moon",
"year": "1927",
"cover": "https://upload.wikimedia.org/wikipedia/en/3/3b/Dark_Side_of_the_Moon.png",
"genre": "Pop"
},
{
"album": "Love letters",
"year": "2014",