Skip to content

Instantly share code, notes, and snippets.

@dixler
Last active April 22, 2023 22:13
Show Gist options
  • Save dixler/1ec58982e2df4e22dd2f1634f8e9edbd to your computer and use it in GitHub Desktop.
Save dixler/1ec58982e2df4e22dd2f1634f8e9edbd to your computer and use it in GitHub Desktop.
This gist contains code examples that I thought were interesting.

Code appreciation

This gist contains examples of:

  • business logic changes
  • comparisons between different blocks of code
  • different ways that developers use the same language's syntax

It's more of a collection of food for thought.

Contributing

Please comment open source diffs of gnarly business logic changes that are tough to express!

Complex nesting

https://github.com/pulumi/pulumi/commit/71c0ce27f7b26ab6376ce8c0465e788fa5cac58e

I thought this was interesting because it shows 2 pieces of branching code where a change was intended to be added and I think it can serve as a test to see how effective your code style preferences are.

@dixler
Copy link
Author

dixler commented Apr 21, 2023

When comparing
https://github.com/kubernetes/kubernetes/blob/065428befa06c1d99deb4160b4490a8bf1a377ee/pkg/controller/cronjob/cronjob_controllerv2.go#L422-L640

to
https://github.com/pulumi/pulumi/blob/ec1b0466dfe03988c6e402b29e2064c4c85645b4/pkg/resource/deploy/step_generator.go#L427-L860

The kubernetes example seems much more straightforward than the pulumi example just looking at it. The business logic is not comparable, but they are both large blocks.

TODO: figure out why.

  • Scopes help break apart complex logic into easily glancible digestible chunks.

@dixler
Copy link
Author

dixler commented Apr 22, 2023

The way the authors used e2's syntax is really interesting here:
https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index3edb.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment