denobyexample icon indicating copy to clipboard operation
denobyexample copied to clipboard

Ideas for examples

Open lucacasonato opened this issue 3 years ago • 2 comments

This is a list of examples we'd like to add. Before contributing an example, please read the instructions in the README.md file. Please also comment on this issue with the example you'd like to write up so we don't duplicate effort.

Ideas (in no particular order):

  • [ ] Running a subprocess to completion
  • [ ] Spawning a subprocess and interacting with it
  • [ ] Handling OS signals
  • [x] Getting the Deno version (@ry, https://github.com/denoland/denobyexample/pull/14)
  • [ ] Programatically request and query permissions
  • [x] Get current process information (pid, ppid, etc) (@ry, https://github.com/denoland/denobyexample/pull/14)
  • [x] Get list of current environment variables
  • [x] Logging with colors
  • [ ] Connecting to a TCP server
  • [ ] Starting a TCP listener
  • [x] Streaming HTTP server responses
  • [ ] Serving local files using HTTP server
  • [x] Creating temporary files and directories
  • [ ] Writing tests (including substeps, resource leakage, and std asserts)
  • [ ] Getting a directory listing (including reccursive)
  • [x] Moving / renaming files
  • [ ] Removing files / directories (@littledivy)
  • [ ] Checking for file existence (explain that you should just do the operation and catch errors)
  • [ ] Handling WebSocket connections in a HTTP server
  • [ ] Creating outbound WebSocket connections
  • [ ] Watching the file system for changes (including how to debounce)
  • [ ] Running DNS queries (@satyarohith)
  • [ ] Sending UDP packets (@satyarohith)
  • [ ] Listening for UDP packets (@satyarohith)
  • [ ] Starting TLS connections (including custom CA certs, and other options) (@satyarohith)
  • [ ] Start a TLS listener (@satyarohith)
  • [ ] How to do benchmarking
  • [ ] Calculating cryptographic digests (hashing) (@littledivy)
  • [ ] Manipulating byte buffers (read / write u8/u16/i32/i64 etc, concatenate buffers using std/bytes) (@littledivy)
  • [x] Generating UUIDs
  • [ ] Manipulating fs paths (join, normalize, etc)
  • [ ] Manipulating and parsing URLs
  • [x] Matching URLs with URLPattern
  • [x] Parsing flags
  • [ ] Hex and base64 encoding
  • [ ] Parsing / outputting TOML
  • [ ] Parsing / outputting YAML
  • [ ] Parsing / outputting CSV
  • [x] Parsing / outputting JSON (@lucacasonato)
  • [x] Using JSON modules with assert { type: "json" }
  • [ ] Creating & Resolving Symlinks
  • [ ] Using Web Workers
  • [ ] Deno.File to Web Streams

lucacasonato avatar Jan 02 '22 10:01 lucacasonato

[ ] Using JSON modules with assert { type: "json" }

bartlomieju avatar Jan 02 '22 11:01 bartlomieju

I noticed denoland/manual#161 recently, seems like something that could go here. I could add it if there's interest.

zachauten avatar Apr 19 '22 04:04 zachauten

Working on the shebang example right now.

tristan-f-r avatar Jan 03 '23 17:01 tristan-f-r

I feel like this checklist should be updated to fit the current status of by example:

  • Parsing / outputting YAML #33
  • Parsing / outputting TOML #32
  • benchmarking #34
  • os signals #39
  • watching the filesystem #37

lino-levan avatar Jan 05 '23 17:01 lino-levan

I like to work on the TCP listener.

ghost avatar Jan 06 '23 01:01 ghost

Another round of updates that should probably be checked on the list:

  • Running DNS queries #48
  • Starting a TCP listener #47
  • Connecting to a TCP server #41
  • Programatically request and query permissions #43
  • Calculating cryptographic digests (hashing) #53
  • Checking for file existence (explain that you should just do the operation and catch errors) #54
  • Getting a directory listing (including reccursive) #55

lino-levan avatar Feb 03 '23 20:02 lino-levan

Another another round of updates:

  • Running a subprocess to completion (https://github.com/denoland/denobyexample/pull/61)
  • Spawning a subprocess and interacting with it (https://github.com/denoland/denobyexample/pull/65)
  • Serving local files using HTTP server (https://github.com/denoland/denobyexample/pull/59)
  • Removing files / directories (solved indirectly in other PRs, do we want a dedicated example for something so simple?)
  • Manipulating fs paths (join, normalize, etc) (https://github.com/denoland/denobyexample/pull/62)

This should leave us with 10 more examples in this main batch. I'll be writing drafts for each of these in the upcoming week (though if anyone else is interested in doing them, please feel free!).

lino-levan avatar Apr 05 '23 05:04 lino-levan

do we want a dedicated example for something so simple?

I think a dedicated example would be useful for some users

kt3k avatar Apr 05 '23 05:04 kt3k

Yet another round of updates:

  • Writing tests (including substeps, resource leakage, and std asserts) #79
  • Removing files / directories #67
  • Handling WebSocket connections in a HTTP server #70
  • Creating outbound WebSocket connections #69
  • Sending UDP packets #80
  • Listening for UDP packets #80
  • Manipulating and parsing URLs #72
  • Creating & Resolving Symlinks #68
  • Deno.File to Web Streams #71

This should leave

  • Starting TLS connections (including custom CA certs, and other options)
  • Start a TLS listener
    • No idea why this is checked, we don't have an example for this
  • Piping streams
    • Not on the list at the moment but suggested by @kt3k in https://github.com/denoland/denobyexample/pull/71#issuecomment-1507872879

lino-levan avatar Jun 24 '23 20:06 lino-levan

This issue should be closed. All of the remaining examples have been added. New examples should get dedicated issues (like ULID).

lino-levan avatar Sep 03 '23 00:09 lino-levan

@lino-levan Thank you for your efforts on this! 👏 👏

kt3k avatar Sep 03 '23 01:09 kt3k

@kt3k could you unpin this issue?

lino-levan avatar Sep 20 '23 20:09 lino-levan

Thanks for pointing. Unpinned 👍

kt3k avatar Sep 21 '23 04:09 kt3k