Skip to content

Instantly share code, notes, and snippets.

View jcdan3's full-sized avatar
💭
I may be slow to respond.

JC Dansereau jcdan3

💭
I may be slow to respond.
  • Hortau
  • Quebec, QC
  • 02:19 (UTC -04:00)
View GitHub Profile
package notifier
import "fmt"
type notifier struct {
name *string
id int
counter int
}
package notifier
import "fmt"
type notifier struct {
name string
id int
counter int
}
@jcdan3
jcdan3 / formatted_code.go
Created February 14, 2022 19:31
formatted code
package notifier
import "fmt"
type notifier struct {
name string
id int
}
func (n *notifier) notify() {
@jcdan3
jcdan3 / non_formatted.go
Last active February 14, 2022 19:31
Go fmt
package notifier
import "fmt"
type notifier struct {
name string
id int
}
func Test_intInSlice(t *testing.T) {
type args struct {
a int
list []int
}
tests := []struct {
name string
args args
want bool
}{
@jcdan3
jcdan3 / intInSlice_test.go
Created February 4, 2022 11:49
generated test
package intIntSlice
import "testing"
func Test_intInSlice(t *testing.T) {
type args struct {
a int
list []int
}
tests := []struct {
package intIntSlice
func intInSlice(a int, list []int) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
}
@jcdan3
jcdan3 / autogenerated_struct.go
Created January 15, 2022 18:49
Auto-generated holidays struct
type Holiday []struct {
Date string `json:"date"`
LocalName string `json:"localName"`
Name string `json:"name"`
CountryCode string `json:"countryCode"`
Fixed bool `json:"fixed"`
Global bool `json:"global"`
Counties interface{} `json:"counties"`
LaunchYear interface{} `json:"launchYear"`
@jcdan3
jcdan3 / payload.json
Created January 15, 2022 18:33
payload.json
[
{
"date": "2020-01-01",
"localName": "New Year's Day",
"name": "New Year's Day",
"countryCode": "US",
"fixed": false,
"global": true,
"counties": null,
"launchYear": null,
@jcdan3
jcdan3 / main.go
Created January 15, 2022 18:32
print public holidays http payload
func printPayload(){
url := "https://date.nager.at/api/v2/publicholidays/2020/US"
data,_ := http.Get(url)
payload,_ := ioutil.ReadAll(data.Body)
fmt.Println(string(payload))
}