Skip to content

Instantly share code, notes, and snippets.

View RodolfoAntonici's full-sized avatar

Rodolfo Antonici RodolfoAntonici

  • WOM
  • Uberlândia - MG, Brazil
View GitHub Profile
//
// Uber.swift
//
// Created by Kirby Shabaga on 9/9/14.
// Modified by Rodolfo Antonici on 14/6/15 at GetIn.
// Copyright (c) 2014 Worxly. All rights reserved.
//
//
import CoreLocation
//
// EasyFont.swift
//
// Created by Rodolfo Antonici on 7/12/15.
// Copyright © 2015 Rodolfo Antonici. All rights reserved.
//
/* Basicaly a font class that wraps the fonts weights and translate it to an Enum with a printable value and complements it with and San Francisco font class*/
/* To download the SF fonts go to: https://developer.apple.com/fonts/ */
import UIKit
@RodolfoAntonici
RodolfoAntonici / NSUserDefaultsExtension
Last active August 18, 2016 20:36
A simple NSUserDefaults extension to input default values from Settings Bundle
//
// NSUserDefaultsExtension.swift
// Settings
//
// Created by Rodolfo Antonici on 18/08/16.
// Copyright © 2016 Rodolfo Antonici. All rights reserved.
//
import Foundation
//
// DateFormatTransform.swift
//
// Created by Rodolfo Antonici on 29/11/16.
// No copyright, just use it as it's.
// ObjectMapper version 2.2
//
// A simple class using the TransformType protocol of ObjectMapper to convert Date String into a NSDate object
import Foundation
//
// InputAccessoryView.swift
//
// Created by Rodolfo Antonici on 23/08/16.
// Copyright © 2016 RAntonici. All rights reserved.
//
import UIKit
class InputAccessoryView: UIView {
@RodolfoAntonici
RodolfoAntonici / UIScrollViewExtension.swift
Last active December 12, 2018 17:07
Implement keyboard avoidance on any UIScrollView
// Created by Rodolfo Antonici on 12/12/18.
// 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:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
import UIKit
extension Array {
func insertionIndexOf(elem: Element, isOrderedBefore: (Element, Element) -> Bool) -> Int {
var lo = 0
var hi = self.count - 1
while lo <= hi {
let mid = (lo + hi)/2
if isOrderedBefore(self[mid], elem) {
lo = mid + 1
//Based on: https://github.com/nortthon/CPF-CNPJ-Swift
func generateCPF() -> String {
var cpf = [0,0,0,0,0,0,0,0,0,0,0]
var firstVerification = 0
var secondVerification = 0
for i in 0...8 {
cpf[i] = (Int)(arc4random_uniform(9))
//
// MoyaProviderCodableExtension.swift
//
//
// Created by Rodolfo Antonici on 22/09/17.
// Copyright (c) 2017 Rodolfo Antonici (https://marcosantadev.com)
//
// 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
@RodolfoAntonici
RodolfoAntonici / CABasicAnimationExtension.swift
Last active December 13, 2017 18:34
A enum of CABasicAnimation key paths to be really easy to use
//
// Created by Rodolfo Antonici on 13/12/17.
// This software is provided by Rodolfo Antonici on an "AS IS" basis.
//
extension CABasicAnimation {
convenience init(keyPath: KeyPath) {
self.init(keyPath: keyPath.rawValue)
}