Adrian Peterson AP AD whatever you want to call him. I fully credit him for getting me into football I never watched football or really cared until I saw Adrian Peterson on the Vikings and in recent years He's played for like five different teams. His whole career is just a Viking Viking Viking and then bam Saints Cardinals Seahawks Titans Lions, but today I want to score with Adrian Peterson in every single Madden that he appears in Starting in his first ever Madden Madden 08 on the PlayStation 2 Adrian Peterson has a plethora of NFL records He was taken with the seventh pick in the 2007 draft and the next running back taken in the draft was Marshawn Lynch That is a studded running back draft right there He holds the record for the most Russian yards in a single game with 296 that is insane and he won NFL MVP in 2012 So I'm insanely excited to use him I am intrigued though what his overall is gonna be because there's gonna be like a five-year stretch where he's literally at 99 every single year, which is so hard to do is a running back It's just insanely difficult, but he gets drafted to the Vikings since she was such a high pick I have to imagine, you know, he's gotta be at least like a 75 right a lot of people say AD for all day Some people say AP for Adrian Peterson. He said he literally doesn't care He goes by both Comments about that. All right, come on Also a huge thank you to Marvel Strike Force for sponsoring today's video Marvel Strike Force is a squad-based RPG But what's amazing about it is you get to fight alongside your favorite Marvel heroes and villains There's over 180 characters to choose from and you have to fight to save Earth You can battle your way through arenas and raids earn character shards resources equipment to assemble the absolute Marvel Dream Team you can even collect awesome costumes in case you want to get stylish In the heat of battle and when you log in you can play through in-game events for new character releases holiday events and MCU themed campaigns. Let me show y'all my roster right quick and we can hop into a battle So my main guy right now is Spider-Man. I had to go with Spider-Man, of course So let's train up Luke Cage a little bit make him a little bit stronger before this next fight. Oh Look at that. He's a way stronger now. This mission is hail Hydra I got to get past the Hydra guards to claim the interdimensional orbs. Let's get it We're laying them out already Spider-Man can finish it off. Yes, sir. He's gone. I'll have our medic heal us up Luke Cage and Spider-Man on this one. Yes, sir And there's only one left one little pop And there we go, baby Marvel strike force is so much fun as you can tell you have to check it out for yourself It is available for free on ios and android download now using my link below and join the fight There's a link in the top of the description. Check it out and enjoy the rest of the video guys And I think this is the most impressive record he has So he was a three-time NFL rushing yards leader, but the years he did that in were 2008 2012 and 2015 doing it in one year is insanely impressive doing it in completely different years Like seven years apart. That's just unheard of and Adrian Peterson's first ever Madden He is an 85. Oh my god. Oh my god I guess it might have been different the old man's about rookies never go over like 78 nowadays.  Okay. He's a rookie 93 agility 93 excel He's catching us not so great. Yeah fun fact He only had six receiving touchdowns on his whole career 94 jump 84 break tackle They don't even have jukes spin truck any of those in mad no way But let's make sure we get him as the starter chestor Taylor I'm sorry, mate, but he's one of the greatest of all time. I have to put him in Well, this should make it easy for ap. I don't know why bro on these old meds You can just kick return like nothing. All right, Adrian Peterson. We need to punch you in a touchdown Let's get it at back draw and that packers d-line is solid, but we still got five yards there Come on rook. You got this baby. Give me those blocks boys. Yes Adrian Peterson's first touchdown as a rookie. Let's go mad no nine in the books I think the overalls are just gonna skyrocket from here. So let's go get it madden. Oh nine ap's rookie year was really good ap's rookie year was very good I expect him to be maybe visit 85 in the last one. He's got to be at least 90 here.  Oh my god Second year Adrian Peterson.   He's even better too 23 years old 96 speed 69 straight same streak a little more awareness 98 agility 99 excel.  That's sick. I actually am so shocked. Dude, this is gonna make this easy Oh my god, he's gonna be at 95 and better for the next 10 years I'm gonna stick to the stretches if we're gonna get anything. Okay. Use that speed use that speed got a joke And busted his ankles. Okay I'm gonna keep going to the edge. Look at that. The bears are loading up the box I don't think they're gonna be able to stop this. Oh earlaker was that earlaker He got that grog spike too. Oh my god.  He almost got tfl too I think we had earlaker in the backfield. I that was sick Hey, we're already on to the xbox 360 So we're gonna get a big graphics jump and we've got madden 10 through madden 15 on there Well, no madden 10 through madden 14 So I do know that the best season of peterson's career was 2012, which would be madden 13 He had 348 rushing attempts for 2097 yards and the only time he was ever close to that was the second year in the league when he had 1,700 yards Player to watch adrian peterson hat bag number 28. That's crazy I'm gonna guess he's a 90 if in previous season he did all that he might even be He might be a 97 or 98. Well, I'm gonna truth right here, baby Halfback adrian peterson is a 90. I low key thought he might even be a 99 20 footers old 95 speed Strength finally got a big upgrade 85 strength 87 whereas 98 truck Which is now a stat and this is the introduction of a bunch of new stats So you got stiff arm 98 spin move juke move carrying now It is something to note that adrian peterson as far as like historically great running backs went He did fumble a lot in that crazy year that he had the year prior to this madden He had nine fumbles either way it ever stopped him from being dominant And yeah part of that is he has the ball in his hand so much There's a lot of running backs in nfl history don't fumble like that. Lamar jackson adrian peterson. Here we go. Yes Oh broke it one more He's doing a great job of turning these like horribly set up plays into at least some positive yards I see you. I see you. I see you One one more yard, baby. I saw you need in the new madness. This is a touchdown.  Nobody wants to block today.  Yes, sir.  Oh wait. It was a touchdown anyway Madden 10 in the books. Let's pop in madden 11 Dude, this is the madden where they got the headset talking to the whole goddamn time.  Oh my god We have breath farve. I forgot about that. We have breath farve and we're taking arson starting out hot one reception 22 yards I gotta check it, baby So in that season after his sophomore season, whatever you want to call it He had the most touchdowns of his career ever like that he ever has But he had like 400 less yards, so I don't know I'm gonna say night darn it. I switched too quick I was gonna say 98 though. I promise 98 overall this dude is 25 years old. He said 98 overall 97 speed 98 agility 99 excel Absolutely the best one we've seen. He's got 98 old spy swagger.  He's got 99 stiff arm. I think I'm gonna use that at least attempt to his jumping has gone down He had 96 jumping as a rookie and his past block footwork is actually not that bad just for shits and gigs I guess she and I go give me a block. Oh wow. We're getting not nasty blocks this time Man 10.  Oh, they're overloading I could go up the middle. Yep. Yep. Get through them. Let's go. Let's go I'm literally just running the ball up and down the field Yep, get through them easy easy Easy it's all day, baby. It's a happy day, bro. Let's see baby power.  Maybe mad 12 you're up next. I want to know at what point he has to get 99 in a madden I don't know which one can't imagine. This is the madden, but it could be christia ponder cubie This team is poverty is fuck. We'll go Adrian Peterson underneath. Oh, I gotta check this overall What do we got in the depth chart here? Adrian Peterson goes down one overall still in 97. So nothing to cry about 97 speed 98 agility 97 excel 90 truck 97 looseners 99 ball carrier vision His carry went up significantly looks like he didn't fumble so much the year prior and jumping stays at 85 All right, we've got 17 yards to go 97 overall. Adrian Peterson. Let's see a baby.   All right. Where do I go for the dive the dive? Oh, none of it works because he broke the tech like a savage despite me doing nothing. All right. Good. Shit Let's go on to madden 12. Just kidding.  That was men 12. We're going men 13 Okay, so this is the madden where in my opinion. He has to be a 99 His 2012 season was so ridiculous bro.  Is he 99? He has to be a 99 at some point though, right? There's no wager Peterson when his whole career was never 99 a man in 2014. He doesn't play he's hurt.  Am I doing this wrong in my head?  Yeah, I might be thinking the wrong man Actually, maybe madden 14 follows the 13th season. So it's after the 12th season. Yeah, that's really weird to think about But it does make sense. So he'll be a 99 next madden or I'm throwing a fit. All right, Peterson Let's find that edge, baby. Let's go. Just gotta beat one. Hurtle him. Oh, Jesus christ While he didn't fumble it, I I'm pretty happy about that. Probably should be going for a truck for a stiff arm But let's go. Yes. That's a lock up. That's a tunny right there. Oh my god How did that juke not bust his ankles and juke into his body for a segoal pitch to the right side?  Let's go. Hey that is madden 13 So now I'm remembering correctly madden 14 this next one. He's gotta be a 99 This next agent Peterson should be the best agent Peterson that we get. Come on, baby He's gotta be he has gotta be a 99 agent Peterson moment of truth. Oh, baby I knew it. I knew it. And you know what's crazy.  He's just peep though I don't think there's gonna be any madden where he is a 99 I think even a madden 15. He might be like a 97 or even a 96 because the year he had prior to this year was spectacular so good 99 overall Adrian Peterson 97 speed 89 strength 98 agility 99 excel 98 trucking 97 elusive 99 ball care vision Doesn't have 99 sip farm. I said 97. Let's punch this man in the end zone, baby Figure we could literally just run hat back dive four times here and he will just bulldoze See how many it takes one. Oh My god, I thought it was literally only gonna take one. Jeez. He's such a monster, dude He really is wow. I can just goof this one off 99 a b into the end zone All right We're on to the xbox series x for men 15 through men 22 and you're gonna start to see a whole lot more teams Rager and Peterson on to madden 15. We're gonna get a huge graphics update But I have to say I think this is when the roller coaster shirt's going a little downhill That's okay at this point.  Also. I just threw a laser kind of Rudolph Let's check this depth chart.  I have to imagine Adrian Peterson was maybe injured at the start of the season So they didn't know if he'd start or not. He's 29 though at 96 speed, which is just so crazy And look at that. It's rookie Jerick McKinnon. Who's been so impactful for the chiefs and the playoffs I think it's really cool because now he's I mean, he's old now be 29 now, right? Jerick McKinnon 29 or 30 All right. Well, I got Adrian Peterson in now Let's uh, let's get ourselves down close against this bears defense and punch this puppy in I think that's Rudolph again monster We're gonna have back sweet bursting gold from the eight.  All right boys We need to take this moment for granted because I don't think there's too many more Crazy high overall moments.  This will be fun I gotta check his ratings. Don't let me forget Madden 16. Adrian Peterson. Oh, and we have digs now I it's so crazy that I've already adapted my brain to think of digs as a bill Adrian Peterson was a 96 last time. Yeah, the roller coaster has begun its descent He's a 93 overall and man 16 still very good Uh, but Jerick McKinnon is officially faster. He went from 96 speed in 15 to 91 speed and McKinnon went from 91 to 93 So I think they could tell McKinnon's getting better still got 93 trucking 94 ball carrier vision 93 stiff arm It is spin 91 juke 81 carrying I think they've always just wanted the Adrian Peterson cards to fumble a lot. All right, we're gonna go with the stretch AP Oh, we kind of busted through a guy, but I'm not gonna lie. It is very difficult. It's difficult to move running backs This is this is what I really did not like the run game. This is just so clunky It was always pass pass pass pass pass third and one power. Oh, it's got great blocks Damn, and we get mob tackled, but we're still moving it watch Ellison's just gonna massacre that corner all the way out there and Peterson should just have a free lane Let's see it baby. Great block. Yes. Yes That is prime bond Miller by the way. Let's go AP Madden 17. We're not gonna be able to do that. He's only gonna get slower Sammy Bradford Heinecke is deep in that depth journey is a 59 overall and Adrian Peterson Damn and the descent is really descending. He's a 91 speed 92 agility 90 truck He's still really good.  It's just a show of his former glory First and 10 dude. I don't know what it is, but the pitchers have been nasty Uh digs his back in he's gonna be throwing a mean block here So we kind of need him quick pitch to the left Peterson. Get out there. No, this is what I mean dude the run game God that was a touchdown There's feeling he's got it. All right. That's kind of what I needed However, we're now on the five AP he's got a punch in here on fourth and goal I know I said this before but Adrian Peterson does not have a lot of receiving touchdowns on his career Only six, which is so crazy when you think about the NFL's meta right now Right where like all these running backs get receiving touchdowns all the time So I kind of want to give him one fourth and goal the angle route AP Tonight threw that out of desperation. I didn't think he was there at all the touchdowns a touchdown, baby Let's get it madden 18. Uh, oh Is madden 18 the first one where he is no longer on the Vikings? So here's the problem with the 2017 season, which is what madden 18 follows So he signs to the saints and he does play a game with the saints that year And then halfway through the season he gets traded to the cardinals.  No, he's not on the saints They've got uh, they've got rookie chimera on the saints here. So then he's got to be on the cardinals He is on the cardinals He's in 82 This is so sad, bro. He's in 82 He did have a nasty game though in his first game with the cardinals He had 134 yards and two touchdowns at age 32 90 speed 90 agility 90 excel 85 truck I like saying we're playing as the arizona cardinals first attempt we go slap stretch left adrian peterson number 23 It's kind of weird also I hate that these old meds would try and tell you what like what thing to do Like just let me figure it out, bro. Oh, this is when dive was nasty You do dive up the middle then you cut it back left. Oh, and I jumped a little bit late. All right The help would have been nice there actually.  He really is such a savage fourth and goal. This isn't 80. Ah Whatever we got a hurdle.  I'm the cardinals big play right there, baby All right mad 19. Let's see what it's got and now things are gonna start getting just so weird So now he signs with what is actually the redskins It wasn't the washington football team at the time and then he's just gonna start getting bounced around And he's even gonna play for the Lions for a little bit Let's take this one mad at a time mad 19 should be on the washington redskins here And it was at this point that ap was a very standard back So I'm gonna guess he was an 82 last man. He's probably a 76 or 78 in this madden. Was my prediction correct We've got alex smith 84 overall and I was Totally wrong. I was totally wrong. Wait.   What's the other redskins? I'm gonna update the rosters if it lets me It says I already have the latest rosters. I clearly don't What?   He just appeared out of nowhere. Wait his overall went up. Okay. I'm Dude, what uh, he's 33. He's overall went up. He's got 90 speed Neither we're in his 80s. I did whatever we got him. We got him first. It's time.  I've got a personal question for you guys. Do you say ad or do you say ap? Let me know. Adrian Peterson has said in an interview that he does not care what people call him. All right. Oh good broken tackle But oh another reason that I still lost seven yards. Damn it Admittedly though, we're in a bit of a predicament here. Second and goal is uh, it's not my favorite down in distance But you know what they're kind of loaded up on the right side. There's a decent chance. We get the blockers for this Yes Both team wait redskins my bad redskins tutty adrian peterson now things are gonna start to get real sticky So i'm thinking he should be on the detroit lions here, right? Oh, okay, so the update keeps him on the redskins, but now he's a 79 overall Let's trade him on over to the detroit lions.  Well, good joke. We get rocked. Well, thank you jj watt on the texans. Where are you belong?  They're in goal line I don't know if we're gonna be able to hurtle over this, but I gotta try it hurtle hurtle All right, peterson. Let's get you that edge. Yes, sir. Yes, sir.  I have this wrong He was still with the redskins in madden 20. How do I mess that up? Sorry, the numbers of the maddens always throws me off. So madden 20 is actually the 2019 season He did still play for the redskins in the 2019 season.  I'm an idiot, but it actually works out It actually does work out because in the 2021 season, which is this season He actually plays for two different teams. He plays for the titans and the seahawks So normally I wouldn't have been able to show that but what we'll do here instead is in madden 2021 I'm gonna have him play for the titans and when we go to madden 22, I'm gonna throw him on the seahawks No, no, no.  This is where he's supposed to be. So ap on the lions is a 78 overall madden had it right I had it wrong. He's supposed to be on the lions here But so that we can get him on both the teams he played for this year We're gonna trade him now to the titans Now honestly, we've been kind of, you know, punching the ball into the end zone I think I'm gonna use adrian peterson up and down this field We're gonna get a meticulate solid drive with 78 overall adrian peterson. Who's now 35 That's so crazy 89 speedy still got good stats.  That's super weird number 27 adrian peterson I've already seen him now in 23 26 27. Let's get him a roll come here Oh, good broken tackle. Good juke That was the hardest spot two yards ever and we're going up and down the field with adrian peterson Yep, let's go edge. Good sprint stiff arm got him 39 yards 35 yards. I have a contact. This is also mad. No, this is 21 So stretches and super busted, but still really good keeping it on the ground. Obviously. Oh, they're run committing. Can they get to me? Oh, they do Damn, I thought we had daylight on that. Let's see that lead block. Yep. There's the oh, I probably ran that wrong And by probably I mean I definitely ran that wrong. We'll go dive alert smoke third and 10 right up the middle on third and 10 It's the last thing that could have dove Respectfully the reliance dmi has not been like that.  Come on. Maybe me me the gap me me the gap Did he put oh my god?  I want to see this replay bro duty reach for I'm so glad they added that madden 21 Madden 22 when they added this the reach. It's exactly what it's made for. Let's go We're on to our final madden with adrian peterson, you know, technically, I don't think he's retired from football He just isn't on a team right now. So then 23 you could technically see one more team get added to this So I think he'll be a free agent. I don't know where the rosters are gonna put him But we're gonna throw him on the seahawks. So he shouldn't be on the lions No, he shouldn't be on the titans or the seahawks titans. Yeah, so he's a free agent It's that or he's just not in the game It is 73 Dude as a rookie, he was in 85, right? Either way 73. That's uh, frank gore still better than frank gore and Todd girly 73 overall age 36 still got 88 speed, baby He is faster than uh, the second year man dj dallas 79 strength 87 agility 89 He's still beast straight up and you know, we got to take on the vikings His true team is the vikings. He will always be a viking. All right, you know, we owe it to him We're gonna take adre and peterson all the way down this field too. It's gonna be a little more difficult considering his overall But that's a great start. Oh, he looks so weird in the seahawks. Seriously.  Oh my god. It's open Let's go. All right a p. We gotta we gotta punch you said buddy safety comes down.  Oh my god We could not have ended the adre and peterson video any better than that Look at the fans getting so pumped for a p All right, boys that concludes scoring a touchdown with adre and peterson and every single man that he appears in I hope you guys enjoyed Thank you so much as always for watching and please let me know what other players you want to see right now I'm working on Michael vick if you haven't already seen it. Yeah, I'm working on michael vick I don't think you've seen it and if you want to see anybody else just let me know I appreciate you boys for watching as always and i'll see you in the next video. Peace


