Skip to content

Instantly share code, notes, and snippets.

View iporsut's full-sized avatar
🏠
Working from home

Weerasak Chongnguluam iporsut

🏠
Working from home
View GitHub Profile
@iporsut
iporsut / gist:9d29b57cd5732a59a166dfd2406b45c7
Last active March 15, 2019 02:39
Install Docker in Ubuntu on VirtualBox
VirtualBox
https://www.virtualbox.org/wiki/Downloads
Vagrant
https://www.vagrantup.com/downloads.html
> mkdir ubuntuvm
> cd ubuntuvm
> vagrant init ubuntu/bionic64
> vagrant up
@iporsut
iporsut / go.mod
Last active March 12, 2019 09:18
JWT public/private key
module gingwt
go 1.12
require (
github.com/appleboy/gin-jwt ca1084e5d5a2912d883a425834a3b642c62dc9cd
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 // indirect
github.com/gin-gonic/gin v1.3.0
github.com/golang/protobuf v1.3.0 // indirect
github.com/mattn/go-isatty v0.0.6 // indirect
@iporsut
iporsut / todo.txt
Last active March 8, 2019 08:49
TODO API
GET /todos
GET /todos/:id
POST /todos
PUT /todos/:id
DETELE /todos/:id
// https://docs.mongodb.com/manual/reference/operator/update-array/
POST /todos/:id/tasks
{
"desc": "Do 1",
@iporsut
iporsut / exercise-testing.md
Created November 16, 2018 09:40
Exercise testing

Exercise: Stats

  • ให้สร้างฟังก์ชันที่หาค่าน้อยสุดใน slice ของตัวเลข
  • ให้สร้างฟังก์ชันที่หาค่ามากสุดใน slice ของตัวเลข
  • ให้สร้างฟังก์ชันที่หาค่าเฉลี่ยของตัวเลขที่อยู่ใน slice
  • สร้างฟังก์ชันเดียวที่ได้ค่าทั้งหมดนั้นกลับออกมาเป็น struct
func Min(nums []float64) float64
func Max(nums []float64) float64
func Average(nums []float64) float64
type Report struct {
@iporsut
iporsut / ep1.go
Last active September 23, 2018 08:17
Hangman The Series
package main
import (
"fmt"
)
func hangman(secretWord string, letters []rune) bool {
secrets := []rune(secretWord)
for _, s := range secrets {
var found bool
@iporsut
iporsut / vscode_setting.js
Last active July 23, 2018 15:38
Visual Studio Code user settings
{
// Controls the font size in pixels.
"editor.fontSize": 17,
// Controls the font family.
"editor.fontFamily": "Go Mono, Menlo, Monaco, 'Courier New', monospace",
// The number of spaces a tab is equal to. This setting is overridden based on the file contents when `editor.detectIndentation` is on.
"editor.tabSize": 8,
@iporsut
iporsut / advance_go_course_outline.md
Last active August 29, 2018 02:47
Advance Go Course Outline

Advance Go programming

เป้าหมาย

คอร์สนี้ผู้เรียนจะได้ฝึกทำ practical software ด้วย Go มากขึ้นโดยจะเน้นไปที่ Backend API , รูปแบบการวางโครงสร้างของ Application ที่ซับซ้อนมากขึ้น และ การใช้เครื่องมือช่วยต่างๆในการพัฒนาโปรแกรมด้วยภาษา Go

ระยะเวลา

ระยะเวลา 2 วัน วันละประมาณ 7-8 ชั่วโมง

จำนวนผู้เรียนต่อรอบ

5 คนขึ้นไปแต่ไม่เกิน 10 คน

@iporsut
iporsut / basic_go_course_outline.md
Last active November 9, 2018 06:32
Basic Go Course Outline

Basic Go programming

เป้าหมาย

เป้าหมายของคอร์สนี้คือให้ผู้เรียนได้เข้าใจคอนเซ็ปพื้นฐานของภาษา Go และทดลองใช้ standard package เพื่อพัฒนา system software เช่น Web application หรือ RESTful service และเขียน unittest เบื้องต้นได้

ระยะเวลา

ระยะเวลา 2 วัน วันละประมาณ 7-8 ชั่วโมง

จำนวนผู้เรียนต่อรอบ

5 คนขึ้นไปแต่ไม่เกิน 20 คน

@iporsut
iporsut / fizzbuzz.hs
Created June 11, 2018 00:24
QuickCheck FizzBuzz
{-# LANGUAGE TemplateHaskell #-}
import Test.QuickCheck
prop_fizz = forAll inputs (\n -> fizz n == "Fizz")
where
inputs = must [ divisibleBy 3
, not . divisibleBy 5
]
package main
import (
"database/sql"
"fmt"
"io"
"log"
"net/http"
)