Skip to content

Instantly share code, notes, and snippets.

package main
import (
"encoding/json"
"log"
"net/http"
"github.com/graphql-go/graphql"
)
@birowo
birowo / main_1.go
Created October 18, 2018 07:40 — forked from pseudomuto/main_1.go
Blog Code: Clean SQL Transactions in Golang
package main
import (
"database/sql"
"log"
)
func main() {
db, err := sql.Open("VENDOR_HERE", "YOUR_DSN_HERE")
handleError(err)
@birowo
birowo / dep.md
Created September 28, 2018 05:47 — forked from subfuzion/dep.md
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

@birowo
birowo / README.TXT
Last active September 27, 2018 03:09
GOLANG: latihan kode assembly
buat file lat_asm.go :
package main
func a(b []byte) {
for c, d := range b {
/*
if d<'A' || d>'Z' {
continue
}
package main
import (
"fmt"
"os"
log "github.com/sirupsen/logrus"
)
func main() {
@birowo
birowo / introrx.md
Created September 12, 2018 02:56 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@birowo
birowo / StdInReadAll.go
Last active August 30, 2018 08:28
golang: membaca inputan user di terminal / stdin
package main
import (
"bytes"
"fmt"
"io/ioutil"
"os"
)
func main() {
@birowo
birowo / cobamgo.go
Last active August 19, 2018 23:32
golang latihan crud sederhana mongodb
package main
import (
"fmt"
"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson"
)
func FErr(err error) {
if err != nil {
@birowo
birowo / index.html
Created July 9, 2018 02:14
SuSo - the happy sudoku solver — live at https://zenmumbler.net/suso/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SuSo</title>
<style>
content {
display: flex;
justify-content: flex-start;
align-items: flex-start;
@birowo
birowo / jsonmap.v2.go
Created June 11, 2018 16:57
seperti https://gist.github.com/birowo/03889aced8ea20c422a45846f4b060a2 dengan penambahan type []struct {k string; v interface{}} untuk akses key-value secara sequential . playground: https://play.golang.org/p/ZZ5Ym8tGgOS
package main
import (
"bytes"
"strconv"
)
func fKV(rslt *bytes.Buffer, v KV) {
i := len(v)
rslt.WriteByte('{')