Skip to content

Instantly share code, notes, and snippets.

View zafe's full-sized avatar
💭
Esslingen, Deutschland 🇩🇪

Fernando Zafe zafe

💭
Esslingen, Deutschland 🇩🇪
View GitHub Profile
@zafe
zafe / CBUValidator.swift
Created August 23, 2023 00:37
CBU Validator
//
// CBUValidator.swift
// CBU Scanner
//
// Created by Fernando Zafe on 21/08/2023.
//
import Foundation
class CBUValidator {
func cropImage(using image: UIImage, in rectangle: CGRectMake ) -> UIImage {
//Note: CGRect CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height)
let cgImage = CGImageCreateWithImageInRect(image.CGImage, rectangle)
let croppedImage: UIImage = UIImage(CGImage: cgImage!)
return croppedImage
}
public class ViewModel : ViewModelBase
{
public ICommand ChangeNameCommand { get; }
...
}
public class DelegateCommand : ICommand
{
private readonly Action<object> _executeAction;
public abstract class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetProperty<T>(ref T field, T newValue, [CallerMemberName]string propertyName = null)
{
if(!EqualityComparer<T>.Default.Equals(field, newValue))
{
field = newValue;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
@zafe
zafe / Matrices.cpp
Created March 19, 2020 16:50
Ejercicio con matrices y funciones en C++
#include <iostream>
using namespace std;
float promedio();
int main()
{
cout<< "El promedio es " << promedio();
@zafe
zafe / ocr2voice.py
Created November 21, 2018 07:58
OCR to voice
#by PradiptaSaha999
import tesseract
import cv2
import cv2.cv as cv
import numpy as np
import pyttsx
engine = pyttsx.init()
engine.setProperty('rate', 100)
package application.view.sueldo.cruds;
import application.model.info.CategoriaEmpleado;
import application.model.info.Empleado;
import application.model.sueldo.ConceptoSueldo;
import application.repository.info.CategoriaEmpleadoRepository;
import application.repository.sueldo.ConceptoSueldoRepository;
import application.repository.info.EmpleadoRepository;
import application.view.sueldo.EmpleadoALiquidar;
import javafx.collections.FXCollections;
SELECT
CONCEPTO_SUELDO.idCodigoConcepto,
CONCEPTO_SUELDO.descripcion,
CONCEPTO_SUELDO.cantidad,
CONCEPTO_SUELDO.tipo_concepto
FROM
CONCEPTO_SUELDO
INNER JOIN
TIPO_LIQUIDACION ON TIPO_LIQUIDACION.CONCEPTO_SUELDO_idCodigoConcepto = CONCEPTO_SUELDO.idCodigoConcepto
INNER JOIN
@zafe
zafe / AppDelegate.swift
Created May 1, 2017 11:13
AppDelegate Facebook Login for SWIFT 3
import UIKit
import FBSDKCoreKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
@zafe
zafe / DISTANCE.SQL
Created March 16, 2017 05:08
MySQL function to determine the distance between two points considering Earth's spherical surface.
DELIMITER $$
-- Returns value in Km (Kilometers)
CREATE FUNCTION distance_points (lat1 FLOAT, lng1 FLOAT, lat2 FLOAT, lng2 FLOAT)
RETURNS FLOAT
DETERMINISTIC
BEGIN
RETURN (acos(sin(radians(lat1)) * sin(radians(lat2)) +
cos(radians(lat1)) * cos(radians(lat2)) *
cos(radians(lng1) - radians(lng2))) * 6371);
END$$