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 / crypt.php
Last active August 29, 2015 14:11
Login with PHP using crypt()
<?php
define($hash_token,"$%&123");//$hash_token is the key to use in crypt()
public function crypt_password($password){
return $encripted_password = crypt($password,$hash_token);
}
public function login($user_name, $dumb_password){
@zafe
zafe / palindrome.js
Last active August 29, 2015 14:19
palindrome() function
function ispalindrome(){
var palindrome = true;
var text = "arra";
var array = text.toUpperCase();
array = array.split(" ");
array = array.join("");
for(var i in array)
{
@zafe
zafe / template.json
Created May 1, 2015 06:48
json bus-time template
{
{
"origin": "SMT",
"destiny": "FLO",
"days": ["L","M","X","J","V"],
"timetable":
[
{
"time":"05:00",
"branch":"ALD"
@zafe
zafe / bus.json
Last active August 29, 2015 14:20
{
"buses":[
{
"origin":"La Florida",
"destiny":"Delfin Gallo",
"time":"05:30"
},
{
"origin":"Los Ralos",
"destiny":"Ranchillos",
@zafe
zafe / gist:2351bf6b9525a1655cda
Created June 3, 2015 19:18
Write a file in android
public static void write (String filename,Context c,String string) throws IOException{
try {
FileOutputStream fos = c.openFileOutput(filename, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@zafe
zafe / FileWriterExample.java
Last active August 29, 2015 14:22
Write a file in android using FileWriter
package com.paad.comparison;
import java.io.FileOutputStream;
import java.io.FileWriter;
import android.app.Activity;
import android.os.Bundle;
public class ComparisonOfControlCreationActivity extends Activity {
@Override
@zafe
zafe / tecnomate.cpp
Last active September 17, 2015 00:14
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
int main(){
@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$$
@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 {
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