This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Will work in Postman but not in jsfiddle or client-side/browser code! | |
const url = 'https://ctwc-cloud.appspot.com/v1/match/ctwc_2014_r5-01' | |
fetch(url).then((response) => { | |
if (response.ok) { | |
return response.json() | |
} else { | |
throw new Error('Something went wrong') | |
} | |
}) | |
.then((responseJson) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PROD: | |
$> gcloud app deploy app.yaml --project studydash | |
$> gcloud functions deploy UpdateMemberMetrics --trigger-topic nightly_metrics_refresh --runtime go113 --env-vars-file ./cloudfunctions.yaml | |
# QA: | |
$> gcloud app deploy app.qa.yaml --project studydash-qa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://play.golang.org/p/6RkCCDQQ67Q | |
func main() { | |
loc, _ := time.LoadLocation("America/New_York") | |
t, _ := time.Parse(time.RFC3339, "2021-05-03T20:27:21Z") | |
fmt.Println(t.In(loc)) // 2021-05-03 16:27:21 -0400 EDT | |
fmt.Println(t.In(loc).Format(time.ANSIC)) // Mon May 3 16:27:21 2021 | |
fmt.Println(t.In(loc).Format("2006-01-02")) // 2021-05-03 | |
fmt.Println(t.In(loc).Format(time.RFC3339)) // 2021-05-03T16:27:21-04:00 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> go test .\ghservices -run Integration -v -count=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func init() { | |
_, filename, _, _ := runtime.Caller(0) | |
fmt.Println(">> Initializing testing:", filename) | |
dir := path.Join(path.Dir(filename), "..") | |
err := os.Chdir(dir) | |
if err != nil { | |
panic(err) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls env: | |
ls env: | findstr STUDYDASH | |
ls env: | findstr STUDYDASH_ENV | |
$env:STUDYDASH_ENV="qa" | |
$env:STUDYDASH_ENV=$null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestHello(t *testing.T) { | |
fmt.Println(">> Array example - Always passed by value") | |
testcase1 := [1]struct { | |
arg string | |
want string | |
}{ | |
{"original arg val", "original want val"}, | |
} | |
fmt.Println(">> testcase1.arg:", testcase1[0].arg) | |
testcase2 := testcase1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestHello(t *testing.T) { | |
fmt.Println(">> Slice example - Always passed by reference") | |
testcase1 := []struct { | |
arg string | |
want string | |
}{ | |
{"original arg val", "original want val"}, | |
} | |
fmt.Println(">> testcase1.arg:", testcase1[0].arg) | |
testcase2 := testcase1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestHello(t *testing.T) { | |
testcase1 := &struct { | |
arg string | |
want string | |
}{ | |
"original arg val", | |
"original want val", | |
} | |
fmt.Println(">> testcase1.arg:", testcase1.arg) | |
testcase2 := testcase1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/questions/33242850/in-golang-what-is-the-difference-between-and | |
type TestCase struct { | |
arg string | |
want string | |
} | |
func TestHello(t *testing.T) { | |
testcase1 := &TestCase{ | |
arg: "original arg val", | |
want: "original want val", | |
} |