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
Tools environment: GOPATH=C:\Go;C:\tinygo | |
Installing 18 tools at C:\Go\bin;C:\tinygo\bin in module mode. | |
gocode | |
gopkgs | |
go-outline | |
go-symbols | |
guru | |
gorename | |
gotests | |
gomodifytags |
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
// F5PoolSyncer is responsible for ensuring state on the F5 BigIP LTM. It is the glue | |
// that hides and abstracts the LTM from the rest of the code. | |
type F5PoolSyncer interface { | |
EnsurePoolPresent(k8sPool *bigipv1beta1.Pool) (*SyncResult, *bigip.Pool, error) | |
EnsurePoolAbsent(k8sPool *bigipv1beta1.Pool) (*SyncResult, error) | |
EnsureMembersPresent(k8sPool *bigipv1beta1.Pool, endpoints *corev1.Endpoints) (result *SyncResult, err error) | |
} | |
// realPoolSyncer is a concrete implementation of the PoolSyncer interface | |
// TODO this naming is awful; change it |
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
import ( | |
// We used an import alias when Logrus replaced | |
// the standard logging library a while back | |
log "github.com/sirupsen/logrus" | |
// Two scheme packages | |
"k8s.io/client-go/kubernetes/scheme" | |
myscheme "github.mycompany.com/product-engineering/my-project/pkg/client/clientset/versioned/scheme" | |
// So many v1 packages! |
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
var util = require('util') | |
var async = require('async') | |
var Cylon = require('cylon') | |
Cylon.robot({ | |
connections: { | |
edison: { | |
adaptor: 'intel-iot', | |
i2cPort: 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
let promises = [getDataAsync(), getDataAsync(), getDataAsync()] | |
resolveAndHandleChainOfPromises(promises) |
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
async function (t) { | |
// getDataAsync could be any function that returns a Promise | |
let aPromise = getDataAsync() | |
let a = await aPromise | |
// We usually don't assign the promise to a variable before we | |
// `await` it, so this process usually looks like, |
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
const assert = require('assert') | |
const co = require('co') | |
return co(function* () { | |
let a = yield getDataAsync() | |
let b = yield getDataAsync() | |
let c = yield getDataAsync() | |
let actual = yield averageAsync([a, b, c]) | |
let expected = (a + b + c) / 3 |
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
const assert = require('assert') | |
function* createIncrementingSequence(increment) { | |
let nextValue = 0 | |
for (let i = 0; i < maxIterations; i++) { | |
// ↙ 'yield' each value in the iteration. | |
yield nextValue | |
nextValue += increment | |
} | |
} |
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
const assert = require('assert') | |
const numbers = [0, 2, 4, 6, 8] | |
let sum = 0 | |
// We can loop through “iterables” with the new “for-of” loop: | |
for (let n of numbers) { | |
sum += n | |
} |
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
// Gah! | |
// Don’t try to understand all of this. | |
class IncrementingSequence { | |
constructor(increment) { | |
this.increment = increment | |
} | |
// ↙ Iteration function specially named with a “Symbol” defined by the language | |
[Symbol.iterator]() { |
NewerOlder