Hey, what's good y'all? It's your boy Don from the Don Show in France. And yes, I got my bro back James I told you same office I'm just letting the beer grow in all right so listen check this out y'all so what we're gonna do now for y'all Let me make sure that this correct. We have stay tonight by Chung Ha So we're gonna do the choreography video So I'm gonna introduce him to her because like basically bro. Like honestly like I asked them I said, yo, she like the Beyonce over there because her at her whole swag and attitude You gonna see what I'm talking about. Yeah, but I found out that she really gets down like she really do this dance like Yeah, so we about to see all that so thank y'all for requesting this video Thank y'all so much. Let me know about her. We're about to watch her right now Please make sure you like comment subscribe and share and if you got any more Songs or videos you wanted to check out you already know what to do. Yeah, so let's go ahead and get started. All right. Here we go This is a dance practice. Mm-hmm. Basically. Yeah, we're actually video. Yeah Let's go okay Hold on Wait a minute. Wait a minute. Talk about it. Wait a minute. I'm gonna get you saying go ahead and talk about what yeah Hey What Bro, if you ever see a black person just stop and be like If you see us do that, yeah I know Like I told her before he is fresh to the kpop movement to all this music this whole culture So he's feeling away. I apologize y'all. He's loving it. That's why So all these reactions is him like, oh, she's fine And her outfit is going though. Yes. Yeah, it's like hey Yeah, man And my man's with the with the color here again I wish I could just now that's how you stand out though if you're gonna stand out do it If you're gonna do it then do it. That's why I'm gonna Chris Brown was changed here because I'm like, hey If you're gonna do it, you better go ahead and do it. Yeah, man You know I'm saying at least get the matching shoes or something Ah, here we go. Let's get it. They like they want to go off. Oh hundred percent Stay nice with the move though with the wacky With the wacky It's so smooth very clean Oh Oh, wow It's so clean they they are fine This is so clean it is Come on hey hit it if you go do it do it there we go Oh If you go do it do it When I say if you go do it do it This is what I mean like they're they showing the whole The whole movement between the wacky and the voguing they bringing it and she is bringing it If you're gonna do it do it I already mean that because this is very clean choreography. The transitions are so smooth So it's not like there is clean clean clean and then fast fast fast. It's like it's clean The lines all of that you don't have to be a dancer to be able to appreciate the lines and the shakes and the You don't have to be a dancer. You can just appreciation You can just appreciate what you're seeing like. Oh my god. Like it's beautiful. This is the choreography video And they're committed. Yes, like you said, they're committed Why why why I didn't get it. I got a choreograph for her because I'm loving this That means the music video is nasty. Oh hundred percent. Yeah Is how she was able to set up It was the confidence for me as they say. Yeah, it's the confidence for me And I know what I'm doing y'all see that roll Get up smooth hold a position sing the song to you and doesn't lose The connection what it on top of that. She's fine package. You know, you see what I was talking about. Yes Stop playing with me put in work. Yes. That's right. Go right into the choreography. Y'all better work It go ahead Shout out to the bogey and the wagon that I'm seeing I'm not gonna lie. I was house to the track actually. Oh, yeah, I was house Shout out to the pose the servant faces right call it. Yes Believe in it. Come on.     She's about to go off All right. I'm gonna go back at 315. Oh no, I'm gonna go ahead and do that right now Because she's about to go off. Let me see I'm gonna go back at 3 I'm gonna go back at 308 so we can see that whole thing.  She about to get busy Bro shout out to the voguing and wagon world. I have friends in that scene There are battlers that gets off and it gets it in and every time I watch them do choreography or battle It gets nasty.  So we can put it back at 3 minutes and 8 seconds. Let's get it because she's so fine That's why I'm sweating. There we go. Yeah, I love you Let's go.  Let's go listen Ripple by by that's a nice. I'm here for this. I'm for it. I'm serious. Y'all.   She is cold And dancing and she fine Love the song.  She's fine.  Wow. Yeah, I don't I'm not adding nothing to this. Wow All I just want to say is great job. Wow. I hope I get a chance to dance with her Wow. Yep. I needed to say wow. Yeah. She wow. Wow Clean fine Wow, I know bro. Listen y'all I'm gonna I'm gonna end it right here saying thank y'all for telling us about this We're definitely gonna post this one. This is crazy. We're gonna we're gonna do the music video Thank y'all. Thank y'all for introducing us to them. Yes. Chung Ha is crazy. She's a crazy soloist. She's a soloist Now if I was correct, she used to be in the group I can't I have to look up in the comments. What was the name of the group? But If she was like this in the group and the song was so smooth I can house dance to that. Yeah, beautiful.  Yeah the little catwalk Because if she really wanted like really tapping to her catwalk like on a battle level just walked up on you like that Yeah, that catwalk if she would have gotten to a battle mode with the catwalk. Yeah, y'all don't want that y'all don't want that smoke So thank y'all so much y'all check out the music video that's coming up next. I appreciate y'all We're body here. You're gonna see another one. Yeah, thanks. Wow. Yeah, bro


