Var is almost never used in modern javascript since es6 (ES2015) when let and const was introduced. A good strategy is to use const as much as you can. Look into the immutability pattern.
Let variables can be updated but not re-declared. Const variables can neither be updated nor re-declared. Const Arrays and Objects can be mutated however.
Let can be declared without being initialized. Const must be initialized during declaration.
Let and const are block scoped. A block scope is the area within if, switch conditions or for and while loops. Generally speaking, whenever you see curly brackets. { }
Twitter: https://twitter.com/BarelyDaniel
Github: https://github.com/danba340
...
https://www.youtube.com/watch?v=v8hOi2oIAK0
In this video I show the process of setting up AssemblysScript to WebAssembly compilation and how to test and evaluate the performance of placing computation in WASM compared to just using Javascript. AssemblyScript has the goal to provide TypeScript like syntax as much as possible and is therefore suitable for those that prefer to write Javascript and TS over alternatives like C, C++, Python, Go, Rust, Java, PHP, and so on. The functions covered in the video is a simple Add function, Factorials and Squaring all elements in an array. I also try to investigate the impact of passing large parameter payloads between JS and WASM and the glue code needed when passing more complex datatypes as parameters. Enjoy! :D
Full Code: https://github.com/danba340/assemblyscript-benchmarks
Setup from scratch steps:
npm init -y
npm install --save @assemblyscript/loader
npm install --save-dev assemblyscript
npx asinit .
npm run asbuild
Twitter: https://twitter.com/BarelyDaniel
Github: https://github.com/danba340
0:00 Intro
1:00 Files overview
2:53 Try the tests
3:30 Factorial AS
4:38 Factorial Test
5:30 Setting up Benchmark
9:30 Add & Factorial Benchmark
12:52 SquareArray AS
14:09 SquareArray Glue Code
17:52 SquareArray Test
19:30 SquareArray Benchmark
23:00 SquareArray no payload Benchmark
24:43 What did we learn?
...
https://www.youtube.com/watch?v=gCT9ebtTzqw
In this tutorial I take on the callenge to code a flappy bird clone in a few lines of code as possible.The starting point is an empty HTML canvas and you can follow along all the way to a complete game.
Try the game here: https://flappy.vercel.app/
The code for this project: https://github.com/danba340/tiny-flappy-bird
Say hi on twitter: https://twitter.com/barelydaniel
...
https://www.youtube.com/watch?v=mfk8Rk2eUJY
In this video i show how to implement rooms in socket.io. The frontend is using phaser.js talking through websockets to a Node.js backend. I showcase how you can use query parameters to pair players together into rooms so that they can play together.
Code - start of video: https://github.com/danba340/barely-amongjs/tree/p3-start
Code - end of video: https://github.com/danba340/barely-amongjs/tree/p3-end
Say hi in twitter: https://twitter.com/barelydaniel
0:00 Intro
0:30 Query Parameters
1:54 Reading/Change query parameters
4:06 Generating room ids
6:50 Passing room to Socket.io
7:30 Handle room on server
8:40 Validating server room functionality
9:45 Validating client room functionality
10:25 Update query parameter
11:20 Outro
...
https://www.youtube.com/watch?v=E5BsA17OVTs
This video is about the major flaw in TypeScript that challenges code reliability, especially when using npm packages. I dive into hidden control flow, error handling, and exploring solutions for robust code. And some tips for writing and using npm packages. Enjoy!
Twitter: https://twitter.com/BarelyDaniel
Github: https://github.com/danba340
Instagram: https://www.instagram.com/barelycoding
TikTok: https://www.tiktok.com/@barelycoding
LinkedIn: https://www.linkedin.com/in/daniel-bark
...
https://www.youtube.com/watch?v=sdcezRYJcbk
In this video we take a look at StackBlitz, an in browser IDE where you can run Node.js natively in a WebContainer. I show how you can debug both frontend and backend javascript projects inside the Chrome Dev Tools.
https://stackblitz.com
Twitter: https://twitter.com/BarelyDaniel
Github: https://github.com/danba340
0:00 Intro
0:50 StackBlitz functionality
1:38 Overview
2:40 Debugging Node.js
4:00 Debugging React.js
5:33 Outro
...
https://www.youtube.com/watch?v=_R2uls4s70s
In this Full stack tutorial i build a complete authenticated todo list app. I bootstrap the application with the T3 stack boilerplate. Then I set up email magic link authentication with next-auth. I create all the TRPC backend routes to create, read, update and delete todos. I implement the corresponding functionality on the frontend side using the TRPC query and mutation hooks and add some tailwind styling. Lastly I ensure a really snappy user experience by adding optimistic updates to the frontend. Happy watching!
If you want to code along here is a start branch:
https://github.com/danba340/full-stack-t3-tutorial/tree/start
And the finished code:
https://github.com/danba340/full-stack-t3-tutorial
Twitter: https://twitter.com/BarelyDaniel
Github: https://github.com/danba340
Instagram: https://www.instagram.com/barelycoding
TikTok: https://www.tiktok.com/@barelycoding
LinkedIn: https://www.linkedin.com/in/daniel-bark
Timestamps
0:00 Intro
0:56 T3 Boilerplate
2:10 Overview
3:30 Prisma Database Setup
8:30 next-auth Email Magiclink
13:07 Backend TRPC Router
23:27 Frontend Login
26:07 Frontend TRPC Querying
35:24 Frontend TRPC Mutations
47:18 Frontend Optimistic updates
1:00:19 Final touches
1:02:36 TRPC thoughts
...
https://www.youtube.com/watch?v=S3k82XXCrBo