Skip to content

Instantly share code, notes, and snippets.

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

on99 on99

🏠
Working from home
View GitHub Profile
@on99
on99 / main.go
Last active June 7, 2020 08:34
package main
import (
"bufio"
"bytes"
"fmt"
"log"
"os"
"strconv"
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"sync"
@on99
on99 / demo.go
Created April 21, 2016 12:07
a for range pitfall that we have to keep in mind...
package main
import "log"
func main() {
for _, v := range []int{1, 2, 3, 4, 5} {
log.Println(&v)
}
}
@on99
on99 / demo.go
Created April 20, 2016 16:24
prove that gin context.Query() already unescape the query
package main
import (
"log"
"net/url"
"github.com/gin-gonic/gin"
)
func main() {
@on99
on99 / haha.go
Created April 20, 2016 16:21
prove that gin context.Query() already unescape the query
package main
import (
"log"
"net/url"
"github.com/gin-gonic/gin"
)
func main() {
@on99
on99 / map.go
Last active March 11, 2016 09:00
remember to use lock to make our program safe
package main
import (
"runtime"
"sync"
)
var (
lock sync.Mutex
m = map[string]bool{"haha": true}