Skip to content

Instantly share code, notes, and snippets.

View loucimj's full-sized avatar

Javier Loucim loucimj

  • Vicente López, Buenos Aires, Argentina.
View GitHub Profile
import Unbox
import Foundation
extension Unboxable {
func safeUnbox(unboxer: Unboxer,key :String )->String{
do{
return try unboxer.unbox(key: key) as String
}catch{
return ""
@loucimj
loucimj / regex.playground
Last active July 26, 2017 12:04
search for mention with dots in the middle
content//: Playground - noun: a place where people can play
import UIKit
import Foundation
var str = "Hello, @playground.something more"
//(?<=\\s|^|\\b)(?:[-'.%$#&/]\\b|\\b[-'.%$#&/]|[A-Za-z0-9]|\\([A-Za-z0-9]+\\))+(?=\\s|$|\\b)
let range = NSMakeRange(0, str.characters.count)
var regex = try! NSRegularExpression(pattern: "@(?<=\\s|^|\\b)(?:[-'.%$#&/]\\b|\\b[-'.%$#&/]|[A-Za-z0-9]|\\([A-Za-z0-9]+\\))+(?=\\s|$|\\b)", options: .caseInsensitive)
@loucimj
loucimj / NSExtensionAttributes for image
Last active July 14, 2017 23:20
Description of gist
content <key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<string>SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
@loucimj
loucimj / DebugPrint.swift
Created October 23, 2016 00:04
Friendlier and safer print for debug console
//
// DebugPrint.swift
//
// Created by Javier Loucim on 10/22/16.
// Copyright © 2016 Javier Loucim. All rights reserved.
//
import Foundation
func print(_ message:String , separator: String = " ", terminator: String = "\n", functionName: String = #function, fileName: String = #file, lineNumber: Int = #line) {