Skip to content

Instantly share code, notes, and snippets.

@atultw
atultw / main.go
Created June 11, 2021 02:11
go ternary
func cond(expr bool, yes interface{}, no interface{}) interface{} {
if expr {
return yes
} else {
return no
}
}
@atultw
atultw / golang_auth0_struct.go
Created May 11, 2021 00:22
golang struct type for auth0 jwt
type Auth0Token struct {
Iss string `json:"iss"`
Sub string `json:"sub"`
Aud string `json:"aud"`
Exp int `json:"exp"`
Iat int `json:"iat"`
Name string `json:"name"`
GivenName string `json:"given_name"`
FamilyName string `json:"family_name"`
Gender string `json:"gender"`
@atultw
atultw / test.js
Created March 15, 2021 02:32
Sequelize Many to Many
// sqlconnection is sequelize, connected properly.
class Post extends Model {
}
Post.init({
name: DataTypes.STRING,
description: DataTypes.STRING
}, {
sequelize: sqlconnection,