I'm here today to talk to everyone about your most favourite thing, legacy code.  It's not a case of if it's when. It can be really overwhelming though. Legacy code is horrible. When you see it, it just confuses you. You don't know what's going on. It's just horrible. Today I want to talk to you about a lot of tactics to help you tame the beast that is legacy code. Hopefully you can start viewing it as an asset to your company and not just something horrible. First of all, I want to talk what exactly is legacy code. There are a few definitions for legacy code. Legacy code, in my view, is any code that you didn't write just now, and I mean within the past five minutes. It becomes legacy pretty much immediately. It could also be code that's resulting from incorrect assumptions, code that was built using unsupported technology, for example PHP 5.6 now, and also code that isn't tested. Refactoring is something that we're going to do a bit of. What is refactoring? It is updating an existing code base, but in such a way that it doesn't actually change the application logic. You can use it to improve the code structure, and you usually approach it in very small incremental steps. Why would you refactor? To improve other developers' understanding of the code that improves developer velocity and get more done. You can also improve the application's performance. So, for example, if you're changing an algorithm slightly, you achieve the same result, but in a more performant manner. You can use it to introduce new technology, for example, upgrading your applications to PHP 7, and it also helps you to better accommodate changes in your code when things are just generally a bit more sane. Unit testing is also what I'm going to cover today. Unit testing is a verification that each individual unit of your application works as you intended it to. A unit in a definition of a unit would be a component part of your software application, so, for example, a function or a piece of behaviour. Just a small note here is that I am going to be talking about unit testing during this presentation, but unit testing is not a substitute for all other types of testing. There are lots of different ways to test your code and your application, and this is just one of them, so please bear this in mind. I love unit testing because it helps you to document your system. You can look at the test and see what people intended to be happening in your application. It also helps you to prevent regressions, so if you change something in your code and it breaks something, your unit tests are hopefully going to alert you to that. You can also use unit tests to test integration in new technology, so if you're upgrading your application. It also helps you to validate your product requirements. There's a slight paradox when it comes to unit testing and legacy code, in that you can't write the tests for your code because it's legacy, and it's untested, and it's horrible, and it's really difficult, and you need to refactor it. You can't refactor it either until it's tested because things could go wrong. It would be horrible. I've got a solution for you all. We're going to rewrite the entire code base. Sounds like a great idea. No, don't do that, please. That is a false economy. I have a better solution for you all. We're going to form just enough refactoring on our existing code base so that we can make the code testable. Then we're going to write tests for our code. Lather, rinse, repeat, and profit. We are at a PHP conference. I'm going to make a few assumptions. I'm assuming that you're PHP developers and that you have access to a terminal with Composer. I'm going to introduce a few tools. The main unit testing framework in the PHP ecosystem is PHP unit. I didn't update this slide, but I believe PHP unit nine is out now. There are older versions. Even if your PHP code base happens to be a legacy, 5.6, there are still versions that you can use. You can still go and implement the techniques that I'm going to be explaining today. It's really easy to install if you have Composer. You want to do Composer require dash dash dev because you don't need unit testing production. PHP unit, PHP unit. Then you can test that it works using vendor bin PHP unit dash dash version. I should give you the output display. A unit test. For people that haven't done much unit testing before, I'll briefly explain what a unit test looks like. A unit test is usually a class that extends the PHP unit base test case. Inside this test class, we have a group of functions, and each function is a test. You usually have, for example, a class, a test class that is testing one of your classes in your actual application, and then each function is testing each different behaviour of that class. In this example, we have example test that has one test in it, and it's to test the output or the result of some function. Within our test function, we're running the thing that we want to test. That's the underlined sum function. We want to assert that when we do run that function, it returns the value of true. If we were to run this test, hopefully we would get the correct output. To run our tests, and I've put all of my tests in a directory called tests, so I'm doing vendor bin PHP unit tests to tell it where my tests are, and it should run it, and you get a nice output. It's a little dot to say, yep, the test pass, everything's working. Great. There's another thing that I want to introduce, and that it's mocking. Mocking is really useful in unit testing. It enables you to create test doubles. If you're testing one particular part of your application, it probably is going to depend on other parts of your application because nothing really exists in a vacuum. You don't necessarily want to use real objects in your tests. It might have unintended consequences, or behave strangely, or just be overly complex. Mocking allows you to create test versions of objects in your code. It helps you to verify the behavior, regardless of what that test object is doing, and isolates what it is exactly that you're trying to test. A bit of a caution when it comes to mocking, it's nice to mock dependencies when you need to, but try not to mock everything, because your code does not exist in a vacuum, and sometimes you mock things and think the tests pass, only because you really told them to pass, and not because they actually would in a real-world scenario, and that's the warning about tautological testing, which often happens. If you were to mock the system under test, please under no circumstances, no matter how tempting it is, do this, because then you're not really testing anything. So PHP unit does have some mocking abilities built in already, but I prefer to use this library mockery. I find it easy to understand and to use, and you can install it again using Composer. Composer require dash dash dev mockery mockery, because hopefully you're not creating mock objects in your application code, and this is how you would create a test object using mockery. You do mockery, colon, colon, mock, and then pass it in the name of the class that you want to mock, and it will create a version of that class with the correct types, so it will pass all your type printing, but it is actually just a dummy. And you can perform expectations on your mock objects. So in this instance, we're saying that at some point during the execution of our code, this mock object should receive a call to the method method. It should only receive a call to that method once, and when it does, it should always return the value true. This is not asserting on the return value of that method. We are telling it that it will return true, and that allows us to essentially force the flow of our application. When you're using mockery, you have to remember to close it. This is just a sort of side thing. If you don't close your mockery after you've done it, it won't count the number of times that things have been called, and so you'll get failed tests. So just something to bear in mind. Just a disclaimer. The following examples are going to be deliberately simple.  I've made them simple so that hopefully you can learn to identify the patterns that are going to be problematic when it comes to legacy code, and when you've learned to identify them, you can apply the techniques that I will explain to you to tame your legacy code. So I'm going to go through a bunch of different scenarios. Lacy code. So the first tricky testing scenario that we're going to cover today is interfering output. And when I say interfering output, I mean something like an echo or a print in your code. So here we have a function yodol, that if you pass it a tune, it will echo that tune back to you, otherwise it will just start its own little yodol. Great. So how are we going to test this? There are two possible branches to this. We can either test what happens when we don't give it something to echo, and we can test what should happen when we do give it something to echo. So we've created our new unit testing class, given it a name, and we've got our two methods in there. Each one is a different unit that it's testing. And in the first one we're going to test our yodol without being past any parameters. And in the second one we're going to test the echo yodol. Sounds great. We're going to run these tests and something weird happens. The output is actually in our test rather. There's also another thing to note here, is that it says there were two risky tests. Because if you notice in our example, we're not actually testing anything. We're just executing these methods. Nothing's actually being asserted. So that's why it's considered risky. So how do we deal with this kind of scenario? And just imagine for a moment that this you might encounter in an old application where you haven't really separated concerns. So for example, if you've got a render function, that ends up printing an entire HTML page, and then you get that in your test runner and it's very confusing and long. Anyway, first off, we're going to prevent that from happening. We're going to stop our output being vomited out into our test runner starters. We're going to try and cap to that output so that we can actually perform assertions on our captured output. So PHP has the output buffer, which we can start up using ob underscore start. And anything executed after this point, anything that is printed or echoed will be captured by the output buffer. And then we can sandwich it between ob end clean, which is where it will say, okay, we're not interested in anything that's outputted after this point. And to get the contents of our output buffer, we're going to use ob get contents. And we're going to assign that to our variable output. And now we have something that we can actually assert on because we've got a variable with some data in it. So we can use PHP in it and say this assert equals only an output and our tests pass. Similarly, we can do the same thing for our other branch, our alternative branch, where we are passing it a yield to echo back at us. We can assert on that value, and it is also successful and passes. Another thing, the second thing that you're probably likely to encounter in your legacy code is static method calls. There are some reasons that people don't like static methods and the difficulty to test them is probably one of them. So anyway, we are Vegeta, and we have a scanner, and we've seen Goku, and we want to see what his power level is. And if his power level is over 9000, we're going to be like, it's over 9000! Otherwise it's like, okay, he's suppressed one. So this is our method, our get power level method that gets the result of Goku's power level and returns the correct response. So again, we're going to create our test class, and we've got two possible scenarios here. Either Goku's power level is over 9000, or it's not. So we're going to call power level, and we're going to assert on the result of that. If we actually look at Goku, the static power level method on Goku is always going to return 5000. Which means that this is fine, because 5000 is under 9000, so he's always going to return 5000 and it's going to be suppressed. But if we want to test the branch of it's over 9000, then it's not going to work, because it's never going to be over 9000. So how do we deal with this kind of scenario? We're going to create a new mock Goku, using mockery aliasing. I'll explain that in a minute. We're going to force the return value of Goku's power level to be 9001, which is indeed over 9000. And we're going to have to run our test in separate processes. It's kind of a weird thing I'll explain in a minute. So we're going to create our Super Saiyan Goku using mockery mock, alias, colon and then Goku's class name. The problem with aliasing is that it completely overrides the classes that already exist in your application. So you can only create an alias if your class hasn't already been loaded, for example via autoloading, which is why you can't use the colon, colon, class magic thing. You actually have to type the fully qualified name in the alias. So here, we have a Super Saiyan Goku. We're going to say that at some point during the execution of this code it's going to receive a call to power level and when it does, it's going to return 9001. So yeah, now our test is successful. So we've tested our two branches. So yeah, a note about using alias, because it does override the class that's in your application, it's kind of not recommended. So yeah, this is from the mockery documentation. It clearly says that even though it is supported that you probably shouldn't use it. So there are a couple of other ways to solve this. But the problem that it's going to present you is that when you run your tests it's probably going to complain that because you have some tests later that want to use the actual real class and not the class that you created that's a mock.  So what you'll end up doing is having to run the tests in your mocked class in a separate process and disable the global state so that it forgets that you've mocked the class after it runs this test suite. Which is fine, it works, but it's very, very slow. So not great. But if this gets you one step closer to testing your legacy code then it's all good, right? The third thing that we're going to consider today is hardcoded dependencies. Such as this. We're in Britain, I'm British and my outlook on life depends a lot on what the weather is like which is to be fair, mainly grey and horrible. So I have a method here getOutlook which creates a new weather forecast and it looks like a weather forecast and if it's sunny then it fills up my glass half full. Great. Otherwise my glass feels like it's half empty and I'm kind of a pessimist and it's going to return the value the glass is half empty or full depending on what the weather forecast is. Great. The problem is my weather forecast is just about as good as any real weather forecast and that it's pretty random. Sometimes it's sunny, sometimes it's not, sometimes it's correct, sometimes it's not. And yeah, our sunny method returns a random value. Great. My two scenarios, whether our glass is half full or a glass is half empty, we need to get the result of our outlook and assert on that result but half the time these tests are going to pass and half the time they're going to fail. Which isn't great because we kind of want our test to be a bit consistent. So yeah. We're going to look again to mockery and we're going to mock our weather forecast using a mockery override this time not alias. We're going to force the return value of is sunny to be true or false depending on what branch that we want to test and we can perform assertions based on those mocked return values and again we're going to have to look at running our tests in separate processes because mockery override intercepts a class on creation. So you would use an override for non-static methods when you're creating a hard coded dependency on the fly but you would use alias for static methods because alias creates a whole new class and override intercepts an existing class and turns it into a mock. So here's mockery coming we're going to use overload weather forecast you can use the magic colon class thing in this you don't have to type out the fully qualified name because it's an intercept rather than the creation of a class we're going to say that at some point it should receive a call to is sunny and when it does it should return true and in that case our glass should be half full great that works and again the other way around if we want to test the other branch we're going to say oh it's going to return false and our glass is half empty great but again you're going to probably find that you're going to have to run your tests in a separate process because there are probably other tests in your suite that are testing the forecast that you don't want to be mocked so in order for them not to all be mocked you need to run the tests in a separate process just fine it gets you moving on the way towards testing great cool but it's slow so there's a better way we can refactor this so we're going to refactor the code to use an injected dependency we're going to mock that injected dependency and we're going to inject the mocked dependency and then we can remove that annotation so who here has heard of dependency injection almost everyone okay who can confidently explain what dependency injection is few of you right so I'm going to demystify this for you here we have our get outlook and our new weather forecast this is a hard coded dependency because we are creating the dependency within our actual method instead we can inject our dependency using dependency injection that is creating a dependency outside of our method and passing it in parameter and that is the essence of dependency injection dependency injected now you know so in this case this is a safe refactor because I've given it a default parameter value of null and then in our next line when I'm getting the weather forecast I can either use the dependency that has been injected or I can do what it was doing already anyway so the behavior hasn't actually changed we can just create a new weather forecast on the fly if one is not being passed this means you don't need to go through your whole application and change all of the signatures to this method it just works and we've got our dependency injection in place so in our tests it means we can create a mock of our weather forecast we don't need to use overload anymore we can just give it the class name and create a whole new mocked class and that leaves all the other creations of this class untouched which is great we're going to say it should receive a sunny and return true and we're going to inject that dependency into our get out look method and hooray this works and we don't need this anymore cool that's solved there's another thing that you commonly encounter in legacy code and those are ungraceful exits the first kind of ungraceful exit I want to explain and demonstrate today is the redirect so you're the nicest around here and you want to enter the cave of Kabanog but there is a rabbit killer rabbit or there may or may not be a killer rabbit so if you do encounter a killer rabbit you're going to run away but if you don't then cool behold we're going to enter the cave of Kabanog so again we have our two branches to this you can either enter the cave safely there's no killer rabbit you're good or there is a killer rabbit there and you're going to have to run away you're going to have to redirect but when you run these tests or when you run these methods in these tests you're going to quickly find that everything goes a bit weird because there's a header change in there because the redirect is setting a header and you need to run it in a separate process just so that it doesn't confuse the entire test suite so that's one thing so when we try to enter our cave of Kabanog safely and there's no rabbit there it's pretty simple because nothing redirects us we just continue with the execution in the function and behold it returns correctly but we want to assert that when there is a killer rabbit in a way that we don't get behold but the odd thing is in this scenario that we do that's because in a test runner we don't have any headers or redirection or things like that in place so if we go back to our method it gets to the killer rabbit it goes okay I'm going to redirect but it doesn't because it's in a console it's a test runner it's not going to do and then it continues with the execution and it returns behold still this wouldn't happen if you were running this in a browser because you would get redirected and the execution would stop but in a test runner it does so we need to remember that if we're anticipating that a user is going to be redirected or the execution is going to stop that we actually make the execution stop that is to put return or continue or break or whatever it is to exit the execution of your method after redirecting or you could technically get the header and put it right at the end of your methods so that there's nothing that it could potentially do after that point so this is a safe refactor in that the actual behaviour of the method hasn't changed because after you've been redirected it would have stopped execution anyway so this is a way that you can make your tests work and everything is sane or the other way around return early so the header is the very last step and you don't continue executing something and get unintended consequences cool and we're asserting that when there is a killer habit in the way that we don't get behold we don't get thrown to the cave and we run away there's another type of ungrateful exit you know what's coming so we have Brexit we have our Brexit method and if we're a remainder we're going to say bollocks to Brexit and if we're not we're going to exit so we want to test our two branches of method either we're a Brexiter and the result is that we're going to exit we're going to crash and burn and everything's going to be horrible or we're a remainder and everything will be fine so in our test remainder function we have a Brexit our remainder is true and we're going to assert that the result of that function is that it says bollocks to Brexit cool successful but when we're a Brexiter and we run this method and we want to assert the result is empty it never gets there because exit does completely exit whatever your execution path is it completely exits the test runner so we need to think about refactoring this so that we can get this tested I like to create a wrapper around that exit functionality to remove it from the method and then we can inject that wrapper and mock it so that we're going to create sort of a fake Brexit with a bit of safe refactoring using our magical dependency injection so here's our wrapper around Brexit it's Boris and he's going to get Brexit done and he's going to completely exit cool and we have our Brexit method and we're going to pass in our Boris dependency and again we're going to give it a default value of null because this is a safe refactor we won't need to change any of our calls to Brexit because it will use a null value and if the value is null it will go and create a new Boris on the fly so yeah you don't have to change any of your existing code and instead of exiting we're just going to be Boris and we're going to get Brexit done so cool in our test Brexit method we're going to create a mock of Boris which is always fun and we're just going to make him do nothing he's just going to sit there and be silly and then we're going to well we've got to make sure that our first parameter to Brexit remainer is false and we're going to pass in the mocked Boris and yay this works don't try and unit test Boris because all he does is exit and it would be kind of pointless and I know that means that you're not going to have 100% coverage but it's just kind of a trade off that you have to make when it comes to testing legacy code this is another thing that you're going to encounter probably in legacy code and in code in general to be fair interaction with the file system so we're going to take a trip back to the 90s remember we had all those web pages on like geosities and they had all the animated gifs and stuff like that and also a hit counter because it was very important to show people how many people that actually visited your website so this is our hit counter and our hit counter method which counts hit and we have a hit counter file we're going to read the contents of that hit counter file and then we're going to increment it by one and save that back cool we want to test this so we test count hit we need to find the contents of that file before we count a hit so that's where we're getting our count before we're going to count the hit we're going to get the contents again and then assert that the value after a hit has been counted is equal to one plus the count prior to that but there's some problems with this because you're artificially inflating your hit count and that would be frowned upon because every time you run your test you're actually incrementing the value in that file so that gets kind of annoying and interfering and it just looks like we're more popular than you actually are so we're going to have to refactor this as well and again we're going to return to our trusty dependency injection and instead of hard coding the file name which is a dependency we're going to inject that and we're going to create a test double hit counter file and we're going to reset the contents of that file after each test just to keep it clean and make sure you don't end up with a file with a gazillion hits just a bit simpler so here is our dependency injection at work again we have a file parameter and we're going to give it a default value equal to the value that was already in the file so that we can either give it a new file name to use for example a test file or just use the file name that was already in there anyway cool so instead of using our actual hit counter file in our tests we're going to use testhitcounter.txt testversion of our hit counter we're going to inject that dependency and everything works in our teardown we're going to do just file put contents and reset our counter to zero in theory we could just assert previously that the count would always be one after running this method because if it has a zero and it's begin with then resetting the contents after each test run then it's always going to be one but there's a better way because with this you're maintaining a test hit counter file which kind of clutters things up it's a bit messy you have to make sure that's committed and make sure no one chooses the value of it so yeah there's another way and I'm going to introduce a tool today called vfsstream which creates a fake or virtual file system so instead of doing this testhitcounter file we can create a new virtual file stream using vfsstream and then we can create a new hit counter file using vfsstream new file give it a file name tell it where it wants to put it which is in the virtual file stream and we're going to set the contents of that file and then instead of a string file name we can pass it hit counter file URL which behaves in the same way file name to any other file on the system but it's virtual and we can always assert that it's going to equal one after we've counted a hit because it's setting the contents of zero before each test run so yeah that's quite handy we can just get rid of this stuff now we don't need it makes things a bit simpler everyone has to forget you right just maybe not in your code base so yes because you code that's the thing that you're going to encounter okay so I have a bolognase and for some reason well okay I have a bolognase it can be either eaten or not my place for is not I can eat the bolognase and I can check whether or not the bolognase has already been eaten and it also has palms and and looking into our eat method if we've already eaten a bolognase we can't eat it again obviously that would be weird if it doesn't have parmesan cheese on it or if I've eaten the parmesan cheese on it I want more parmesan on my bolognase because I quite like parmesan and it doesn't taste right without it but also I need to have garlic bread for my bolognase because it's not bolognase with a garlic bread right okay so I've got to have the garlic bread and if I'm eating the bolognase I'm going to eat the garlic bread as well and if I'm eating the bolognase I'm going to eat the parmesan as well and then it's going to say eating to be true this is a bit weird because it's spaghetti and I'm not sure why spaghetti is concerned about whether or not I'm also eating garlic bread or parmesan cheese to be fair so yeah this is literal spaghetti code there are lots of dependencies in there some kind of intermingle no one really knows what's going on no one really knows what to expect so if we want to test something like this we create our bolognase test file and we want to test what happens when we eat the bolognase so we're going to create any bolognase and we're going to eat it and yeah this works we're going to assert that after we've eaten our bolognase that he is indeed eating but there are a few tricky things about this because when you test something like that it does execute all of the code in there so it's going to look like in your test coverage that we've also covered a bit of parmesan and a bit of garlic bread which is a bit misleading so there's a covers annotation in PHP unit which you can use to specify what it is exactly that you intended to test so when it comes to spaghetti code you can tell it that actually although you've executed this function which has had a ton of side effects because everything's tangled up that I had only intended to test the bolognase and it will discard the coverage for everything else that it's come into contact with I also like to create reusable expectations so for example I might illustrate different process branches or scenarios that occur in multiple times or I want to test multiple times in spaghetti code I'm trying to explain so yeah I've added the handy covers annotation so when I eat the bolognase I'm telling it that I only actually intended to test the bolognase class and not everything else that seems to come with it and I want to test now that when I try to eat a bolognase it's already been eaten that it can't be eaten again and I also want to test that when I eat a bolognase that hasn't already been eaten that the correct behaviors occur so here are two tests bolognase that's already been eaten and one that hasn't when I run these tests I kind of want to check that when I'm eating a bolognase that hasn't been eaten that I also eat garlic bread so I've created a private function in my unit test class which is expect garlic bread to be eaten which creates a mock of garlic bread and overload because it's a hard coded dependency and I'm going to say that if I am garlic bread should be eaten so that I can use this expect garlic bread to be eaten elsewhere in my test so when I'm eating a bolognase that hasn't yet been eaten I don't want to expect to eat garlic bread but when I am eating an uneaten bolognase I do expect to also be eating garlic bread and that's just sort of one way of taming this spaghetti code whilst you attempt to refactor it a bit another thing that you're likely to encounter in any code is the private method so I have MC Hammer here and when you say stop he's going to say can't touch this and that's going to return hammer time so cool we can test can't touch this we're going to create a new MC Hammer we're going to call can't touch this and when that happens we're going to assert that it returns the result of hammer time but we can't we get an error because can't touch this it's a private method so how are we supposed to test this well don't just leave it test the public methods that use the private methods so they get tested by proxy that counts that's absolutely fine private methods are as they say private they are implementation details you shouldn't really care about them anyway so yeah feel free to ignore those so instead we're going to test stop and indeed that calls can't touch this which indeed returns hammer time and our tests are successful and there are no errors great so to recap I've explained a bunch of scenarios that you're likely to encounter in your work with legacy code hopefully you will be able to recognise some of these patterns and understand some of the techniques that you can employ to get these tested and once you've got them tested you can refactor happily safely nothing's going to go wrong legacy code is not something that you should fear or need to fear legacy code is an asset legacy code is what you are being paid to maintain and you didn't have to write it and now hopefully you understand you don't need to rewrite it either thank you


