Another great tip! Bitwise operators are underrated and forgotten most of the time. Thanks for reminding us that they exist. ...and as always thanks for teaching
This is the best way to save permissions, if you slit it into categories, each category can have at least 32 permissions. I'm starting to use it cause i have 11 categories and each one has about 10 permissions. This is exactly what I needed to get me started. I'm using arrays for each category :)
Hi Steve, was trying this out along with the vid and I figured maybe we could check for presence of a permission before removing with XOR this way: if (this.access & permission) { this.access ^ permission } Not sure but seems to make sense. Quick question to go along with this, though: How come you choose to not go with labels for the console log of available permissions? Is there any advantage to having nums there which we'd have to look up to know what they reference?
Another great tip!
Bitwise operators are underrated and forgotten most of the time.
Thanks for reminding us that they exist.
...and as always thanks for teaching
I always imagined something similar if I had to write a permission system. Very neat idea. Unix continues to inspire with its clever Ideas 😃. Thanks
Wow !! Never knew the power of bitwise operators. This is 🔥. Would love to see more content like this.
This is the best way to save permissions, if you slit it into categories, each category can have at least 32 permissions. I'm starting to use it cause i have 11 categories and each one has about 10 permissions. This is exactly what I needed to get me started. I'm using arrays for each category :)
Another very cool tutorial!
Insightful. Thank you for this lesson!
Very Useful ,thx🤩🤩🤩
Steve and Joanne out here dying of thirst
this.access &= ~perm can also be removed
Back when the cost of memory was exorbitant, any coder worth his/her salt (myself included) was encoding data like this.
Yep. As we reach the limits of Moores law it will become important again.
THANK YOU SO MUCH FOR THiS!
Hi Steve, was trying this out along with the vid and I figured maybe we could check for presence of a permission before removing with XOR this way:
if (this.access & permission) {
this.access ^ permission
}
Not sure but seems to make sense. Quick question to go along with this, though: How come you choose to not go with labels for the console log of available permissions? Is there any advantage to having nums there which we'd have to look up to know what they reference?
yes. but don't forget the assignment. this.access = this.access ^ permission
I use the getAll method to help people understand the step a bit easier.
@@SteveGriffith-Prof3ssorSt3v3 right, thanks!
for remove function, this.access &= ~perm does the job without checking it