Skip to content

Instantly share code, notes, and snippets.

View sonyarianto's full-sized avatar
🙏
Keep learning, stay relevant, relevancy increases value.

Sony AK sonyarianto

🙏
Keep learning, stay relevant, relevancy increases value.
View GitHub Profile
@sonyarianto
sonyarianto / index3.html
Created December 7, 2018 07:44
Sample of index3.html
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>My Title</title>
</head>
<body>
My name is {{.Name}} and my age is {{.Age}}.
</body>
</html>
@sonyarianto
sonyarianto / index2.html
Created December 7, 2018 04:00
Sample of index2.html
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>My Title</title>
</head>
<body>
My name is {{.}}.
</body>
</html>
@sonyarianto
sonyarianto / index.html
Created December 5, 2018 09:45
Sample of index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>My Title</title>
</head>
<body>
This is my website body!
</body>
</html>
@sonyarianto
sonyarianto / web-routing-goji-mux.go
Created December 5, 2018 09:43
Web routing with Goji mux
package main
import (
"fmt"
"goji.io"
"goji.io/pat"
"net/http"
)
func home(w http.ResponseWriter, r *http.Request) {
@sonyarianto
sonyarianto / web-routing-gorilla-mux.go
Created December 5, 2018 09:41
Web routing with gorilla/mux
package main
import (
"fmt"
"github.com/gorilla/mux"
"log"
"net/http"
)
func Home(w http.ResponseWriter, r *http.Request) {
@sonyarianto
sonyarianto / web-routing-default-mux.go
Created December 5, 2018 09:40
Web routing with default mux (net/http)
package main
import (
"io"
"log"
"net/http"
)
func serviceDefault(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
@sonyarianto
sonyarianto / load-a-text-file.go
Created December 5, 2018 09:39
Load a text file
package main
import (
"fmt"
"io/ioutil"
"log"
)
func main() {
fileContent, err := ioutil.ReadFile("my-text-file.txt")
@sonyarianto
sonyarianto / my-text-file.txt
Created December 5, 2018 09:38
Sample of text file
Dear Go designers,
I love using Go because it's easy to use and easy to deploy.
I hope Go will become very popular language in the future.
Best regards,
Sony AK
sony@sony-ak.com
@sonyarianto
sonyarianto / hello-world-on-web-2.go
Created December 5, 2018 09:37
Hello World on web 2
package main
import (
"io"
"log"
"net/http"
)
func Default(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
@sonyarianto
sonyarianto / hello-world-on-web.go
Created December 5, 2018 09:36
Hello World on web
package main
import (
"io"
"log"
"net/http"
)
func Default(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {