Skip to content

Instantly share code, notes, and snippets.

Carlos Umanzor cumanzor

  • Renovatio Cloud Solutions
  • Costa rica
Block or report user

Report or block cumanzor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
cumanzor / alert.swift
Created Dec 5, 2018
[Show simple UIAlerts from any VC] #ios #swift
View alert.swift
extension UIViewController {
func showAlert(withTitle title: String, message : String, withActions actions:[UIAlertAction] = [], withCompletion c:(()->())?=nil) {
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
if actions.isEmpty{ // default ok action
let defaultAction = UIAlertAction(title: "Ok", style: .default)
for action in actions{
cumanzor / logAllocation.swift
Created Nov 16, 2018
[Manually chasing memory leaks] #swift
View logAllocation.swift
// can be made dry by adding a alloc/dealloc parameter
// add the DEBUGALLOC flag to Active Compilation Conditions -> Debug and use it only when necessary.
// note that you should be using Instruments for this, but this helps to catch issues in real time when running the app, and I gnenerally don't recommend following this approach for several reasons.
func LogDealloc<T>(from caller:T, filename: String = #file, line: Int = #line, funcname: String = #function){
let file = ("\(filename)" as NSString).lastPathComponent as String
let objName = String(describing: type(of: caller))
cumanzor / customError.swift
Created Dec 16, 2017
localizable error types
View customError.swift
// avoid the whole switch error type set description pattern we were using before (unless custom actions need to be attached or something)
// see:
import Foundation
public enum customError:Error{
cumanzor / getfontfamily.txt
Last active Jun 13, 2019
get ios font family valid names #ios #lldb #debug
View getfontfamily.txt
In the lldb cli:
po [UIFont fontNamesForFamilyName:@"Avenir"]
<__NSArrayM 0x608000247ec0>(
cumanzor / UITableViewTransparentBg.swift
Last active Sep 28, 2018
UITableView transparent background #ios #swift #uikit
View UITableViewTransparentBg.swift
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomCell", for: indexPath)
cell.backgroundColor = .clear
cell.backgroundView = UIView()
cell.selectedBackgroundView = UIView()
return cell
View steppedSlider.swift
let step: Float = 50;
// extra slider initialization. the IBAction func below points to the UISlider we are using.
@IBAction func onStrengthChange(sender: UISlider) {
let roundedValue = round(sender.value/step) * step
sender.value = roundedValue
View koranAddresses.js
* Attempts to parse the string into a SK address.
* @returns An object of the form {province, city, street, zip}
function parseAddress(string) {
var address = {};
address.extra = [];
You can’t perform that action at this time.