Skip to content

Instantly share code, notes, and snippets.

@ivanbruel
ivanbruel / MyActivity.java
Created November 23, 2015 17:50
A little permissions wrapper for Android Marshmellow with usage example
public class MainActivity extends Activity {
private Permissions mPermissions;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPermissions = Permissions.with(this);
}
@ivanbruel
ivanbruel / UIImage+UIColor
Created September 29, 2015 18:14
Animate crossfade UIColor and UIImage with SDWebImage
//
// UIImage+UIColor.swift
//
import UIKit
extension UIImage {
class func imageWithColor(color: UIColor) -> UIImage {
let rect = CGRectMake(0.0, 0.0, 1.0, 1.0)
UIGraphicsBeginImageContext(rect.size)
<activity
android:name="com.hokolinks.activity.HokoActivity"
android:alwaysRetainTaskState="true"
android:launchMode="singleTask"
android:noHistory="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<data android:scheme="<your-app-scheme>"/>
<action android:name="android.intent.action.VIEW" />
@ivanbruel
ivanbruel / Optional+Unwrap.swift
Last active August 29, 2015 14:23
Easy Swift Unwrapping
infix operator ?-> { associativity left precedence 140 }
func ?-><T>(lhs: T?, rhs: ((T)->(Void))) {
if let value = lhs {
rhs(value)
}
}
// Usage
var someOptionalVariable : Int?
@ivanbruel
ivanbruel / swift_swizzle
Created April 9, 2015 17:26
Swift Class Method Swizzle
//
// LHNetworking+Endpoint.swift
// magellan
//
// Created by Ivan Bruel on 09/04/15.
// Copyright (c) 2015 Passworks S.A. All rights reserved.
//
import Foundation
import Lighthouse