Skip to content

Instantly share code, notes, and snippets.

View babulal107's full-sized avatar

Babulal Choudhary babulal107

View GitHub Profile
@asahasrabuddhe
asahasrabuddhe / closer.go
Last active March 22, 2019 09:14
elegant way to handle errors of deferred functions
func Close(close io.Closer) {
err := close.Close()
if err != nil {
log.Println("error when trying to close resource:", err.Error())
}
}
// example use
defer res.Close() // this gives an warning about unhandled error
@asahasrabuddhe
asahasrabuddhe / 000-default.conf
Last active March 31, 2019 08:42
Dockerize your PHP Laravel Development workflow
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@asahasrabuddhe
asahasrabuddhe / main.go
Created September 18, 2018 11:48
Go Email
package main
import (
"fmt"
"github.com/asahasrabuddhe/pigeon"
"github.com/asahasrabuddhe/pigeon/email"
"github.com/asahasrabuddhe/pigeon/smtp"
"github.com/asahasrabuddhe/pigeon/themes/default"
"github.com/asahasrabuddhe/pigeon/themes/flat"
)
@drewolson
drewolson / reflection.go
Last active November 20, 2023 09:39
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`