Skip to content

Instantly share code, notes, and snippets.

Avatar

Supan Adit Pratama supanadit

View GitHub Profile
@supanadit
supanadit / pom.xml
Created Jan 23, 2020
Set JDK 8 Version in Maven
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>domain.yourpackage</groupId>
<artifactId>your-artifact</artifactId>
<version>1.0.0</version>
@supanadit
supanadit / pom.xml
Last active Jan 23, 2020
Set JDK 11 Version in Maven
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>domain.yourpackage</groupId>
<artifactId>your-artifact</artifactId>
<version>1.0.0</version>
@supanadit
supanadit / GinSocketIO.go
Created Jan 4, 2020
Gin Gonic + Socket IO
View GinSocketIO.go
package main
import (
"fmt"
"github.com/gin-gonic/gin"
engineio "github.com/googollee/go-engine.io"
"github.com/googollee/go-engine.io/transport"
engineiopooling "github.com/googollee/go-engine.io/transport/polling"
socketio "github.com/googollee/go-socket.io"
"log"
View NgrokHomestead.md

If you want to make Laravel Homestead url available for public using Ngrok simply use code below

ngrok http 192.168.10.10:80 --host-header=homestead.test
@supanadit
supanadit / Tile38Golang.go
Created Oct 19, 2019
Websocket Implementation for Tile38 with Golang
View Tile38Golang.go
package main
import (
"flag"
"github.com/gorilla/websocket"
"log"
"net/url"
"os"
"os/signal"
"time"
View main.go
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/test", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "hello",
})
View Api.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Api extends CI_Controller
{
public function list_employee()
{
header('Content-Type: application/json');
$query = $this->db->get('employee');
if ($query) {
View Admin.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Admin extends CI_Controller
{
public function index()
{
$ip = $_SERVER['HTTP_HOST'];;
$arrayData = array(
View Admin.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Belajar Socket.IO</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.7 -->
<link rel="stylesheet" href="<?= base_url() ?>/assets/bootstrap/dist/css/bootstrap.min.css">
View Remove Index.php codeigniter .htaccess
<IfModule mod_rewrite.c>
Options -Indexes
RewriteEngine On
RewriteCond $1 !^(index\\.php|resources|robots\\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L,QSA]
</IfModule>