Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Glynn 17twenty

View GitHub Profile
@17twenty
17twenty / statementFriendly.go
Created Sep 29, 2022
Clean and simplify a user entered name to make a Stripe 22 character friendly merchant name
View statementFriendly.go
package main
import (
"fmt"
"regexp"
"strings"
)
var re *regexp.Regexp
@17twenty
17twenty / migrate-readme.md
Last active Jun 15, 2022
How to use Migrate (incl sqlc.yaml too!)
View migrate-readme.md

Golang Migrations Made Easy

Prerequisite / Getting Started

$ go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
$ migrate -h
Usage: migrate OPTIONS COMMAND [arg...]
       migrate [ -version | -help ]
@17twenty
17twenty / shortid.go
Created Oct 27, 2021
Use base62, UUID and the birthday paradox to create shorter unique IDs.
View shortid.go
package main
import (
"encoding/hex"
"fmt"
"log"
"math"
"strconv"
"strings"
"time"
@17twenty
17twenty / basic.css
Created Jul 31, 2021
Make your navbar change color on scroll
View basic.css
.nav {
transition-duration: 1s;
}
@17twenty
17twenty / generate.go
Created Aug 14, 2020
Generate an embeddable zip file that can be included in your Golang project that auto extracts at runtime.
View generate.go
package main
import (
"fmt"
"io/ioutil"
"os"
"strings"
)
func main() {
View enumerated.go.tmpl
package {{.Package}}
import (
"database/sql/driver"
"encoding/json"
"fmt"
"strings"
)
// {{.Type}}Enum is the status code of an {{.Type}} (must be int64)
@17twenty
17twenty / SEO-Guide.md
Last active Dec 1, 2022
Creating and building an SEO strategy for your site
View SEO-Guide.md

Hey guys!

There's a TON of content out there on SEO - guides, articles, courses, videos, scams, people yelling about it on online forums, etc etc..

Most of it, however, is super impractical. If you want to start doing SEO TODAY and start getting results ASAP, you'll need to do a TON of digging to figure out what's important and what's not.

So we wanted to make everyone's lives super easy and distill our EXACT process of working w/ clients into a stupid-simple, step-by-step practical guide. And so we did. Here we are.

A bit of backstory:

@17twenty
17twenty / jsonfilter.go
Last active Jul 2, 2020
JSONFilteredByWhitelist filters an incoming JSON payload against a while list then applies the filtered payload to the destination struct.
View jsonfilter.go
package types
import (
"encoding/json"
"io"
"reflect"
"strings"
)
// JSONFilteredByWhitelist filters an incoming JSON payload against a while list,
@17twenty
17twenty / camelsnake.go
Created May 26, 2020
Snake To Camel and Camel To Snake Case In Go Golang
View camelsnake.go
package main
import (
"fmt"
"regexp"
"strings"
)
// Regex
@17twenty
17twenty / demo.go
Created May 21, 2020
Implementing Custom Marshal / Unmarshal for a custom type (and using an interface)
View demo.go
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"os"
"strconv"
)