This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.alarmmanager; | |
import android.app.Activity; | |
import android.app.AlarmManager; | |
import android.app.PendingIntent; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.os.Bundle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" | |
"unicode" | |
"golang.org/x/text/transform" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class AppDelegate { | |
var window: UIWindow? | |
} | |
//Chain of Resposability: Handler | |
protocol ErrorHandler { | |
var errorHandlerSuccessor: ErrorHandler? {get} | |
func handleError(error: Error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Results+Rx.swift | |
// | |
// Make Realm auto-updating Results observable. Works with Realm 0.98 and later, RxSwift 2.1.0 and later. | |
// | |
// Created by Florent Pillet on 12/02/16. | |
// Copyright (c) 2016 Florent Pillet. All rights reserved. | |
// | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimplePickerView : UIPickerView { | |
class SimplePickerViewModel : NSObject, UIPickerViewDelegate, UIPickerViewDataSource { | |
var titles: [String] | |
var selectionHandler: ((pickerView: UIPickerView, row: Int, title: String) -> ())? | |
init(titles: [String], selectionHandler: ((pickerView: UIPickerView, row: Int, title: String) -> ())? = nil) { | |
self.titles = titles | |
self.selectionHandler = selectionHandler | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function removerAcentos( $string ) { | |
$mapaAcentosHex = array( | |
'a'=> '/[\xE0-\xE6]/', | |
'A'=> '/[\xE0-\xE6]/', | |
'e'=> '/[\xE8-\xEB]/', | |
'E'=> '/[\xE8-\xEB]/', | |
'i'=> '/[\xEC-\xEF]/', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func run(command: String, wait: Bool = true) -> String? { | |
let task = Process() | |
task.launchPath = "/bin/bash" | |
task.arguments = ["-c", command] | |
let pipe = Pipe() | |
task.standardOutput = pipe | |
task.launch() | |
guard wait else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy var v1:UIView = { | |
let v = UIView() | |
v.backgroundColor = .blueColor() | |
return v | |
}() | |
lazy var v2:UIView = { | |
let v = UIView() | |
v.backgroundColor = .blueColor() | |
return v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
extension UIControl { | |
func listen(_ action: @escaping () -> (), for controlEvents: UIControlEvents) -> AnyObject { | |
let sleeve = ClosureSleeve(attachTo: self, closure: action, controlEvents: controlEvents) | |
addTarget(sleeve, action: #selector(ClosureSleeve.invoke), for: controlEvents) | |
return sleeve | |
} | |
OlderNewer