This file contains 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
package main | |
import ( | |
"io" | |
"net/http" | |
"os" | |
"strings" | |
) | |
func dummmy(){ |
This file contains 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
package main | |
import ( | |
"golang.org/x/text/language" | |
"golang.org/x/text/message" | |
) | |
// create a new printer withe the locale set to english | |
var print = message.NewPrinter(language.English) |
This file contains 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
module dummy/foo | |
go 1.14 | |
require ( | |
) |
This file contains 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
import ( | |
"io" | |
"log" | |
"io" | |
"net/http" | |
) | |
func dumpResponse(r http.Response) { | |
io.Copy(os.Stdout, r.Body) | |
log.Println("") |
This file contains 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
const getPromise = function (resolveValue) { | |
return Promise.resolve({ result: resolveValue }); | |
}; | |
const handleUsingThen = function () { | |
return getPromise("doA").then((res) => res.result); | |
}; | |
const handleAsync = async function () { | |
const res = await getPromise("doB"); |
This file contains 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
const getDelayed = function (resolveVal) { | |
return new Promise((resolve) => | |
setTimeout(() => resolve("delayed: " + resolveVal), 2000) | |
); | |
}; | |
const func1 = function () { | |
console.log("Hello func1"); | |
return getDelayed("func1"); | |
}; |
This file contains 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
const doFoo = (passedObj) => { | |
passedObj.foo = true; | |
passedObj.bar = false; | |
return { | |
cat: 'meow', | |
passedObj | |
}; | |
} |
This file contains 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
import { someApiCall } from './' | |
const myService = async function(parameter, passedObject) { | |
const restResponse = await someRestCall(parameter); | |
passedObject.details = restResponse[0]; | |
return { | |
content: restResponse.foo, |
This file contains 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
// Option A | |
Integer totalFixedRateResultCount = fixedRateCounts | |
.stream() | |
.reduce(0, (aggValue, current) -> { | |
Integer value = (Integer) current.getValue(); | |
return aggValue + value; | |
}, (aLong1, aLong2) -> aLong1); | |
// Option B | |
Integer totalFixedRateResultCount = fixedRateCounts |
This file contains 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
#!/bin/bash | |
if [ "$1" != "" ]; then | |
echo "Get pods in service: $1" | |
else | |
echo "Service blank" | |
echo "Pass the target service" | |
exit 1 | |
fi |
NewerOlder