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
# Kustomize based apply workflow. Requires jq, yq, kubectl, kustomize, mustache. | |
# | |
# Expected variables | |
# - namespace Namespace for all resources. | |
# - release A unique name to give to this collection of manifests. | |
# - revision Release revision. | |
# - images Image replacements. | |
# - variables Variable replacements. | |
# | |
# Example inputs: |
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
#!/bin/bash | |
set -e | |
# Set the variables below or add them dynamically. | |
region="us-west-2" | |
environment="<environment>" | |
cluster="<cluster>" | |
commit=$(git rev-parse --short HEAD) | |
full_commit=$(git rev-parse HEAD) |
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 express = require('express'); | |
const app = express(); | |
function start() { | |
return { color: "#3d00a6" } | |
} | |
function move(state) { | |
console.log(state); | |
return { move: 'right' } |
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 express = require('express'); | |
const app = express(); | |
app.listen(3000, () => { | |
console.log("Listening on port 3000"); | |
}); |
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
function move(state) { | |
const head = state.you.body[0]; | |
const neck = state.you.body[1]; | |
const moves = ['up', 'down', 'left', 'right']; | |
for (const move of moves) { | |
const coord = moveAsCoord(move, head); | |
if (!offBoard(state, coord) && !coordEqual(coord, neck)) { | |
return {move: move}; | |
} |
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
function coordEqual(a, b) { | |
return a.x === b.x && a.y === b.y | |
} |
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
function move(state) { | |
const head = state.you.body[0]; | |
const moves = ['up', 'down', 'left', 'right']; | |
for (const move of moves) { | |
const coord = moveAsCoord(move, head); | |
if (!offBoard(state, coord)) { | |
return {move: move}; | |
} | |
} |
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
function offBoard(state, coord) { | |
if (coord.x < 0) return true; | |
if (coord.y < 0) return true; | |
if (coord.y >= state.board.height) return true; | |
if (coord.x >= state.board.height) return true; | |
return false; // If it makes it here we are ok. | |
} |
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
function move(state) { | |
const head = state.you.body[0]; | |
const moves = ['up', 'down', 'left', 'right']; | |
for (const move of moves) { | |
const coord = moveAsCoord(move, head); | |
// We now know where this is going to be! | |
} | |
} |
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
function moveAsCoord(move, head) { | |
switch (move) { | |
case 'up': | |
return {x: head.x, y: head.y-1}; | |
case 'down': | |
return {x: head.x, y: head.y+1}; | |
case 'left': | |
return {x: head.x-1, y: head.y}; | |
case 'right': | |
return {x: head.x+1, y: head.y}; |