Skip to content

Instantly share code, notes, and snippets.

View marvinhosea's full-sized avatar
🎯
Pin point

Marvin Collins Hosea marvinhosea

🎯
Pin point
View GitHub Profile
<?php
'AF / AFG' => 'Afghanistan',
'AL / ALB' => 'Albania',
'DZ / DZA' => 'Algeria',
'AS / ASM' => 'American Samoa',
'AD / AND' => 'Andorra',
'AO / AGO' => 'Angola',
'AI / AIA' => 'Anguilla',
'AQ / ATA' => 'Antarctica',
'AG / ATG' => 'Antigua and Barbuda',
@marvinhosea
marvinhosea / gist:34010552b3246b2dad442dff0d25804d
Created February 2, 2022 12:25
Liquibase Changelog Name Convention Using Date
#!/bin/sh
while getopts c:u: flag
do
case "${flag}" in
c) changelogname=${OPTARG};;
u) username=${OPTARG};;
esac
done
@marvinhosea
marvinhosea / go1.13 wrap.go
Created February 18, 2023 18:48
go1.13 wrap
package main
import (
"errors"
"fmt"
"log"
)
func main() {
err := errors.New("first error")
@marvinhosea
marvinhosea / Response.json
Last active February 19, 2023 08:37
Login response
{
"password": [
"password is required",
"password must have a capital letter",
"password must have a number",
"password must have a special character"
]
}
@marvinhosea
marvinhosea / main1.go
Created February 18, 2023 21:11
Main Initial
package main
import (
"errors"
"log"
"regexp"
)
var (
ErrPasswordRequired = errors.New("password is required")
@marvinhosea
marvinhosea / Main-password-validator.go
Last active February 20, 2023 08:59
Main-password-validator.go
func passwordValidator(password string) error {
var errs []error
// validates if password is empty
if password == "" {
errs = append(errs, ErrPasswordRequired)
}
// validates if password contains small(lowercase) letters
pattern1 := `[a-z]`
ok, err := regexp.MatchString(pattern1, password)
@marvinhosea
marvinhosea / Main-main.go
Last active February 20, 2023 09:05
Main.go
func main() {
password := ""
response := make(map[string]any)
var passwordErrs []string
err := passwordValidator(password)
if err != nil {
// code validation goes here
}
@marvinhosea
marvinhosea / Main.go
Last active February 20, 2023 14:55
Main
package main
import (
"encoding/json"
"errors"
"log"
"regexp"
)
var (
@marvinhosea
marvinhosea / Bogus.go
Created February 19, 2023 13:27
Bogus
package main
import (
"errors"
"fmt"
"log"
)
func main() {
err := errors.New("first error")
@marvinhosea
marvinhosea / cause.go
Last active February 20, 2023 20:06
Cause
package main
import (
"context"
"errors"
"log"
)
func main() {