over 2 years ago Syntax Podcast
Potluck × Naming Tech × Generators × Layers Follow Up × Sick Picks Page
- 00:11 Potluck podcast with JavaScript, React, CSS questions
- 00:21 Discussion on using generators
- 00:27 Addendums to previous CSS layers episode
- 00:42 Holiday train ride with kids to see Santa
- 02:09 Many fancy programming names are simple concepts
- 03:20 Singleton design pattern holds one instance
- 03:29 Factory makes objects/classes dynamically
- 03:35 Dependency injection passes needed things
- 03:51 Mixins combine reusable code
- 04:09 Memoization caches results
- 04:16 Higher order function returns function
- 05:14 Found use case for generators
- 11:11 External CSS could override internal layers
- 16:09 Database table prefixing
- 18:22 Generalist vs specialist front-end roles
Generalist vs specialist front-end roles
Wes Bos
takes a photo of me and
Guest 2
You would like to do more.
Wes Bos
and dev tools inspector. I've been noticing this quite a lot lately is a lot of websites
Guest 2
nature.
Wes Bos
notes. I have an open issue. If anybody wants to rid when it's just some plain old function thing I've written 10,000,000 times. And
Wes Bos
who is it? It was the TL draw. TL draw supports embeds, So this is the whole like fetch requests and data in the client. That can be a benefit.
Wes Bos
rid. I was glued for probably, like, 5 hours straight
Wes Bos
like a ticket
Guest 2
in the States and haven't had to do much of rid. Anything else in the tech scene, though? Talking about being indie dev, that's the probably the biggest benefit here is But if I were to Apply for an Angular one job and they were to say explain that this aspect of Angular one, I would say,
Wes Bos
Move to Denver or move to Portland
Guest 2
A lot of plans there. You know, one thing here I think that's important is go back and listen to We did an episode with, my wife, doctor Courtney Talinski, on ADHD. She gives a lot of really good advice. That's episode number 532.
Wes Bos
A Avid scraper
Guest 2
and you're gonna eventually find some systems that work for you. Yeah. I do love that, letting your excitement drive you. Like, I I mentioned I've been doing some Fun game development been trying out Godot and learning the scripting language there, which is very Python esque. Right, Wes? You can pick it up pretty easily.
Wes Bos
a lot of our
Wes Bos
In the states where people pay webcam Yeah. That whole, like, CDN Rid. You find yourself writing I cannot wait to get the The rid. It's in most cases, you just import it. There also is a you talked about you can use at import URL.
Wes Bos
stop before you hit the next h two. They just parsed them on out. So the show notes haven't changed. So theoretically, we could go back the data for that specific card. Now this generator function
Guest 2
all of the nuance there or you could just be effective with it. And I think it's important to say that being a generalist doesn't mean that you are not skilled or less skilled.
Wes Bos
it's about a couple things. First, like, the to do list is massive for me in terms of, like, what do I do next? Rid. But specifically, you're asking about, like, learning techniques here.
Wes Bos
rid. Snatches them all up. It might be maybe a little different now that they're a little bit more remote, but that certainly was an issue Or the pandemic. I thought you were gonna say the Ottawa senators.
Wes Bos
rid. 50 gigs to 55 gigs. And I was like, this is amazing. And then I got all these people
Guest 2
a website or app. I'd love to hear from their team you don't say a as much.
Wes Bos
So telecom, really expensive. I was just praising telecom the other day. My cell phone bill went from Rid. If Hey, guys. Just noticed I can't find the sick pics page on the news site. Any plans to bring that back? I found it super handy for myself, so I didn't have to dig through Hundreds of episodes wondering when did they talk about that thing? Especially nice to have around the Christmas season.
Wes Bos
In the states, it's always interesting seeing how people move to I would just be scared that you would accidentally, CSS.
Wes Bos
X, Y, and Z. But
Guest 2
Web service that a 1000000000 people are gonna use, or is this a fun experiment that's going to get attention? In fact, I was just looking at,
Wes Bos
In response to a lot of the JavaScript frameworks
Guest 2
schedule, and keep yourself on that schedule. I make a firm to do list. Whenever I'm feeling scattered, I make that to do list. I put it on my schedule. I make the the things that are here's the highest priority. Here's the lowest priority. And I start with that highest priority, and I just keep grinding out of it until I knock it out. Those are some of the the biggest things for me. But also, again, like, understanding how you consume
Wes Bos
they're there too. Yeah. It's very cold in Ottawa, so Buckle up.
Wes Bos
my cart included,
Wes Bos
and groceries are ruled by a couple, it might not be as simple as that because flat assumes that it's not a synchronous operation. Right. What if in every single That was resilient
Wes Bos
Is it awesome? Yeah, because you don't have to do
Guest 2
And I'll share this with you, Wes.
Wes Bos
anything that encompasses is the idea and then There can be issues there. I'm always curious about that with, like, online bidding and auctions and things like that.
Wes Bos
support
Guest 2
a generalist K. Constant.
Guest 2
you can create more without having to spend a lot of time looking up other things or instituting other people in there to help you.
Wes Bos
rid. Me and Ricky from Trailer Park Boys Very, very simple. Factory, even when I was selling t shirts, rid
Guest 2
I I'm I'm even struggling lately, Wes, With compile times and stuff, I've been doing a lot of compiled languages, struggling with ADHD?
Wes Bos
I wouldn't be as stoked on that type of thing. So you really got to try stuff and figure out import the CSS the auction stuff is really interesting to me because And I think I forgot who it was. Somebody wrote the Sick Picks page
Wes Bos
nifty web tea behind all of this stuff. Word. Next question from Thomas Eckert. Thank you both Next question from Nils. Some episodes ago, you guys mentioned something with a database prefix that allows you to use the same database for multiple projects. Can you tell me what that was? Because I cannot find the episode, and googling is not helping me love the podcast. So first,
Guest 2
or Super awesome.
Guest 2
in that compile time. It's Absurd.
Wes Bos
Then you pay for it. So what happens if both people pay for it at the same second? You know, I built
Guest 2
Trevor is the goodchild.
Wes Bos
all the parts of JavaScript from rid. Audio synthesis
Guest 2
There's definitely a lot here, especially developer wise, That's enough
Wes Bos
I think that like, people always ask me, like, are you a generalist or a specialist? And I don't really know the answer to that. Like, I'm a generalist web developer, You often have the ability to pass it a,
Guest 2
Right? So, yeah, always leaned on my partner for that. It stinks that your health care is tied to your job. That Yeah. Doesn't make a ton of sense to me.
Wes Bos
rid For putting on such a fantastic show, probably I've never actually of cards in it. So to do, progress, whatever. You get it right? You have 3 columns. Each column will have 3 cards each.
Guest 2
I would love to do that as well. How do you feel about that, Wes? Gotta if if, any of those devs are out there listening to this, hit us up. We would love to have you on the show. I I I think these kind of things are really super neat In terms of,
Wes Bos
Ben Vinegar, was just alright, well throw it in your cart. And then Shopify.
Wes Bos
going
Guest 2
simply because I did not want to deal with that. I just didn't wanna deal with it even as a,
Guest 2
I think you should get excited for because
Wes Bos
They they do their own fulfillment for all their stuff, and it's basically built an entire fulfillment company that's just a different way to use a function or that's just a different way to And at some point, like, Travis here, you're gonna hit something where you go, sure. This is a pain in the ass to rid Do this double loop inside of it. And I have this weird little by the government or or by our taxes.
Wes Bos
And then
Guest 2
really flex some of your skills without having to be like, is this thing
Wes Bos
I would, yeah, I would love to get that page back up and running. Yeah. Yeah. Agreed. We gotta get that going.
Guest 2
And, again, it's the type of site That is like a one off kind of you do it, you flex some skills, they are unique one off opportunities.
Guest 2
And then I'll I'll tab over to something else even though that compile step takes a second.
Wes Bos
They built their entire
Wes Bos
because on that, and I learned so much about how that works.
Guest 2
Schedule,
Wes Bos
the sick picks rid h two, and it says sick or picks, I can't find I we we've have a couple good examples for generators.
Wes Bos
And Store variables. So let's go through a couple of them here. 1st one is tuples.
Wes Bos
Just not the same. I realized Canada is a big a big country, but the it seems like our telecom So I built, like, this thing where Tim Cook
Guest 2
you obviously can go deeper on a specific topic. You can become an expert. And oftentimes,
Guest 2
what pulls you away, what doesn't pull you away, what pulls you in, What engages you can really be a big factor in in growing with these skills.
Wes Bos
Health insurance, I, again, haven't haven't run into that specifically myself, but on the website.
Guest 2
with those abilities, but you have the abilities to do a lot of different things.
Wes Bos
so our doctors are covered and and then you can give it a layer
Guest 2
rid Man, Stripe Press just released a really cool site called the Poor Charles
Wes Bos
1,000 of dollars a month just for their own insurance, where in Canada, it's 100 of dollars a month. Yeah. And in that regard, I've always, They're going to both use the same tables. But if you want them to be separate, but in the same database, A function for dynamically creating objects or classes.
Wes Bos
and maybe visualizing that at somehow there's so many ideas we have around that and Past Show, Guess, a couple other people or move to Austin.
Wes Bos
Yeah, I have an open issue on GitHub for this, so enough to figure out meaning that Seriously. All the time, I learn about something new called, linking external CSS, Use a generator function in,
Guest 2
You know, I've always leaned on my wife
Wes Bos
And what is now happening is as somebody who is It's pretty much you live in BC,
Guest 2
I I now understand how to make thing move when I press Key, what other things can I do? Can I make it go forwards, backwards, rotate? Can I have a driver on the screen? Next thing you know, I got a little Sprite car driving around the screen. Why? Well, I just I I was getting I was getting that that point where I was feeling like I could feel my attention drifting, And it's it's nice to be able to recognize that, but oftentimes,
Wes Bos
for a return ticket, and You got 5 people in your family. That gets a little bit too expensive.
Wes Bos
from the old website, and they literally just wrote a regex work on it or reimplement that, that would be really cool. But
Wes Bos
Yeah. I don't I have a smaller point here, but what's it like living in in the states As a developer, But A lot of times, as soon as it's in a cart, they'll take that inventory off the shelf announces
Wes Bos
to use the AI GPT Vision and this, like, voice synthesis APIs.
Guest 2
country. Yeah. I I don't know. It it's not too hard for us to go back to Detroit area to visit family. Not hard at all. You know, hop on a plane or driving is no fun. So Yeah. Long drives or whatever like that is is probably not super good. But You know what? I I I don't know. I've always worked remote from wherever I am in managing your ADHD and understanding it.
Wes Bos
what is the data below $99 And every time, I'm like, oh, what's that Start go fetching this thing
Wes Bos
I would I had, like, a limited number of t shirts.
Guest 2
Next question here from Trevor Goodchild.
Guest 2
Now if I'll compile it and then get distracted
Guest 2
Yeah. I don't I don't know. I've always lived in the state. So Yeah. Initially from Michigan, now in Colorado.
Wes Bos
you're a bit of like a bingo player. You know, you go through a resume. Oh, this person has worked with
Wes Bos
talent,
Guest 2
where maybe I should take a break from the tutorial and just See what else I can make it do. I know code. I know,
Guest 2
Like I said, I do better at video and audio. I can put on a video, listen to that, and understand more than I can via reading a a blog post. And if I can get that blog post in audio, All these have necessitated Mhmm. And, therefore, I might get overlooked for that opportunity. In fact, I would, and that has happened to me. So you have to understand, like, what is it that you're after in this industry
Guest 2
The people behind Cards Against Humanity always do interesting Black Friday promos. This year, it was a pseudo social network called Yowza.
Wes Bos
And if 2 people buy the shirt at the same time,
Guest 2
You can In I I forget which type of layer you would put that in. It could be, that is coming in from a third party. For instance, the MediaChrome CSS, I want to be able to build a site that does this and this and this and has a back end and has this all by myself. I want to work on this thing, and I just want to,
Wes Bos
instance
Guest 2
So, you know, I I've been struggling this with my myself. I think one of the biggest things you can possibly do is to schedule,
Guest 2
Wes, do you wanna talk a little bit about HTML over the wire? Some documentation pages where my eyes just glaze over. But, you know, what I can do is I can select all that text. I can have it read it to me, And it can pipe it into my ear. And for some reason,
Wes Bos
Crypto, you know, like, not not every time we say crypto, I have to say, like Yeah. Not Bitcoin, crypto, the stock or package. Rid.
Guest 2
I just handle that better. I get less distracted. Right?
Guest 2
That expertise is needed.
Guest 2
It just means that your area of Ortiz is wider rather than narrower. So, you know, some people see a specialist and a generalist as, like, somebody who knows rid. A little bit about a lot versus a lot of bit about a little. And, sure, it can be that way, but, you know, sometimes generals know a lot of bit about a lot too. Next question from Josh rid Collinsworth.
Wes Bos
the show rid. Dudes, I've done it. I found a nontrivial use case for generators. So, a little bit of backstory.
Guest 2
owner, and understanding, like, what works for you and what doesn't work for you. Because, honestly, I get presented If you're shipping software
Wes Bos
What you will find surprising about being a dev in Canada is,
Wes Bos
I don't know Go, Rust, or any of these other languages. I could probably figure a few things out here or there, but if if I saw a resume where somebody rattled off, Now we're starting to see, oh, you want to refresh that component? Let's just render it on the server and send the results in HTML over the wire. So I I tried to, like, summarize these in, like, five or 6 words. And, obviously, there's a bit more to all of these, but
Guest 2
I'm a woman full stack engineer working at a major video game company, and I'm very proud of what I've achieved in my career.
Wes Bos
so much cheaper. I've heard like stories
Guest 2
And, therefore,
Wes Bos
and It's funny because that was the way a long time ago, and a lot of these websites still return jQuery.
Wes Bos
embeds.
Guest 2
or perhaps a skill that's in demand. Right? You can do anything you want. You have total freedom, but you might not be able to command
Guest 2
rid
Wes Bos
rid.
Wes Bos
evil evil beings.
Wes Bos
rid They certainly don't pay as well. However, you're moving to Ottawa,
Guest 2
and go for that based on what you need there. I like being a generalist more because I am a tinkerer. I like to get my hands dirty with a lot of stuff and make fun things for myself. Rid. And, Wes, I know you're very much the same way. Right? Yeah.
Wes Bos
And you're good to go.
Guest 2
like, these are the types of projects that as a developer, Dependency injection. This one always gets me to passing
Guest 2
Are there some specific learning techniques you can recommend? anything that is, really just picturesque
Guest 2
However, I work extra hard because not only
Wes Bos
Oh, the jobs in the States. We have a real problem.
Guest 2
Being a generalist gives you a lot of freedom in that you rid Have the abilities whether or not you are I am putting it into my layers Can you give me can you guys give some advice on How to grow and improve as developers your educational material.
Wes Bos
being like, And the important part here is that $800, $900 but a lot of
Guest 2
and working on And working for such a unique company.
Wes Bos
Housing is silly. Housing is is rid. Is out of control in a lot of places in the world right now, but Canada is It's certainly out of control in Denver. Yeah. There's the thing about Canada is there's not rid Really anywhere you can go right now.
Wes Bos
So node back end, literally any of the other JavaScript back ends, React, Svelte, vanilla, CSS, So this was own fulfillment company called Black Box, blackbox. Cool.
Wes Bos
It's called Brain Drain.
Wes Bos
when you check out, what's the there's like an open embed spec. Oh, yeah. A lot of places player? I'm a blog author and would love to be able to put something right in the middle of an article. Bonus points if You can add a query per end that lets me link to a specific time. Yes, this is on our list of things we would love to do Yes. So, like, I'm generalist in that. Like Scott said, you could put most of the stuff in front of me, and I would be able to figure it out. And That is a very good thing to have on your resume because combined and reuse code from multiple sources.
Wes Bos
It doesn't pay as well as
Guest 2
working in some game development stuff, been working in some Rust stuff. I'll compile it,
Wes Bos
rid. PHP, Python, Go, Rust, JavaScript.
Wes Bos
CardSkin's humanity folks, yeah, let's, let's get you on the show if we can. Who who knows? I I always find this stuff super interesting as well where It looks like the Yowza social network is just a Mastodon to reason inside of nested loops like that because anywhere you need to access rid. The full card data again, you're duplicating loops. I thought this is interesting. Yeah. If you if you want to be able to like, you get data from the server And it returns an array of 3 columns and each each of those columns you have arrays of cards.
Guest 2
In years past, They've auctioned off ridiculous items.
Guest 2
Now, again, it depends on what your goals are. If your goal is to get hired by a company and that company is looking for a specialist and you are a generalist,
Guest 2
Things like WordPress, you can just do a short code, and it will embed it right away. So I think that Or Discord or Slack? Yeah. Yeah. Discord, Slack. I think about, like, Yeah. Spotify has that that kind of stuff. Yes. This will be coming. And, you know, since this episode is coming out December 27th,
Guest 2
and said, alright. I now have made enough where I could get this this they will toss your application out.
Wes Bos
they will pay for that. Medications are not covered.
Wes Bos
And they use some service that approves and denies, formatted.
Guest 2
you know, check out that episode. There's a lot of great techniques rid And and tips inside of there. Yeah. For me, it's, Yeah. Yeah. I typically tend to do a 1 you know, try to get compartmentalize
Guest 2
you can bring in a lot more money than if you're a generalist. But if you're a generalist,
Guest 2
If you're a specialist,
Wes Bos
just
Guest 2
I think there Next one from CL.
Guest 2
React, whatever, Svelte, because you could be good at all of those things. But there are people who who know the React Code base inside and out. Right? They know the actual,
Wes Bos
working with the dom I don't know. Scott, do you remember what this is? If not, I have some notes on other other possible ways. No. And I I honestly have no idea what what this person is talking about. So I think server rendered.
Guest 2
it's not easy for us women to succeed in a man dominant field like software development, I've also been struggling with anxiety, depression, and ADHD.
Wes Bos
And Probably, in most cases, I would still reach for a flat, So I thought that was kind of interesting.
Guest 2
A rarer skill You remember the results the next time you do not have to recompute it. You you mean you you're caching the result, essentially.
Wes Bos
A lot of other places, As a scraper, I'm a bit sad because it means that rid. If you wanna pull data from a specific wp underscore whatever tables.
Wes Bos
I always think back to the Simpsons episode because, like, if 2 people add it to the cart, JavaScript.
Guest 2
You have the whole supply and demand of skills here. If you are a specialist of a skill that is in demand,
Wes Bos
For us to visit Saskatchewan, my wife's family still live there would be like 4 years or so.
Guest 2
Yeah.
Guest 2
to have her insurance when I was working for myself
Wes Bos
you are under 25, the government will cover it if you don't have insurance.
Wes Bos
lots of other places, but flights inside of Canada are silly expensive. So you don't see a lot of People move away from where their families are because it's just it's prohibitively you live in Southern Ontario.
Guest 2
I think this answer can go 2 ways. It's better to be
Guest 2
I'm I'm a good JavaScript developer. I'm not I'm gonna toot my own horn there. Right? I I can do a lot with JavaScript. And if you put an Angular one project in front of me And said,
Wes Bos
Manager of Syntax, he went down to San Francisco for I don't know how many years. He's back now. He lives in Canada, but he he went down there. A lot of Lot of new grads out of some of our big tech schools go directly down to Silicon Valley or whatnot and work in jobs there, so
Guest 2
in-depth and users are using it, you wanna make sure that you have a handle on your bugs before your users hit them. Not only does Sentry give you access to finding and fixing all of those bugs, but they also give you incredibly useful tools like session replay, I can get that even better for me. So, you know, it's it's work. I'll tell you that. It it's it's work. So,
Wes Bos
a month Canadian to build out the visual card If you're using Bootstrap,
Guest 2
if Why do we have to have a crazy name for it? So Singleton, is maybe and you show off a little bit. And I I I do love that. So,
Wes Bos
about doing something that I am interested it in. If I'm bored or not interested in, I'm not going to learn anything. But if I'm, like, super excited about Somebody has a decent
Guest 2
hey. Get this to this point. I can get it to that point, and I can do it very well.
Guest 2
Hey. I can't. I can't do that off the dome. I I just straight up can't.
Wes Bos
a month, and I went from are going away from the whole JSON API You know? I I would look at that and say, yeah. Right. You know? Like, there's no chance that you're you're Merry Christmas to everybody. Hopefully, you enjoyed your time. And a happy holidays.
Wes Bos
to rid. Where Homer went to Canada, and there's just pills dropping from the sky. And I always think, like, that's not true. You still have to pay for your medications.
Guest 2
You know what? I I did the tutorial, and, yes, I noticed that as my attention was starting to drift in that tutorial,
Wes Bos
but also pulling the transcript in
Guest 2
a long lasting
Guest 2
paying attention, and, like, really understanding
Wes Bos
And like,
Guest 2
even as a s corporation Next question is from Mila. Is it better to be a generalist or a specialist as a front end dev? And
Wes Bos
What else about Canada? Canada is very expensive.
Guest 2
a very specific
Wes Bos
so that somebody else can't. But
Guest 2
Almanac.
Wes Bos
It can be downside in some cases, but can be a major benefit.
Wes Bos
Net. What what might I find surprising about being a dev in Canada? rid Know what it is.
Wes Bos
be able to like clip something like have like you said, add a query param for linking to a specific time, a generator is helpful in that case because a generator doesn't know When it will be done, it will simply keep going until you no longer yield any data.
Guest 2
good health care options, and I was doing it through Gusto even.
Guest 2
My company wasn't big enough to really get any you know, I think there is a good chance that this thing could rid. Be well on its way if not done by then, but, yes, it's definitely in the in the pipeline here. We're working on it. Next rid one here from Nick. This is a supper club suggestion.
Guest 2
You could get paid more for being a specialist. Right?
Wes Bos
to do the Cards Against Humanity.
Wes Bos
what you enjoy,
Wes Bos
I am a developer working in the United States. And next year, I will be moving to Ottawa for personal reasons. I have my permanent residency, so the job field there is open for me. While I have a job I can continue doing from Canada, As I continue my career, I will be doing so in the wilderness of the Canadian job market.
Database table prefixing
Wes Bos
databases. I can maybe understand that, but A a high order function or higher order function is a function that returns a function. Yep.
Wes Bos
when you create tables
Wes Bos
you press, like, oh, restart this project, and it would just wipe the entire database.
Guest 2
that stuff as much as possible.
Guest 2
Yeah. That's a,
Wes Bos
But that's not really that's a bit of a security by obscurity thing. So you could just ready. Prefix all of your tables with a specific prefix when you build it.
Guest 2
Yeah. It's an interesting thing. It's not something that I ever do personally.
Wes Bos
databases in there. Yeah.
Wes Bos
you point them to the same database, for React to actually render it on out. Rid. And then I've bolded this part right here. It gets wacky maybe if that's the case, learn how to host your own MySQL instance.
Wes Bos
Yeah, I think if you're trying to sidestep paying for For me, it's Are sort of going through the standards process right now to add a layer attribute to a link tag.
Wes Bos
you can only put 1 WP underscore posts table in there. Right?
Wes Bos
What you are referring to a list of them, or maybe you just want to find a specific card in that.
Wes Bos
for whatever reason, ready. This thing the other day and Rid they are okay. A big problem. I've talked to a lot of people in Ottawa. It's a big problem trying to hire good devs in Ottawa because Shopify roast how I look.
Wes Bos
Because if you have 1 MySQL instance, you can have multiple but link including dental, medications, all that stuff, and simply just returning I wanted to learn how So immediately I was like, well, why not just Like, why not just use array. Flat? Right. Like, why not reduce it down into a single value?
Wes Bos
with your ORM, in India, you get 1,000 gigs for $6, and then people are like, in Europe, we get unlimited for €19,
Wes Bos
like, delete something and, rid. Like, you would have, like, 1 project that
Holiday train ride with kids to see Santa
Guest 2
And happy holidays. Syntex is presented by Sentry.
Guest 2
test coverage, Performance metrics Is HTML over the wire awesome
Guest 2
Not too much to report. Just feeling feeling the holiday vibe. We took a train in the mountains to see Santa with the kids,
Guest 2
Rid
Wes Bos
Use the coupon code tasty treat, all rid lowercase, all one word, and you'll get 2 months for free. Let's get into the first question here from Gordon Liu. How much of programming I laughed at I laughed at this question, so I put it first. How much of programming is general advanced technical stuff versus fancy complex sounding names for things? rid Open embeds and all all you have to do is, like, submit your website to a specific
Guest 2
it really got you into the holiday vibe. Rid. The kids were going nuts for it. They had a great time. So, yeah, just feeling it. Yeah. Well, this this episode goes live December 27th. So Michigan was definitely more Canadian than Colorado is. Colorado is way more like Cowboy
Guest 2
and tons more. So head on over to century.i0.
Guest 2
scene and Santa's on the bore onboard and everything like that, and it was just Chamber of Shaolin, And wrap it in a layer. In fact, we did do that on the Syntax website for CSS She gives a a lot of great advice on
Guest 2
And it was an old silver mining tray train, and you take this train through this
External CSS could override internal layers
Guest 2
Import with the layer in the import.
Guest 2
you know, we don't want
Guest 2
Phodiman says, create.
Guest 2
698, you talked about CSS at layers. For some sites that statically link in styles for dependencies Really good at all of those things. Yeah. And it depends on how much you zoom out. Right? Because you could almost say the same thing about somebody who says, I'm good at Angular,
Guest 2
This could be one reason why no one is really using layers yet. For example, imagine including styles for Bootstrap. You want to overwrite those styles to match your theme. With layers, you'd probably need to,
Guest 2
into the initial spec because, yeah, that's a that's pretty common use case, you know. Yeah. Maybe it's just one of those things that you know, sometimes things slip through the cracks, or maybe they thought about it and couldn't get it in. So wasn't important at first.
Guest 2
like, part of your base layer, but maybe the next one out.
Wes Bos
one of them talk about
Guest 2
In episode
Wes Bos
This would allow you to rid. Then you ended up with negative inventory of the array as you are parsing earlier cards. So there might be some sort of logic that says, all right, well, But to Syntax. We got a potluck for you today. Lots of interesting questions around Yeah.
Guest 2
get overwritten by CSS. It isn't a layer Because I think that that scenario would be way more confusing
Wes Bos
He loaded jQuery and Bootstrap.
Guest 2
rid. Be an all or nothing approach.
Wes Bos
In your CSS with the at import rule. The downside to that is you have a waterfall request so you can fix that with a and I sort of summarized it here. A complex loop can be made flatter or simpler anytime you need to access all of the cards as generator function will give you a nice simple loop without having to worry about the complexity of the way the data is
Guest 2
those styles would be a applied atop of your layered styles.
Wes Bos
in your head. And that will tell the browser, hey, I'm going to need this at some point.
Wes Bos
database prefixes, and it would find the actual part where they had talked about it.
Wes Bos
rid Bootstrap. And that solves that problem right there. So, yeah, let's hope we get that. So hopefully hopefully I'm actually surprised that that that didn't rid Make its way So it's hard to find a doctor, very hard to find a family doctor here. But If you can find 1 or you can go to a walk in clinic, Rid
Guest 2
earlier
Guest 2
Either way, my most general solution to that is to copy and paste that CSS into my CSS
Wes Bos
throw all of the resulting CSS into the layer of
Guest 2
than you do all your layers first and then you apply everything else on top of it. But, again, my solution is to bring that in house anyways. And I would do that even if I wasn't using layers just because I don't typically like to link to third party CSS hosted elsewhere.
Guest 2
That aren't using layers,
Wes Bos
Probably better to NPM install it and include it in your bundle.
Wes Bos
ahead of time,
Wes Bos
I sell some sites that do it, but I haven't done it in Is and was that if another website same with jQuery.
Wes Bos
thing to say. When did
Wes Bos
Ready. Looks like Miriam, Suzanne and If you have 1 MySQL database a prefix. So the most common example of this is WordPress.
Wes Bos
Go to wes.com.
Guest 2
CSS
Wes Bos
AI embeddings going because that would be such a simple Like if people are guests on the show and they want to embed it into their website, if you have a blog post, you want to be able to embed it, like even further,
Wes Bos
The benefit to linking it off of a CDN
Guest 2
they came in for our video player. We wanted to override that with our own properties, our own theming stuff. We put that into a layer in that way.
Wes Bos
If another website had already loaded that, Then your your users doesn't need to redownload it. Right? Like, you go to scott.com.
Guest 2
Rid. It could be that your third party layer, your system, or your layout layer depending on what that is. And I'm gonna I'm gonna copy and paste it, or I'm going to use the Okay. Yes.
Wes Bos
rid.
Guest 2
are almost treated like import rules, overriding your styles and layers. What are some solutions to this problem? Yes. The solutions to this problem is, 1, just bring that CSS in house, wrap it in a layer. That's what I do. I pretty much if I'm using a third party CSS solution,
Guest 2
that's not in a layer to
Higher order function returns function
Guest 2
Kung fu actor. And I'm wondering I pulled it back to the code itself
Guest 2
I gotta I gotta say, Simple things.
Guest 2
or Friendlier names? Who knows? There's probably a long history for a reason why that is. Also, this question was asked by Gordon Liu who, So, yes, this is also a a good reason, you know, why this exists is because,
Wes Bos
kung fu film there. So, next one we have here from Travis Hubbard.
Guest 2
So things have to have names, but couldn't be simple names, As long as that specialty And that distractibility,
Guest 2
you know, a very famous,
Guest 2
this is the name of a very famous Sprite on the screen rotating and moving.
Guest 2
if the OP of this question knew this. This is the the actor from such fine films as the 36th
Guest 2
Yep. That's it. Man, Thank you so much. I love the show. I hope you can bring more women on in the future. Yes. We are.
Guest 2
It it doesn't have to be this hard. These things can be described in such easy ways. But, again, sometimes sometimes the language used is scarier than the concept itself. And I think that is you know, you gotta name things.
Guest 2
say, I don't know if Gordon if this is your real name or not because,
Found use case for generators
Guest 2
I'd love to hear it. We would love to generate some content from that.
Wes Bos
for the display view, right? So it takes in data, is now just a function that contains all the complexity of looping over those nested values and returns to you or sorry, doesn't return, it yields iteration of that you need to do some sort of a sync away, you need to pull an API for that specific item.
Wes Bos
the way that we do it is a little bit weird, you know, and a generator would Would be a good use case there. If you have a use case for a generator that you're using, please send it to us, tweet us, syntax. Fm, send me an email.
Guest 2
yeah. I just don't hit I guess I just don't hit that that situation,
Wes Bos
So I thought this was pretty interesting, Travis has has stumbled upon An Embeddable player is is the front I was looking into the like,
Wes Bos
Finally, inside of that nested loop, you yield You can change the wp prefix
Guest 2
but interesting, man. It makes me just wanna it makes me want to explore them more. You know? Makes me wanna do just more research. Yeah. I think I think the the important part here is, like,
Wes Bos
Rid We we talk a lot on this podcast that, like,
Guest 2
and I get it. But, like, in the same regard, I'd still
Wes Bos
anything that accepts iterable. So a for loop is probably the most most common.
Guest 2
Next one is from Phodiman.
Wes Bos
Rid this is the interesting one. A little advanced. I spent, like, 20 minutes before the episode trying to understand, and I I get it. And this is,
Wes Bos
There's a lot that could possibly happen there, right? and you know what's in Ottawa? expensive to go fly and see your family a couple of times a year,
Wes Bos
returns some templating out. So if all of this were a single service, you'd have a ton of nested loops, right? I need a loop to loop over every column,
Wes Bos
I have a separate service that takes in a single record Now he simply just has to use a single for loop
Wes Bos
of card data and interpolates and grab that code to parse in your wp config file and set that to rid literally anything you want. A lot of people do that just for security reasons. If your database was ever exposed, a lot of the robots would just automatically check for the And if you have 2 WordPress installs, Why? Because that's super fun, and I just sort of followed my energy with that type of thing. Whereas if I were sitting there following the tutorials
Wes Bos
if this card has something in it. We need to add something to the end of it. So all the way over to
Wes Bos
multiple loops
Wes Bos
implemented a generator in my code base.
Guest 2
we've heard here. It it it's still a bit of a mystery, to be honestly. I was I know that was a really good explanation, Else, those external dependencies
Wes Bos
Any time you need access And, I'm sure they have a really and, after that, like you said. But there also is a proposal.
Wes Bos
to sort of get access to them all. So this is what Travis says. In my card data service, the card that holds the data, I have a generator function. So this is a function called cards data. And inside of that, it has
Wes Bos
I think that's, like, the first, like, solid use case of a generator function that,
Wes Bos
nested loops. The first one loops over the columns. The second one loops over the cards inside of that column. Right? for this thing? And it looks like that into various HTML JSX components It would be really cool to you don't even recognize that it's just gone. Right? Next question from Jesse Pence. Any chance you could make an embeddable
Wes Bos
to all of those cards. Maybe you want to display Oh, I need the same version of jQuery and Bootstrap. Oh, it's already in my browser's cache. Doesn't need to to redownload it, but
Wes Bos
Then a loop for every card data element
Wes Bos
I have 1 service called a card data service that holds the data from the server for each card. So example, a card would have an ID, title, description, etcetera.
Wes Bos
to be able to
Wes Bos
something in his code base, and I thought it was really interesting. So I'm going to read through it and then sort of sprinkle in some explanations as we go. So imagine you are creating a Jira or Trello board experience with multiple columns, and each column has an array Or there might be cards that are added to the end
Wes Bos
each piece of card data. And the important part about yielding there is that you can then That makes me a little Nervous, though, putting multiple projects in a single database.
Wes Bos
But, like, in practice, 100% Brahma, iterate over every single rid hard without having to go through it.
Singleton design pattern holds one instance
Guest 2
a value That is only created once and reused.
Mixins combine reusable code
Wes Bos
Mixins rid Say, alright. Link in Bootstrap, But over, you got to pay for it yourself. But rid. That said, I'm self employed. And a large reason why I am self employed and a large reason why I've been able to do what I can do is because, And in Canada, we don't necessarily have What are some of the differences rid. Being a professional developer in Canada versus the United States, is it easier to become an indie dev in Canada with universal health care and the social Safety that they spun up,
Wes Bos
at the end of the day, they're just they are
Wes Bos
simple things.
Guest 2
Memoization.
Addendums to previous CSS layers episode
Wes Bos
Re some addendums to the Layers episode and all kinds of great stuff. Looking forward to talking about it. My name is Wes Bos. I'm a developer from Canada. With me as always, mister Scott Talinski. How are you doing today, Scott? Doing good, my man. Just hanging out.
Many fancy programming names are simple concepts
Wes Bos
of,
Wes Bos
A tuple is a very in that column and then a loop
Wes Bos
rid a an an ID which Which is pretty nifty. I also went into the You could Rell DNS prefetch
Wes Bos
I can't agree more. I I see I read this and I was like, There's so many things in JavaScript, It's a it's a tricky thing. So I'd love To talk to somebody, if anyone knows anyone at Cards Against Humidity, I even went I went deep. I was like, what are they they using, I specialize in web development. I don't know Python.
Wes Bos
and a person, and the 1st item is the ID and 2nd item is a person. That's a tuple. It's a tuple. Next one is Singleton. Again, this is one of those ones.
Guest 2
and I have a bunch of names I have a bunch of examples here that we'll rattle rid Oh my gosh. I'm so glad you wrote this because that's the first one that came to mind was Singleton.
Wes Bos
predicate inference pattern on composition member inheritance proxies,
Wes Bos
rid. Scary sounding name for an array where you the length and the item types are known. So if you have an array web development.
Wes Bos
Advanced concept. Oh, my gosh. And then you get into it, you go, oh,
Transcript
Announcer
You're listening to Syntax, the podcast with the tastiest web development treats out there. Strap yourself in and get ready. Here is Scott Talinski and Wes Bos.
Potluck podcast with JavaScript, React, CSS questions
Wes Bos
React, $45
Wes Bos
JavaScript, And then, Of course, there's
Wes Bos
Welcome
Dependency injection passes needed things
Guest 2
in the things that a function needs rid Teran. Yes. It's dependency injection. The the the dependency part I get, the injection, it sounds a little little ready. Fancy. You know? It sounds too fancy to me.
Discussion on using generators
Wes Bos
how to use generators. We've talked a lot about that.
Wes Bos
idea of