Skip to content

Instantly share code, notes, and snippets.

View LeoValentim's full-sized avatar

Leo Valentim LeoValentim

View GitHub Profile
extension Sequence {
/// Limits sequence indexes to a given maximum number
///
/// - Parameter max: maximum number of indexes
/// - Returns: return limited sequence
public func limit(_ max: Int) -> [Element] {
return self.enumerated()
.filter { $0.offset < max }
.map { $0.element }
}
#USAGE: sh clean_unused_images.sh
project_path='/Users/../../Projects/iOS/APP_IOS/' # Change to your project's path
assets_path=$project_path"Assets.xcassets" # asset's path
assets_name="${assets_path/$project_path/$(echo '')}"
printf "\e[92mGetting first images:\e[0m\n"
images=""
# Get Images from assets root directory
@LeoValentim
LeoValentim / DirectionAnimatedController.swift
Last active August 11, 2017 17:49
Direction Animated Controller
//
// DirectionAnimatedController.swift
//
// Created by Leo Valentim on 17/07/17.
//
import UIKit
enum DirectionAnimation {
case left, right, top, bottom
@LeoValentim
LeoValentim / KeyboardProtocol.swift
Last active October 19, 2017 16:39
KeyboardProtocol
//
// KeyboardProtocol.swift
//
// Created by Mac on 21/06/17.
// Copyright © 2017 Leo Valentim. All rights reserved.
//
import Foundation
import UIKit
@objc public protocol KeyboardProtocol : NSObjectProtocol {
@LeoValentim
LeoValentim / Webservice.swift
Last active July 31, 2017 14:11
Webservice swift class for HTTP requests
//
// Webservice.swift
//
// Created by Mac on 29/07/17.
// Copyright © 2017 Leo Valentim. All rights reserved.
//
import SwiftyJSON
import Foundation
@LeoValentim
LeoValentim / GoogleMapsRouteForSwift.swift
Last active August 13, 2019 12:22
Google Maps Route For Swift
//MARK:- Draw Route Betweeen two points
/**
To draw a route between to cordinates.
- origin: Source marker cordinate
- destination: destination marker cordinate
- self.googleMapsKey: API Key
*/
let origin = "-23.543293,-46.638592"