Skip to content

Instantly share code, notes, and snippets.

View luisburgos's full-sized avatar
🎯
Focusing

Luis Burgos luisburgos

🎯
Focusing
View GitHub Profile
@luisburgos
luisburgos / ActivityHelper.java
Created March 14, 2017 02:32
Collapsing toolbar with map fragment inside and view pager
/**
* Helper class which provides methods to being, redirect, start and finish activities.
*/
public class ActivityHelper {
/**
* The {@code fragment} is added to the container view with id {@code frameId}. The operation is
* performed by the {@code fragmentManager}.
*
*/
@luisburgos
luisburgos / NotificationItemDecorator.swift
Created August 11, 2017 14:51
Example of a simple model decorator
class NotificationItemDecorator {
var notification: Notification?
func with(_ notification: Notification) -> NotificationItemDecorator {
self.notification = notification
return self
}
func add(confirm: UIButton?) {
//
// APIModel.swift
// YellowPod
//
// Created by Luis Burgos on 11/25/17.
// Copyright © 2017 YellowPod. All rights reserved.
//
import Foundation
import SwiftyJSON
//
// Networking+Keys.swift
// YellowPod
//
// Created by Luis Burgos on 11/26/17.
// Copyright © 2017 YellowPod. All rights reserved.
//
import Foundation
//HERE: Define here all the keys for JSON models
//
// Networking.swift
// YellowPod
//
// Created by Luis Burgos on 11/25/17.
// Copyright © 2017 YellowPod. All rights reserved.
//
import Foundation
import SwiftyJSON
//
// RemoteDataSource.swift
// YellowPod
//
// Created by Luis Burgos on 11/24/17.
// Copyright © 2017 YellowPod. All rights reserved.
//
import Foundation
import Alamofire
import SwiftyJSON
//
// User.swift
// YellowPod
//
// Created by Luis Burgos on 12/5/17.
// Copyright © 2017 Yellowme. All rights reserved.
//
import Foundation
import SwiftyJSON
//
// UserParser.swift
// Tripstr
//
// Created by Luis Burgos on 11/24/17.
// Copyright © 2017 Tripstr. All rights reserved.
//
import Foundation
import SwiftyJSON
//
// Parser.swift
// YellowPod
//
// Created by Luis Burgos on 11/26/17.
// Copyright © 2017 YellowPod. All rights reserved.
//
import Foundation
import SwiftyJSON
@luisburgos
luisburgos / LogicExtensions.kt
Created January 10, 2018 21:17
NullValidations
/**
* Multiple variable safety definitions
*/
fun <T1: Any, T2: Any, R: Any> safeLet(p1: T1?, p2: T2?, block: (T1, T2)->R?): R? {
return if (p1 != null && p2 != null) block(p1, p2) else null
}
fun <T1: Any, T2: Any, T3: Any, R: Any> safeLet(p1: T1?, p2: T2?, p3: T3?, block: (T1, T2, T3)->R?): R? {
return if (p1 != null && p2 != null && p3 != null) block(p1, p2, p3) else null
}
fun <T1: Any, T2: Any, T3: Any, T4: Any, R: Any> safeLet(p1: T1?, p2: T2?, p3: T3?, p4: T4?, block: (T1, T2, T3, T4)->R?): R? {