Skip to content

Instantly share code, notes, and snippets.

View jldec's full-sized avatar
🇿🇦
learning

Jürgen Leschner jldec

🇿🇦
learning
View GitHub Profile
@jldec
jldec / type-assertions.ts
Created August 27, 2024 09:04
TypeScript type assertions
// https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions
// not to be confused with an "assertion function"
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions
type ObjectType1 = {
prop1: string
}
type ObjectType2 = {
prop1: string
@jldec
jldec / surprise.ts
Last active August 27, 2024 17:40
Typescript surprises
// 1.
type FunctionType = {
(): void
function_prop: string
}
// 2.
type ObjectType = {
fn(): void
object_prop: string
@jldec
jldec / json-worker.js
Created August 16, 2024 11:51
Example of Response.json() static method
export default {
async fetch(request) {
return Response.json({
date: Date(),
headers: Object.fromEntries(request.headers),
cf: request.cf
});
},
};
@jldec
jldec / riff-v05-snapshot-streaming-demo.md
Last active November 26, 2019 21:39
riff v0.5-snapshot streaming demo

install riff using kapp

riff-kapp-install.sh

install a snapshot build of riff cli

make clean build install
@jldec
jldec / riff-kapp-install.sh
Created November 26, 2019 16:39
riff v0.5-snapshot install (with istio on nodeport) using kapp and ytt
set -euo pipefail
set -x
# version and namespace
riff_version=0.5.0-snapshot
kubectl create ns apps || true
# build
kapp deploy -y -n apps -a cert-manager -f https://storage.googleapis.com/projectriff/charts/uncharted/${riff_version}/cert-manager.yaml
kapp deploy -y -n apps -a kpack -f https://storage.googleapis.com/projectriff/charts/uncharted/${riff_version}/kpack.yaml
cd ~/riff/hello-node
kubectl apply k8s-config/

install latest Knative

riff system install --manifest latest --node-port