- 16
- 107 016
Orchard Dweller
Poland
Приєднався 1 лип 2022
www.patreon.com/OrchardDweller
orchard.blog
orchard.blog
I've made Snake in Python using only decorators and lost my mind
The video shows a slow descent to madness of a programmer who decided to forgo reason and attempt the forbidden.
Code:
github.com/orcharddweller/decosnake
Join the discord:
discord.gg/XwExgW65u9
0:00 intro
1:04 dark urge
2:19 the game of snake
3:09 looping
4:07 attempt 1: list
4:44 game state
5:58 attempt 2: reduce
6:52 a fascination
7:28 the end
Music:
Digital Bark - Kevin MacLeod (incompetech.com)
Oportunity Walks - Kevin MacLeod (incompetech.com)
#python #coding #snake
Code:
github.com/orcharddweller/decosnake
Join the discord:
discord.gg/XwExgW65u9
0:00 intro
1:04 dark urge
2:19 the game of snake
3:09 looping
4:07 attempt 1: list
4:44 game state
5:58 attempt 2: reduce
6:52 a fascination
7:28 the end
Music:
Digital Bark - Kevin MacLeod (incompetech.com)
Oportunity Walks - Kevin MacLeod (incompetech.com)
#python #coding #snake
Переглядів: 8 073
Відео
Everything about TOML format
Переглядів 47 тис.Рік тому
What is this TOML? Visualizer: toml-to-json.orchard.blog/ Code: github.com/orcharddweller/toml-to-json TOML spec: toml.io/en/v1.0.0 #TOML #tutorial #guide #coding #learning #programming Join the discord: discord.gg/XwExgW65u9 0:00 intro 0:52 headers 2:10 values 4:17 keys 5:39 array tables 6:24 outro
Setup a Python project with PDM
Переглядів 7 тис.Рік тому
Let's setup some nice future projects. PDM: pdm.fming.dev #python #pdm #poetry #tutorial #guide #coding #learning #programming Join the discord: discord.gg/XwExgW65u9 0:00 intro 0:55 different kinds of imports 1:48 installing PDM 2:46 creating a project 4:34 exploring generated files 7:05 creating a script 7:46 running a script 9:18 dependencies 10:50 pyproject.toml 11:26 installing our app 12:...
Python Closures Explained Through Shouting
Переглядів 378Рік тому
Time to finally learn about those pesky closures. A tutorial. #python #closures #tutorial #guide #coding #learning #programming Edited by: Orchard Dweller and www.youtube.com/@LidaLiberopoulou Join the discord: discord.gg/XwExgW65u9 0:00 intro 0:15 not just functions 0:54 global scope 2:46 reference mutability 4:46 free variables 6:00 closures 7:38 a step deeper 8:26 why cells? 9:57 summary 10:...
Snakebones or how I learned to love Python Dunders
Переглядів 3,2 тис.Рік тому
At some point, all of us have to face the Dunders. It's not necessarily a tutorial, but it also isn't not one. You will remember the stuff you learn here, even if the stuff you learn is not sensible. Edited by: Orchard Dweller and www.youtube.com/@LidaLiberopoulou Join the discord: discord.gg/XwExgW65u9 #python #dunders #tutorial #guide #coding #learning #programming 0:00 intro 0:18 the legend ...
How good are Baldur's Gate 3 Advantages?
Переглядів 4,7 тис.Рік тому
Version with red-green visualizations replaced by blue-green ones: ua-cam.com/video/YaooFkfBVLQ/v-deo.html Check out the app: orchard.blog/dice Are BG3 Advantages stronger than plus 4? In this video Dweller goes through basic statistics of dice rolls and visually explains how to calculate probabilities of various D&D 5E tests. Edited by: Orchard Dweller and www.youtube.com/@LidaLiberopoulou Joi...
Learning Generators in Python by Skinning the Snake
Переглядів 1,9 тис.Рік тому
A tutorial on python generators, iterators and iterables, through jokes and hopefully fun. Edited by: www.youtube.com/@LidaLiberopoulou Join the discord: discord.gg/XwExgW65u9 #python #generators #tutorial #guide #coding #learning #programming 00:00 - intro 00:38 - laziness 01:44 - a lost cake 02:13 - generators and iterators 4:27 - yield and generator functions 6:14 - yield patterns 7:14 - sen...
You should try Svelte now (especially for prototyping)
Переглядів 687Рік тому
Svelte is great for prototyping. React is nice too. No framework was hurt when making this video. #svelte #frontend #typescript
Persist your settings in Tauri with Zustand and tauri-plugin-store
Переглядів 3,4 тис.Рік тому
In this tutorial, we'll guide you through persisting settings in Tauri applications using Zustand and tauri-plugin-store. Discover how to effectively manage application state and store settings persistently for a reliable user experience. Learn about the benefits of Zustand for client-side state management and the role of tauri-plugin-store in data storage. Join the discord: discord.gg/XwExgW65...
How not to mess up setInterval in React
Переглядів 880Рік тому
This video tutorial demonstrates how to create a timer using the setInterval function in React. It assumes basic knowledge of React and begins by introducing the concept of using a callback function with setInterval in JavaScript. To make the code reactive, the tutorial uses the useState hook. It also explains how to use the useEffect hook to reactively run code, emphasizing the need for idempo...
Setup Tauri with Next.js and Rust - Tutorial
Переглядів 23 тис.Рік тому
This video tutorial will guide you through the process of setting up Tauri, a framework for building desktop apps with web technologies, with Next.js and Rust. Join the discord: discord.gg/XwExgW65u9 Tauri: tauri.app/ Next.js: nextjs.org/ Tailwind CSS: tailwindcss.com/ DaisyUI: daisyui.com/ Open-source projects built with Tauri: github.com/kkoomen/pointless github.com/ZaneH/piano-trainer github...
Check out my open-source Timer App, built with Tauri and Next.js
Переглядів 4,1 тис.Рік тому
Check out my open-source Timer App, built with Tauri and Next.js
anything beyond a primitive value in TOML is neither obvious or minimal. TOML kinda sucks. (even Tom admitted this)
i do not use ts. is there no way to use next.js with ts in tauri? with js it did not install next.js by default. it installed just react.
Got any resources for how to add SQLite?
that callback in setTime was a life saver !! subscribed ❤
Code please
1:32 aah yes, i definitely think that "non-python external libraries" should have been in their own category. the absence of this point makes this video kinda pointless for me...
Try rye. Been playing with it recently 😁
hey guys does anybody knows how can we make the nextjs14 app routers work with tauri?
The nextjs template appears to have been removed.
Jason always seemed like the love child of a data structure and LISP - hard to read and too many keystrokes.
you lost me at array tables, not gonna lie xd amazing quickstart video btw
I've always been too lazy to read the specification, this video was fantastic.
4:50 if you meant to use regex for bare keys you shoild escape the last hyphen with a backslash
It is more close to INI, it would be better not call as '-ML' even it is an acronym of 'minimal language' Anyway it is further from the actual language.
❤
this video made me really like TOML!
3:21 creepy smile
Aside from array tables, I love everything about this
God I hate toml, using arrays/inner keys in it is absolutely terrible, and it doesn't support a lot of character escape sequences. If there's ever a way to get me to avoid updating a config file at all costs, make it in toml.
You just got a new sub! Simple and objective explanation!
Tom's language isn't all that obvious or minimal. JSON ❤
There's a lot I like about TOML, but its sections are not very intutive. I've designed my own format (kesh-lang/na). Still haven't made a compiler for it though. But you're welcome to have a look if you're interested in data notation formats.
toml is just. shitty json without the outer brackets and quotations around keys
toml is super easy, my only experience with it was like on cargo project and now i'm developing a project that involves parsing it with the tomlc99 library (the project is frogmake, it's still in early development and i'm working on it every day)
Array tables are cursed ...
Looks much less natural than yaml, especiales arrays of headers
When Go 1.20 was out, a lot of CI/CD pipelines broke, because the YAML parser interpreted the 1.20 as a number (so: 1.2 instead of 1.20). To avoid this, you had to write "1.20". YAML was blamed for this. I refuted this, pointing to the parser instead. When I used a YAML parser in Go, I got the string value 1.20 instead of a numerical one. Now I tried this with your TOML Visualizer. Same result. "1.20" is interpreted as string. 1.20 as number. YAML isn't worse than TOML. In fact, I'd rather read YAML since it's more natural for me to write it.
TOML is very good, i don't understand a lot of the comments. I'll take TOML over JSON any day. For once, JSON is much harder to read, heavier to write and parse, and pretty much requires an external library due to how complex it is to create a parser of...
I think you meant YAML, JSONs parser is much simpler than TOMLs, especially for writing.
@@orcharddweller Even though YAML is indeed the worse of them all, it's indeed much easier to implement a TOML parser from scratch than a JSON one. Mainly because TOML mostly separates stuff into different lines and has a less complex syntax to parse overall.
@@hrudyplayz Hmm, I've never implement neither of them, so I might be talking out of my ass, but I've done a bit of parsing in my life and just looking at this: www.json.org/json-en.html, the grammar feels much simpler than TOML. Also TOML has inline arrays and inline tables, which are in essence a limited version of JSON. So for parsing TOML you need to be able to parse a lobotomized version of JSON, but that's not necessary the other way.
What is common solution for stringification, since "there are different ways to represent the same data" ?
Its tricky, because in most cases you want to preserve the original style and comments. Poetry for example uses tomlkit, you can check out their approach here: github.com/sdispater/tomlkit In general, I’d probably avoid writing with TOML it unless you really need it.
very bad
I think this format is unnecessary and JSON hierarchy is much more intuitive. It only looks prettier.
i've learned toml when configuring hugo config files. after learning more about it, i love it more than yaml, and somehow learned a bit of ini. thank you tom for making this
What are the advantages of toml over yaml? Like you, I'm currently starting out with toml by configuring hugo config files, but I found it very not obvious. Yaml, on the other hand, I understood immediately on the first look (with the knowledge of json).
@@marloelefant7500 i guess for me is that you don't have to worry about whitespace indentation in toml (even though in hugo there are some docs that show whitespace indentation, but i choose to ignore it). also having nested selectors in which for yaml, you'd have so many indented lines to select a specific, deeply-nested key, while in toml, you just put it in dot notation making it shorter and more concise. tbh i don't toally hate yaml in general, as it is one of the morely used configuration specs besides json, and it does have its own advantages, but given the option for usage of toml, i would gladly use it.
Toms a genius!!
Lol "more readable than EVEN yaml" Dude speaks like yaml is most readable format! Yaml is one of least readable formats ever. In fact, less readable only binary serialisation!
Lol TOML is more like the glue-sniffing inbred cousin of ini and yml.
alright thats cool and all but I'm still using json
toml doesn't need to exist. first of all, who tf is tom? and how is his language "obvious?" granted yaml isn't obvious but it's more sensible than toml. it also does pretty much anything that you might want. sure the yaml spec is huge but you don't have to implement the whole spec if you don't need to. json is also ok for simple things and is about as obvious as can be. you only need to look at an example json file to pretty much figure out how it works. anything more complicated than passing data around or dead-simple configuration though and json falls flat on its face, but that's what we have yaml for. now this tom guy decides to throw his goofy format into the mix and we have one more silly config language that we have to know.
good one
Very stylish approach to a programming video haha, nice.
Watch at 1.25x speed
Give me yaml any day
Been using PDM for quite some time as I found poetries docs initially somewhat difficult to read and understand and I was new to python. (or even why you might use it, and then I started using Linux more frequently and understood lol) Perhaps I missed a convention with python file, naming conventions, but can you go into more detail or link me an article around the section about using a __main__.py as a file? I’m already in the habit of doing an ‘if name == __main__: block in main.py, but I’m not entirely sure what you’re doing here with the __main__.py file and all of that ❤
__main__.py is the file you want to use when you need an entrypoint to your program. It's so that you can run it with python -m module_name instead of python -m module_name.main here's the docs: docs.python.org/3/library/__main__.html
@@orcharddweller having a quick skim through the docs. It seems like this is more specific to packaging things onto pypy or for the building of pulling packages down, that along the right lines? I’ve always just done python(the interpreter) and then main.py and then at the bottom of main.py I’ll have an “if name main” block and then just call main with any runtime specific things for the JIT. TIL - it’s not just a convention haha cheers bro
There's a million ways to run your stuff in python (which imho is a bad thing). Its fine to just run a script file, but then you have to make sure that your dependencies are properly installed, and you might end up with some very subtle bugs with your imports unless you're really careful. Running scripts as modules means you have to adhere to python packaging rules. And that's a good thing, because you can expect all the things you build to just work, and you have some rules to follow that will most likely work with all the toolings that you potentially use.
Tom is a genious
But why?
RIP agent Mulder of the SCP Foundation love the narration 👍
I love the lovecraftian presentation, it's so good lol.
5:20 You can write "please don't" all you want, but all I see is a convenient form to convert my Java property files into.
We have too many config languages at this point
Still way better than it used to be when everyone invented their own thinking parsing was a trivial thing.
I knew toml was bud but I didn't think it was this bad
Just use ASN.1 - it's a standard, flexible, supports a text format, as well as several binary encodings.
That said, that one standardized text format is an XML transformation, if you plan for a text-first use case like a configuration file you might as well use XML directly. The most common "text" form of ASN.1 that users encounter regularly is probably Base64-encoded BER.
@@D0Samp While XML certainly is an encodin scheme for ASN.1 defined data, I was thinking of the possibility of representing example data in ASN.1 itself. It is possible to do so, iirc. (In practice, nobody would want to do so of course, as then you'd need an ASN.1 compiler to parse configuration files.)
toml is an inconsistent piece of shit
I see several reactions where people prefer JSON over this, but there are things that JSON doesn't do that TOML does that are important for configuration files. The most important one being commenting. All features are superior over JSON for readability, you can make your files readable, and less ambiguity compared to YAML. I think it's mostly very important to understand where it's useful and where it isn't.
You do know that the absence of comments in JSON is meant as a _feature_ ?
Yup, those are different formats, and while I don’t believe TOML is flawless, it has certain features that make it better than JSON for the job its supposed to do.
Variants of JSON like JSONC and HJSON also include ability to comment. I don't think JSON is that great for config file as long it needs to be edited by a human. It's rather clunky to use the moment you go into complex structures. But if it's just simple one level object with few keys then it's a simple solution to a simple problem. Lack of comments still is kind of big negative for config files especially.
JSON is really a pain because of the strict formatting/lack of comments, but what is the "less ambiguity compared to YAML"? I've never found YAML to be ambiguous.
@@CoolerQ no?