Hello and welcome to the session, let us discuss the following problem today. Find a quadratic polynomial is with the given numbers the sum and product of the zero respectively that is 1, 1. Let us write the key idea first. We know a quadratic polynomial when the sum and product of the zero are given is given by f of x is equal to k into x square minus sum of zeroes into x plus product of zeroes. Now let us write our solution. We know that sum of zeroes is given as 1 and product of zeroes is given as 1. Now using our key idea let us frame our polynomial that is equal to f of x is equal to k into x square minus sum of zeroes is equal to 1. So minus x plus product of zeroes is also equal to 1, so 1, plus 1. Now if we take k is equal to 1 to satisfy our sum and product of zeroes, we get our required polynomial as x is equal to x square minus x plus 1. I hope you understood the problem. Bye and have a nice day.


Hi everybody, Joe for Jaspy's case breaks.com coming at you with 2021 brand new release tops museum collection baseball six Box pick your team number seven second half of the case we popped open not too long ago There's everybody right here big. Thanks everyone for getting in on the action appreciate it Andrew ended up getting that last spot mojo with the New York Metropolitan So thanks to him for finishing off break. Thanks everybody for getting in on the fun now When we were doing break three, I marked all of these four so we all know that they're from the same case and Break five will be half case from a fresh case This is only our we've only done three breaks but Those three half case breaks that we've done Have been pretty we've been pulled some really nice hits out of there. So museum collection has been really delivering this year so far And hopefully that trend continues here in break number four Yes, yeah, and I did pull the frame auto. That's a one per case Frame I did pull that in the first half of this break. Let's go all card ship. So Everyone you'll be getting all of these is Garrett Cole to 150. All right behind Aaron judge Is silver ink autograph Ian Anderson 007 at a 200 That's Andrew H with the ATL I start Behind Mookie bets is Noah Cindergaard's 10 out of 35 two-color patch Meaningful material last spot mojo strikes again for Andrew H 70% of the time last spot mojo hits 100% of the time Behind Alex Kearlaw We've got Austin Meadows Quad relic looks nice 16 out of 25 Tampa Bay rays Sean oh and behind the sketch reproduction is Triple relic and autograph big boppy David Ortiz nice Sean oh with the bow socks And this stuff has been really nice 26 out of 29 right next box Sons at bucks pre-game action on the NBA network on the background still quiet on the baseball front until Well until tomorrow we'll get a full slate of games on Friday. All right next box See what we got There's Shoyo Tani. He's been looking pretty good Jacob de Grom three out of 50 That's gonna be for Andrew and the Mets behind the sketch reproduction of Lou Gehrig is Another Yankee Glaber Day Glaber Torres 87 out of 99 quad relic for Anthony and the Yankees There's Fernando Tatis jr. And that reveals another Yankee Gary Sheffield piece of his lumber and a piece of his jersey It's got some great penmanship to it's another one for Anthony and the Bronx bombers 176 out of 199 Behind Yelich is silver ink autograph his teammate Josh Hader 132 out of 250 Chad oh with the brew crew and behind David Ortiz is a red sock Raphael Devers meaningful memorabilia meaningful material that is 29 out of 50 Sean oh with the red socks. All right next box Logan. What's going on? All right, Logan your local car shop got an out of five trout autograph out of national That doesn't sound right Glaber Torres 99 Wait, no, you're a little cart shop saying they heard someone got an out of five trout Out of national treasures an autograph. That's probably mistake. This trout autographs are still exclusive to tops Maybe they meant a trout relic National treasure can get trout relics Anthony Rizzo Jonathan and the Cubs or they got a national treasures card autographed by Mike trout 127 out of 200 Nick Madrigal silver ink autograph for John and the white socks Behind the Bob Gibson's sketch reproduction card is Elvis Andrews dual relic and autograph I Coppola and the Rangers Rangers edition of Elvis Andrews 198 out of 249 15 out of 75 Cody Belanger quad rally No said in their shop like they pulled it from in their shop. I don't understand Logan that it was pulled from their shop Yeah, either way they're wrong Cody Belanger quad rally that's gonna go to Oliver Soria and the Dodgers Good luck. It could be I don't think it's true though I think someone someone mistake made a mistake or misheard along the way We are halfway through this half case break Final three boxes. Good luck got Bryce Harper to 99 Brady singer reveals a triple relic and autograph Trevor story Don't write in that homerun derby Colorado that goes to Heath. Does he get traded? It's possible 176 out of 199 Zander Bogarts is gonna reveal a quartet of Nationals Juan Soto Steven Strasburg Max Scherzer Luis Garcia 28 out of 99 for Alex and the Nats behind Kettle Marta Silver ink autograph Joe Adele nice 14 out of 50 nice silver ink autograph for Sean Oh and behind the sketch reproduction of Roy Campanella You have Willie ademis four out of ten Game use material for the raise Sean O'Leary right two boxes to go Remember the next half case break is gonna be from a fresh case boys and girls and that would be pick your team five Let's see where a pick your team five sitting at at the moment on jazzy's case breaks calm five left in pick your team five Cubs angels Mets Yankees Mariners Next box. All right, and there's Mad Max Scherzer to 50 that'll be for Alex and the Nats on This side Jorge Soler Reveals a pita Lonzo relic 25 out of 25 Really expect him to go back to back in the homerun derby But after his first round you looked at him.  That is ACL Andrew with the Braves and behind Trevor story dual relic an autograph Keston here up Chateau with the brew crew 145 at a 271 and The final box ladies and gentlemen good luck If you're looking for a personal box of this boys and girls still think there's some available on The Instagram stream at Jasper's breaks on Instagram live Follow us there. There's the final pack. All right, Aaron judge to 150 All right, let's see what the final four hits are going to be behind Bryce Harper is Silver ink autograph one gone Gonzalez 21 out of 300 Nice silver ink autograph for Ika Pola and the Rangers There's Alex Bregman Alex Bregman reveals a dual relic an autograph Starling Marta for the fish TJ with the Miami Marlins 198 at a 255 Behind Matt Chapman is a relic Dalton Varshow meaningful material to 50 Game use material going to Arizona Eric C with the snakes and Last but not least behind George Brett is a quad relic all the same team Joey Vado Nick Castellanos Mike Mustak is a Nick Senzel 12 out of 25 David Chan with the Cincinnati Red Legs. There you go, Dave And there you go everybody another great half case break of museum collection baseball in the books I was pick a team for I'm Joe for Jasper's case breaks calm. I'll see you next time for another one. Bye. Bye


