Skip to content

Instantly share code, notes, and snippets.

@stevenferrer
stevenferrer / gomock.md
Created March 2, 2023 06:09 — forked from thiagozs/gomock.md
Tutorial gomock

08/16/17 by  Sergey Grebenshchikov

No Comments

This is a quick tutorial on how to test code using the GoMock mocking library and the standard library testing package testing.

GoMock is a mock framework for Go. It enjoys a somewhat official status as part of the github.com/golang organization, integrates well with the built-in testing package, and provides a flexible expectation API.

@stevenferrer
stevenferrer / main_1.go
Created May 5, 2022 10:22 — 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)
@stevenferrer
stevenferrer / router.go
Created November 19, 2021 14:58 — forked from Hunsin/router.go
The package wraps julienschmidt's httprouter, making it support functions such as middlewares, sub/group routing with same prefix. Written in Go (Golang).
package router
import (
"context"
"net/http"
gpath "path"
"github.com/julienschmidt/httprouter"
)
/* Scrollbar */
/* From Quassel Wiki: http://sprunge.us/iZGB */
QScrollBar {
background: #131313;
margin: 0;
}
QScrollBar:hover {
/* Optional: Subtle accent of scrolling area on hover */
background: #161616; /* base +2 */
}
@stevenferrer
stevenferrer / http-proxy.go
Created September 18, 2019 06:33 — forked from fabrizioc1/http-proxy.go
Http proxy server in Go
package main
import (
"fmt"
"io"
"log"
"net/http"
)
type HttpConnection struct {
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@stevenferrer
stevenferrer / go_decode.go
Created August 2, 2019 04:34 — forked from miguelmota/go_decode.go
Golang gob encoding and decoding example
package main
import (
"bytes"
"encoding/gob"
"fmt"
"log"
)
func main() {
@stevenferrer
stevenferrer / 01_basic.go
Created January 23, 2019 08:14 — forked from reagent/00_README.md
Custom HTTP Routing in Go
package main
import (
"io"
"log"
"net/http"
)
func main() {
@stevenferrer
stevenferrer / keycloak.html
Created July 21, 2018 22:28 — forked from thomasdarimont/keycloak.html
Keycloak JS Only public client example
<html>
<head>
<script src="http://localhost:8081/auth/js/keycloak.js" type="text/javascript">
</script>
</head>
<body>
<h1>js-demo-app</h1>