Skip to content

Instantly share code, notes, and snippets.

View xhit's full-sized avatar

Santiago De la Cruz xhit

View GitHub Profile
@xhit
xhit / v2.0.0.md
Last active September 20, 2019 23:54
Examples go-simple-mail

Usage

package main

import (
	"github.com/xhit/go-simple-mail"
	"log"
)
@xhit
xhit / reader.go
Last active June 26, 2024 13:48
Golang read csv with custom enclosure (modified reader.go in Go 1.13.5)
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package csv reads and writes comma-separated values (CSV) files.
// There are many kinds of CSV files; this package supports the format
// described in RFC 4180.
//
// A csv file contains zero or more records of one or more fields per record.
// Each record is separated by the newline character. The final record may
@xhit
xhit / parseduration.go
Created August 8, 2020 05:59
Golang ParseDuration with days and weeks
package main
import (
"errors"
"fmt"
"time"
)
func main() {
dur, _ := ParseDuration("1.000000001s")
@xhit
xhit / uuidv7.php
Last active June 26, 2024 23:28
UUIDv7 in PHP
<?php
// uuidv7 see https://www.rfc-editor.org/rfc/rfc9562#name-uuid-version-7
function uuidv7() {
// current timestamp in ms
$timestamp = intval(microtime(true) * 1000);
return sprintf(
'%02x%02x%02x%02x-%02x%02x-%04x-%04x-%012x',
// first 48 bits are timestamp based