So I'm Brian Steiner. I own No Ventum Customs software. And the title of this talk should be in the future tense. Sam, one of the organizers, was so excited for me to have a pull request submitted to core. In some of the printed material, it looks like it's in the past tense. So I have not patched core yet. So where are we gonna go? Today, we've already done the introduction. I'll give you an example. Then we'll go over some code. In the general case, with things that I like about WordPress core, we'll talk about my plugin and then the UI considerations, a lot of the boilerplate. For what I'm gonna show you guys, there's a lot of code duplication, a lot of boilerplate, and I think there might be a better way to accomplish that. So that's where we're gonna go. And then the questions, comments, criticisms at the end. And like Tim said, if you have a clarifying question or something I said doesn't make sense, just raise your hand, let me know and I can go into it a little bit deeper. Okay, so let me show you the actual plugin that we're going to be dissecting. So this is a reseller form that we created for Pete Oakley right over there, a webmaster located here in Albuquerque. And what this plugin does is based upon the reseller agreement. When I bring one of my customers to Pete and they become one of Pete's hosting customers, he needs to spin up a WordPress site for them. So we accomplish that. So we collect all sorts of DNS information. We say there's an existing site to migrate. It's gonna be 80 bucks to get this going with Pete. This is all using gravity forms. These are forms that Pete customized. And then my plugin is grabbing the data that it needs. And his password prompt requires a pretty strong password. So, and if I can type it in correctly, that would help. I was thinking about asking you to disable this Pete for the, okay, it's testing 123 exclamation with a capital T in case I forget. So we've submitted this form and hey, look at this. We have a new WordPress site. So this site didn't exist before we submitted the form. And we've got a number of non-standard plugins which are installed on the site already. So how is this being accomplished? We use the get option and the add option on the backend. And these are pretty good. So for getting options, you can either get individual options and you can update options with new values.  And I stole this example from these guys below. Also, you can do this in an array-based way. You can set all of your options in an array and then you can update them all at once. And I like this. Why have a bunch of individual options, right? Like let's have an array of options and you can also intersperse them. Sometimes you'll have a single scaler, sometimes you'll need an array. So what does this actually mean? Like, so how is this important? So if we look at the plugin configuration page and Pete, I added these as password fields so I wouldn't be exposing your secret keys to the whole world during this presentation. But what this means is that for these form IDs, these are the forms that I'm hooking into, that I'm processing the data from. And then these are the plugins that we're installing. And these are zip files that exist within a URL. And the specific versions are interesting. Hopefully these are the latest. And you can just really specify this as a URL and then the new sites will contain that plugin as long as the zip file is available in a valid WordPress plugin. And then we can add new ones. And this is the part that I've worked on recently is this dynamic ability to add and subtract plugins from the array that we're using for the variables. Because these things are always the same, these things can be of varying length. So how did we actually accomplish that? On the core end, I like that. But on the UI, it's kind of a pain, right? Like we have to have this dynamic JavaScript adding and removing things, a lot of boilerplate. See, this add another form, add another plugin, remove last, we generalize that so we can just remove the last thing when we click the remove button, that way we can't remove all of them. You have to have at least one. But the add ones are, if I added another type of thing we'd have a lot more code duplication there. So I don't really like that. So wouldn't it be cool if instead of this kind of thing, we have all of these, this HTML that's for the plugins and we have the remove another, add another, all this duplication is rows in our table, we had something like this. And we have this magic type, right? Or whatever you wanna call it. I mean, if you know Angular, you've seen this type of notation before. Where I create a document on load, I search for this and then I create the add and the subtract button dynamically and then all of the options are set based upon the parent. We could get the size, we could get the type, we could get everything else and then you wouldn't even have to write any of that JavaScript code, you just have to include this magical annotation and then the onload would run through, would look for these, would create the add and subtract button and then it would modify the DOM dynamically. So this would be like entirely in JavaScript, right? This would be totally front end. This would not be a backend modification. The backend using the form variable open bracket, close bracket is like totally fine. You just process that stuff inside of a loop in your PHP, in the PHP end, it's just, and that's great, right? That's like the standard way of doing this. Everybody does that for processing multiple like variable length array things. But on the front end, maybe it's not quite so standard, it's not so cool and there's a lot of code duplication. So this is my general idea. Maybe if other people are interested in this, if you've ever had these kind of problems where you're like, hey, I need a dynamically, like a dynamic list of options for my plugin, how am I gonna do it? This is how we did it and I think that there might be a general solution here. And that's pretty much all I've got. I'd like to give a shout out to Alonzo from 11 Online. He showed me his site spinner upper script which was a bash file and that gave me the initial idea for this. Pete Oakley paid for it. This is part of his reseller plan for his hosting business. I think 11 Online's in talks with him. Once you guys get resellers, you'll probably be using this form to spin up new customers for him. The WordPress Albuquerque community. Jamie back there, I remember when I knew nothing about WordPress, the work alongs were very helpful. Just being able to come and work on WordPress and learn about things was extremely awesome. And then my parents have always been very supportive of any of my crazy business ideas and quitting my well-paying job to start up a software company. So what do you guys got? Oh, and then we've got the GitHub for the code. So I don't wanna get a lifetime ban from WordCamp. So I have to show you guys and provide the code. So that's here under my GitHub. So that's it.  A question? Yeah. See the existing JavaScript? Yeah, it might be better for me to bring this up here. Is this readable? So grab this, grab this. I really didn't like this. Add the handlers, remove the last, populate. I don't like this either. It's like I added an extra one and then had to delete it or something like that. Yeah, and then we'd use the WP and Q script to handle that and generalize it a little bit more, right? Like I think the remove has been generalized well enough but not the add, so. Yeah. Yeah, you could just install this on your, so one thing that, yeah. Yeah, exactly. And right now, so this plugin needs to run on the same system that's actually spinning up the sites but you could just go in and you could install this and then you configure your gravity press form or yeah, your form to have these fields. And then as long as it has the fields like the client name, the site name, the different things that you need, then this would just, you'd submit a form and then you'd have a new site. If you want to add this to core, the idea that generalizeable, what are some of the other problems you were managing to provide? So it would just be this, right? This is what I'm talking about right here. Inside of a template file, how do you quickly and easily get this dynamic nature, right? So that's all I'm trying to solve. I wanted to give you guys an example of where this is useful. But all that I care about is having this ability to click a plus button and a minus button easily, right? You shouldn't have to know a ton of JavaScript to get this to work, I don't think. Like this is pretty, pretty basic stuff. And, but it's not easy. Like it took a while to get the JavaScript for this working and I don't think it needs to. I think this is an attribute of making a plugin that should be easy. I mean, it's really easy for these single scalar values, like super easy to get these in here and modify a plugin and say, hey, I want my plugin to take this or I want it to take that, but what if I want it to take a variable number of them? Then it's not so easy. So that's what I'm thinking is my idea. File system or did you actually put another plugin to integrate with that? So we're actually using the WPCLI, the WordPress command line interface to do the plugin installation on the resulting host site. So we make WPCLI calls to grab these plugins and install them after the form's been submitted. So. Well, from that perspective, it's on the host, right? Like, so WordPress fires off these processes and then the host is responsible for the WPCLI calls. So it's like a bash script almost. So yes, 100%. It would be pretty easy to generalize it to Ninja Forms or to any other form, but right now I'm not sure how we would do that, right? We have this gravity form hook and then we hook into the forms based on this form ID here. So we could do the same thing as long as Ninja Forms had the, you know, they have hook mechanisms as well, but right now it's just gravity forms. Is it dependent on that? That is a very good point. There are certain things such as this server pilot. So server pilot creates the initial site, right? We're not actually using WPCLI for that and that's a PIT requirement, right? So server pilot is this sort of like a single click installer and a way to manage your WordPress applications. We could do the whole thing using WPCLI, but then PIT server pilot instance wouldn't be aware of that. What we've tried to do is to put things as user configurable variables. There are some specific server pilot and some specific AW stats paths that are hard coded in here, right? So if you didn't use server pilot and you unchecked this box, that would be okay, but it's not quite ready for just, hey, let's spin this up on any site because of server pilot and because of AW stats. Exactly. Yeah, it's like bandwidth utilization, log watching, what's the current health and status of my WordPress site, mostly from a server level, parsing Apache logs and that sort of thing. It's another third-party tool which PIT uses for managing his installs, so. Do you see that you could probably add either things or even just the zip files of the WordPress sites themselves if you were to get a certain packaging system where you say they fill in the form and you're like, I want to migrate a site and you just add a section where they put their zip files? Yeah, we could make the migration a little bit easier, but realistically, with the work that you've done for Updraft and Duplicator, there are a lot of migration plugins that do a pretty good job, right? Yeah, I'm just using one of those. Like calling it? The thing of, it would depend on its WPCLI integration. I mean, we could, we could just have a, execute this arbitrary code section and then you run through, but I don't think that would be really in line with what we want to accomplish, which is the clean WordPress install with a bunch of plugins and some monitoring configured. So, so what else we got? You guys got any more for me? So you're suggesting, I mean, this whole business is about getting the, getting the cordial, that would be that your distribution may have a special jQuery library to handle, which you're using jQuery. Yeah, so I mean, I would write that and submit it as a pull request. Yeah, so it would be all jQuery. And because I really like the WP, get options and WP set options. Like those are perfect on the, on the server, on the backend, those are great. Nobody needs anything else, but on the front end, it's kind of a pain. So, what do you mean? Also, I have a lot of things for you. Oh, you mean like where they could put in comma separated values? Oh, I see what you mean. Yeah, yeah, like, yeah, I know what you mean. Yeah, yeah, yeah, that would be interesting. Right now, I mean, they're pretty standalone though, right? Like if you add a new form that we want to handle, you just do the plus or the minus, but I can see how those more complicated data type issues could arise. All right, you guys got anything else from me? Well, thanks for being in the audience and listening, hopefully that was interesting and you got a code review in.


isn't dependent on receiving a salary from a capitalist that's determined in a contract under a worker-starved choice. Firms could be structured in other ways. There's other ways to reward incentives and new ideas, too. Very quickly. Yeah, I mean, there's a lot of cherry picking going on here, right? In those areas like food, where it's been shown that socialism fails, then we want a little competition of failure. Healthcare, where I guess we haven't proved yet that everybody fails, we want complete state control and no competition of failure. I mean, what the socialists ultimately need is they need a sacrificial animal. And that sacrificial animal is the capitalists and the capitalism, that area in the economy that they allow to remain free, so they can milk it for all it's worth until it collapses and then entire society collapses. And you can see that in places like Venezuela right now, where they've milked it so much that there's nothing left to steal anymore because they've stolen everything.