Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

antoniodipinto antoniodipinto

🏠
Working from home
View GitHub Profile
View websocket_chat_example_ikisocket.go
package main
import (
"encoding/json"
"fmt"
ikisocket "github.com/antoniodipinto/ikisocket"
"github.com/gofiber/fiber"
)
// Basic chat message object
View global_socket_listeners_ikistats.go
// Multiple event handling supported
ikisocket.On(ikisocket.EventConnect, func(ep *ikisocket.EventPayload) {
fmt.Println("fired connect 1")
})
ikisocket.On(ikisocket.EventConnect, func(ep *ikisocket.EventPayload) {
fmt.Println("fired connect 2")
})
View basic_fiber_wesocket.go
package main
import
"github.com/gofiber/fiber"
"github.com/gofiber/websocket"
)
func main() {
app := fiber.New()
@antoniodipinto
antoniodipinto / Input_Json.php
Created Jul 6, 2019
A simple class fo CodeIgniter that helps to receive JSON format data
View Input_Json.php
<?php
/**
* Author: Antonio Di Pinto
* Email: adp19911229@gmail.com
*
* @description: A simple class fo CodeIgniter that helps to receive JSON format data
*/
class Input_Json extends CI_Input
{
@antoniodipinto
antoniodipinto / index.php
Created Aug 30, 2016
Routing main page PHP
View index.php
<?php
// Importo le classi del framework
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
// Richiamo il loader del framework
require 'vendor/autoload.php';
// Creo una nuova istanza della classe App
@antoniodipinto
antoniodipinto / distance_by_google.sql
Created Aug 30, 2016
This query will return the distance between two points
View distance_by_google.sql
#This query will return the distance between two points
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) )
AS distance
FROM markers
HAVING distance < 25
ORDER BY distance LIMIT 0 , 20;
@antoniodipinto
antoniodipinto / distance.sql
Created Aug 30, 2016
This query return the distance between two cordinates
View distance.sql
#This query return the distance between two cordinates
SELECT *,
(((acos(sin((LATITUDE_VALUE*pi()/180)) * sin(('nome_colonna_latitudine'*pi()/180))+cos((LATITUDE_VALUE*pi()/180)) * cos(('nome_colonna_latitudine'*pi()/180)) * cos(((LONGITUDE_VALUE- 'nome_colonna_longitudine'e)*pi()/180))))*180/pi())*60*1.1515*1.609344)
as distance
FROM coordinates_table
ORDER BY distance ASC;
You can’t perform that action at this time.