hofstadter-io / cuetorials.com Goto Github PK
View Code? Open in Web Editor NEWLearn you some CUE for a great good!
Home Page: https://cuetorials.com
License: BSD 3-Clause "New" or "Revised" License
Learn you some CUE for a great good!
Home Page: https://cuetorials.com
License: BSD 3-Clause "New" or "Revised" License
Goal: make it easy for translators to see which files are new or have changed since and need updating / translating.
It should be easy to write a script which uses git to determine which content/*.md files are older than their english counterpart.
Any plan to translation? I'd like to contribute
Who's using CUE ?
Dagger
Repository: https://github.com/dagger/dagger
website: https://dagger.io
Documentation: https://docs.dagger.io
Hi,
The Building Up Values example on https://cuetorials.com/overview/foundations/ doesn't work:
❯ cat building-up.cue
#Base: {
name: string
kind: string
... // so it can be extended
}
#Meta: {
// string and a semver regex
version: string & =~"^v[0-9]+\\.[0-9]+\\.[0-9]+$"
// list of strings
labels: [...string]
}
#Permissions: {
role: string
public: bool | *false
}
// Building up a schema using a conjunction and embedding
#Schema: #Base & {
// "embed" meta and permissions
#Meta
#Permissions
// with no '...' this is final
}
value: #Schema & {
name: "app"
kind: "deploy"
version: "v1.0.42"
labels: ["server", "prod"]
role: "backend"
// public: false (by default)
}
❯ cue export building-up.cue
#Schema: field not allowed: kind:
./building-up.cue:3:2
./building-up.cue:6:8
./building-up.cue:13:15
./building-up.cue:19:10
./building-up.cue:19:18
./building-up.cue:21:2
./building-up.cue:22:2
#Schema: field not allowed: name:
./building-up.cue:2:2
./building-up.cue:6:8
./building-up.cue:13:15
./building-up.cue:19:10
./building-up.cue:19:18
./building-up.cue:21:2
./building-up.cue:22:2
value: field not allowed: kind:
./building-up.cue:3:2
./building-up.cue:6:8
./building-up.cue:13:15
./building-up.cue:19:10
./building-up.cue:19:18
./building-up.cue:21:2
./building-up.cue:22:2
./building-up.cue:26:8
./building-up.cue:28:2
value: field not allowed: name:
./building-up.cue:2:2
./building-up.cue:6:8
./building-up.cue:13:15
./building-up.cue:19:10
./building-up.cue:19:18
./building-up.cue:21:2
./building-up.cue:22:2
./building-up.cue:26:8
./building-up.cue:27:2
❯ cue version
cue version 0.4.0 linux/amd64
I could get it to work by moving #Base inside of the definition, but that's doing something different.
Hugo has some helpers to combine, minify, and create files named with their hashes. This should help with loading, both size and caching issues on updates.
Was the pattern meant to look like this? It seems to be missing #Thing
for either thing1
or thing2
#First: {
foo: string
}
#Other: {
msg: string
}
#Either: #First | #Other
#Thing: {
name: string
#Either
}
thing1: #Thing & {
name: "thing1"
foo: "bar"
}
thing2: #Thing & {
name: "thing2"
msg: "hello"
}
We should have a page on the website to thank all those who have contributed, if they wish to have their name listed.
Let's make it the last menu item.
import "list"
#test: this={
a?: [...string]
b?: string
c?: string
#AnyOfABC: true & list.MinItems([ for label, val in this if list.Contains(["a", "b", "c"], label) {label}], 1)
}
{
"a": ["bar"],
"b": "foo"
}
cue eval -c ./test.cue ./testany.json -d "#test"
#test.#AnyOfABC: conflicting values false and true:
./test.cue:7:13
./test.cue:7:20
changing from array a to string works or changing the array field from optional to default works as well. This is slightly outside of the content of the page, bug a simple derivative.
Hello
I'm trying to gently modify the basic cue example, but often get the below .
The command I'm running is cue cmd -t "name=bob" gen-todos
gen.templates.contents: invalid string: invalid string: invalid whitespace:
./first.cue:27:14
This error comes up when modifying what should be considered plain text, within """
.
For example:
contents: """
{{ range $T := .I -}}
model {{ $T.name }} {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
published Boolean @default(true)
}
{{ end }}
"""
Oddly, the following code does NOT error:
contents: """
{{ range $T := .I -}}
model {{ $T.name }} {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
}
{{ end }}
"""
These are all the path of the site.
If you want to contribute in Chinese translation work, please claim one of them and pull request all the pages under the one.
https://caniuse.com/?search=importmap
https://github.com/hofstadter-io/cuetorials.com/blob/main/layouts/partials/scripts.html#L27
We should be using a proper JS toolchain for Vue
Something like this should work: https://medium.com/gumgum-tech/faster-development-experience-with-vite-hugo-and-preact-c08cbcfce5fb
Shouldn't the ParsePath
on this line be looking for the value "hello" instead of "foo"?
cuetorials.com/code/go-api/flow/custom.go
Line 100 in 1b90070
Rainbond
Repository: https://github.com/goodrain/rainbond.git
website: https://www.rainbond.com/
Documentation: https://www.rainbond.com/docs/quick-start/get-start/
Hello 👋 , thanks for cuetorials.com, for several topics I find it better/simpler than the original Cue docs 👍
In the walkthrough section I came across this empty page:
It's https://cuetorials.com/walkthroughs/kubernetes/helm/, i.e. https://github.com/hofstadter-io/cuetorials.com/blob/055f33e6d9fc99401009d9995b3a1c5b40a324e1/content/walkthroughs/kubernetes/helm.md, which appears empty.
But the others also don't seem to be correct, for example I was expecting a walkthrough on https://cuetorials.com/walkthroughs/building-a-cue-powered-tool/self-driving-desktop/, but there's no walkthrough.
Hi 👋
Thanks very much for this tutorial repo. Really useful for implementing cue's features, with Go.
I have a (probably) basic question. I have been able to load and evaluate a cue value. How do I encode it to JSON? I am unable to find specific references to this in cue's source as well. I am sure I am missing something.
Any help would be highly appreciated. Thank you :)
In the example here:
https://cuetorials.com/go-api/loading/#loading-and-printing-cue-code
it says:
// to cause a load error, remove the '&'
// to cause a build error, change '#A' to '#B'
// to cause a validation error, change foo to '1'
However, the third case actually produces a build error. I'm not sure it's possible to reach this line
fmt.Println("Error during validation:", err)
Am I missing something?
For some time now my browsers started to reject loading the truetype font embedded on the site.
On Chrome I get this error in the console:
Refused to load the font 'data:font/truetype;charset=utf-8;base64,d09GRgABAAAAAL...' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.
I don't get any similar logs on Firefox, but the site looks the same there too.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.