Skip to content

Instantly share code, notes, and snippets.

View madcato's full-sized avatar
🪲
Building future bugs!!

Dani Vela madcato

🪲
Building future bugs!!
View GitHub Profile
@madcato
madcato / QRCaptureViewController.swift
Last active August 29, 2015 14:26
Capture a QR with iPhone camera.
//
// QRCaptureViewController.swift
// ScanQR
//
// Created by Daniel Vela on 06/08/15.
// Copyright (c) 2015 veladan. All rights reserved.
//
import UIKit
import AVFoundation

Keybase proof

I hereby claim:

  • I am madcato on github.
  • I am veladan (https://keybase.io/veladan) on keybase.
  • I have a public key ASARxRw_Tzj_AqmzAf6NYhaEMLfk3LH0iZl6s-8cNR96Jgo

To claim this, I am signing this object:

@madcato
madcato / Rakefile
Created December 26, 2017 12:18 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@madcato
madcato / InstallManager.swift
Last active March 8, 2018 09:31
This class allows to copy bundle files to a destination path (documents directory)
//
// InstallManager.swift
// OSFramework
//
// Created by Daniel Vela on 22/01/2018.
// Copyright © 2018 Daniel Vela. All rights reserved.
//
import Foundation
//
// QRCaptureView.swift
// QRHelper
//
// Created by Daniel Vela on 05/12/2017.
// Copyright © 2017 veladan. All rights reserved.
//
// Doc: https://www.appcoda.com/barcode-reader-swift/
import AVFoundation
@madcato
madcato / QRHelperView.swift
Created March 12, 2018 08:13
Show a QR in a view
//
// QRHelperViewController.swift
// QRHelper
//
// Created by Daniel Vela on 05/12/2017.
// Copyright © 2017 veladan. All rights reserved.
//
// Doc: https://www.unicorn-it.de/developing-reusable-views-in-a-swift-framework/
// Doc: https://www.appcoda.com/qr-code-generator-tutorial/
@madcato
madcato / KeychainPasswordItem.swift
Created March 12, 2018 08:15
Store a password into the iOS keychain securely
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
A struct for accessing generic password keychain items.
*/
import Foundation
@madcato
madcato / Net.swift
Created March 12, 2018 08:16
Base classes to develop a network API service client. Use as a template.
class HttpRequest {
func post() {
}
func get() {
}
}
class HttpAPI {
var request: HttpRequest
@madcato
madcato / EoloSender.swift
Created March 12, 2018 08:21
EoloSender is a class to send POST to a http server. If the request fails, it's stored. It tries to resend the request every 15 seconds. Methods must be called from applicationDidBecomeActive and applicationWillResignActive, see the code.
//
// EoloSender.swift
// OSFramework
//
// Created by Daniel Vela on 13/02/17.
// Copyright © 2016 Daniel Vela. All rights reserved.
//
import Foundation
@madcato
madcato / SimplePersistence.swift
Last active March 12, 2018 08:24
Simple persistence for properties using de UserDefaults class in iOS. Can be extended with new providers.
//
// SimplePersistence.swift
// OSFramework
//
// Created by Daniel Vela on 06/02/2017.
// Copyright © 2017 Daniel Vela. All rights reserved.
//
import Foundation