Buying A Car? 6 Things You Must Know

First thing you need to understand is that the car dealer is there to make money out of every single piece of the process. From $400 dollar protective door stickers to GAP insurance. Every part of that industry is about getting you to finance as much of their garbage as they can. This guide will help you break the process up into pieces so the dealer doesn’t end rip you off.

Secure Your Own Financing

The dealer has incentive for you to agree to a higher than normal financing. Some will get kick backs in the form of cash from the banks. Go to a trustable credit union and get approved for financing. They will approve you for a maximum amount and tell you the exact interest rate. With this you will know what your credit is worth.

When the dealer attempts to tell you that you’re interest rate will be an industry standard 8% you can tell them you have your own financing at 3.09%. If the dealer can beat that rate, excellent! If not or they try to use their rate to deny a discout. Then use your own financing.

The key here is that you have a set in stone interest rate that is FAIR.

Know The Value Of Your Trade-In

Get more than one cashable offer for your car. Whether it’s CarMax, Carvana or any of the dealers that are willing to pay you cash, get an offer and use that offer in your negotiation. If they can beat that offer, great, if not get your cash from the other dealer.

When you trade in your car to the dealer that you are buying from, they will use the value of that car in their negotiation. This includes refusing to discount the car stating. . .

“We’re already giving you a lot for your car”

If at any point they tell you they can’t remove a addon or discount the car because of your trade in value, let them know that simply won’t trade it in then. Buy the car without the trade-in and sell you old car the next day with the cash offer you received.

The key here is that you have a set in stone trade-in value that is FAIR.

Sell Your Car Instead Of Trading It In

If you are not in a crunch for time. Find out what your car is selling for at a dealer, list your car at that price on your own in any of the market places. Make sure that you do not accept lower than the offer your received above. If CarMax is willing to pay you $21,000 you should be able to sell it to someone for $23,500.

You can still sell a car that you owe on. Contact your current lender, or a nearby credit union to facilitate this task.

Start Your Negotiation With Zero-Down

Man and woman shaking hands with forms on table.
Photo by Sora Shimazaki from Pexels

The more money the sales team thinks you have in your pocket, the less likely they are to back down on the additional fees and up sells. They are even less likely to discount the car. Don’t tell the sales team, tell the guy in the very end that collects the signature for the contract. This is usualy the finance manager or finance department. They will first try to up-sell you on some stuff, when they are done with their pitch and are ready to print out the contract, hit him with the . . .

“Can you show me what the payment would be if I make a $2000 down payment now.”

At this time, you’ve already fought off the GAP, the service agreement and the extra layers of clear coat. The finance manager will have no choice but to simply re-run the numbers.

The key here is to force them to bring their costs down to make the deal happen before revealing that you have a down payment.

Don’t Pay For Anything That You Dont Wan’t

They are probably telling you the truth when they say they can’t take off the protective stickers, but that doesn’t mean you have to pay for it. It might be a grueling process in negotiation. But you can drive home with those protective stickers without paying for them.

“I understand the paint protection is a good deal. But i’m not on the market for paint protection. I wouldn’t pay for it even if it was only a dollar.”

Walk Away If You Have To

If they can’t meat your terms, write down you name, number, monthly payment AND term length and wish them a happy day.

“You know, I think we’re really close. But it doesn’t seem that you want to budge any more. Here is my phone number, my desired montly payment AND the length of the loan. Call me when you can make this happen”

What To Do With Your Stimulus Check

Stupid Memory: Floaty Magic Card Trick

When I was like 9, I saw someone do this at a magic shop on some pier. My breath was taken away by like. . . real magic. I couldn’t believe my eyes. I went into the store and watched the guy do it again and I was sold. I don’t remember how much it costed me, but I remember it was basically all the dollars I had in my pocket and I bought it. It might not have been a lot, it was a lot of money to me at the time.

I was completely smitten with the idea that I would learn how to do this. Held the box in my hands on the way home from the beach. I must have fell asleep on the way home because my next memory was the next day opening the box. I opened the box with excitement and found a F*CKING STRING with a tiny piece of wax.

I felt sick to my stomach, I put the string and wax back in the box and threw the box behind some large piece of furniture hoping I could hide the feelings of getting ripped off and becuase the trick was a lie. F*ck you Devin, I don’t even know if that was your name, but f*ck you none the less for ripping off 9 year old me. I disliked “magic” ever since.

What to do with your Stimulus Check

Featured Image by Alexander Mils from Pexels

It’s Stimulus Time!

Whether we end up with $600 or $2000, you might be wondering what you should do with that cash that we might get. These recommendations are meant to free up money each month so there is a lasting financial benefit, instead of a few purchases now.

House and Home Disclaimer

The first suggestion is the most important one. If you are in a situation where your house and home is at risk, you should take care of these necessities before reading on. Especially if you’ve lost your source of income.

  • Rent/Mortgage, You cannot afford to be on the street. Protection againts eviction is temporary and can be taken away by a congress lockup or govornment shut down. Make sure you’re paid up or saved up.
  • Food in the Pantry, You should be stocking your pantry with food that has a long expiration date. We don’t know what these next months are going to look like and there are no downsides to this. It will alleviate future grocery expenses, delivery fees and costly fast food trips.
  • Pay ahead on some critical bills, Take a look at your bills, you could make a large payment to a critical utility bill to float a credit to make sure that light/gas/water does not get shut off.
  • Save It! Please have a good understanding of your finances and be sure to save this extra money if your financial situation is uncertain.

As long as house and home is in order, keep on reading to find out how to make the most out of your unexpected deposit.

Refinance That Car

Car dealerships make money by selling cars, protection plans, protective sticker and most importantly finance deals. If you took dealer financing, you probably did not get the best interest rate. Take a look at a few websites for credit unions and find which is providing the best interest rates. You should consider refinancing your car if the current rates offered are lower than your current rate. The bigger the difference the higher the savings. Car loans are larger than credit cards so even 1% APR is a big difference on a car loan. This is even the case if your credit rating is exactly the same as when you first bought the car.

Quite simply, the dealership has no qualms with providing you with bad financing if it means getting the car out the door and potentially getting a kick back from the lender. Even if it means signing you up with a predatory lender.

To give you an idea of what a difference it could make. When I was young, I picked up a sweet Camaro at a big box used car dealer. I took dealer financing at 10.25% APR. The payment for that was $608 monthly. A year into that loan I refinanced with a credit union at 3.49% APR and my new payment was $456 per month. That saved me $152 per month on the payment and a ton of money in interest fees.

If re-financing your car seems outside of your comfort zone, get over it. Call up whichever credit union is offering the best rate and let them know you want to refi your car using that sweet check as a down payment.

Decreasing your monthly expenses with little/no risk might seem to good to be true, it’s not. Your fancy bank is making a lot of money from your payment and the credit union is making none. This is the process with which banks compete for your money, meaning the credit money would rather make $40 bucks a month in interest than $0 and they have no concern about undercutting the big guys.

High Interest Credit Cards

This might sound boring but it’s and incredibly effective way to free up some cash each month. Making these payment reduces your minimum payments and interest charges. Interest charges do in fact come out of your pocket, even if it doesn’t immediatelly feel like it. Consider you make a one time payment of $600 you would save 12.50 per month which comes to 150 per year. If instead you make a one time payment of $2000 you would save $41.67 per month which comes to $500 per year.

If you see those numbers and think “Hey that’s not a lot of money” consider if your neighbor was asking for $12.50 per month and offered nothing in return. You would likely tell him/her to bug off right.

Since minimum payment are typically calculated at the monthly interest fees plus 1% of the balance, you will likely see your minimum payment reduce by more than the interest savings alone.

Does this really help the economy? Considering that less money is going to the big banks and more to your pocket, I would argue yes it does. Having more cash on hand means you’ll spend that money on goods and services, hopefully at small businesses.

This should go without saying but, this only works if you do not immediately use that same card right after. If credit usage is needed again in the future, use the card with the lowest interest rate and push the heaviest payments toward the more costly cards.

Subscription Fees

If you have any services that are charged monthly, check to see if they offer annual plans at a discounted rate. Some companies off big savings when paying anually. Similar to the previous suggestions, this reduces money going big companies and keeps that money in your pocket. There’s also the added benefit of having one less auto payment coming out of your account each month for the next 12 months.

Here are a few services that offer savings with annual subscriptions.

  • Google One 1.99 per month to 19.99 per year saving $4 per year. This is small, but the savings increase slightly the larger the plan. If Google One is one of your necessities. No reason not to save a few bucks. $4 dollars is $4 dollars right.
  • MVNO Phone Plans Some MVNO Plans such as Mint Mobile offer larger savings the longer you pre-pay.
  • Playstation Plus $9.99 per month to $59.99 per year saving $60 per year and $4.99 per month.
  • Nintendo Online 3.99 per month to $19.99 per year savings around $28 bucks in total and a few bucks a month.
  • VPN Provider It’s common for VPN services to provide discounts when purchasing longer plans.

This should go without saying but, consider discontinuing services that you do not use. Please comment if you know any other services that offer savings when paying annually.

Smartify Your Thermostat

Swap out that old dumb thermostat with a smart thermostat to help reduce your monthly energy bill. It does a lot better job turning on and off when needed to keep things comfortable. Make sure you collect a rebate from your Gas and Electricity provider by checking both of their websites to find a unit that meets both of their rebate program requirements. I received a $75 dollar rebate by switching to a Nest Thermostat.

Greenify Your Appliances

While searching for the right thermostat. Also take a look at other rebates offered by your utility companies, These provide your rebates and reduces energy cost per month.

Some of the appliances listed on my local gas companies site include:

  • Natural Gas Dryer
  • Tankless Water Heater
  • Furnace

Short List

What about an extra car payment?

Well. . . there is a financial benefit to this, It’s just not on the top of my list. Here’s what happens, if you make an extra payment on a non-zero interest car loan, it will go directly to principle. It will reduce how much you are charged monthly in interest fees. The reason I’m not a big fan of this is that the payoff isn’t immediate since the monthly payment is locked by the contract. You will see the savings at the end of the loan, shortening the term by the extra payment and the avoided interest fees. The savings are larger the higher the interest rate and the earlier the extra payment.

The savings are so distant and they can be minimual is most scenarios. It has the most savings when you’re on a predatory loan and if you’re on a predatory loan you should be focused on refinancing to get out of that predatory loan. Truthfully, making an extra payment pales in comparison to simply refinancing with cash as a down payment. I included this simply to address the issues with the idea.

Pay Ahead On Your Car Insurance

You could cut down your monthly insurance payment by making a one extra payment. You could even pay it in full to not think about it for a while. The issue with this is its a dollar for dollar reduction. There’s rarely a discount attached to it and there are better ways. Some insurance companies charge a few bucks a month when paying monthly. You could avoid that extra fee, but there are better ways to free up monthly cash.

Why not Invest?

A dive deeper into why I’m not really suggesting investing right now. The market is volatile right now. It’s been making “records”, but a market is supposed to steadily increase year after year for many reasons. Calling these milestones “records” I think is an oversell. The problem is the risk factor right now. You could buy stocks and hope it goes up and end up with some returns in your pocket, which are taxed. But, if you can save 20 bucks a month by making a payment on a high interest credit card, that is a guaranteed return. It’s not a gamble or calculated risk, it’s a sure fire thing and there are no tax implications.

But I Needs Big TVs Yo!

That was in the voice of Beast Boy if you didnt catch it. Go buy your TV then Beastie. LOL. I’m not doing that right now because the mom and pop electronic stores aren’t really open and the big box guys are actually making a killing right now selling essentials. I’m not confident that buying stuff from the big guys is really making a dent in the economy, those guys tend to pay their execs and buy back stocks instead of giving bonuses to employees. If I were to buy a TV I would be sure to replace the TV or device that is the lease energy efficient with something that is better.

Roundcube Password Driver for TinyCP

How to enable the password driver in Roundcube (https://roundcube.net/) for the TinyCP Lightweight Linux Control Panel (https://tinycp.com/).

Instructions

  • Download the repository from the https://github.com/rimendoz86/rcpassword-tinycpdriver
  • Download the TinyCPConnector.php from your tinycp Settings.
  • Add the tinycp.php and the TinyCPConnector.php the roundcube/plugins/password/drivers folder.
  • update/resolve file permissions for www-data/apache.
  • In the roundcube/plugins/password/config.inc.php.
  • set the driver to tinycp,
$config['password_driver'] = 'tinycp';
  • and paste the following, updating the values for your own.
// Tiny CP
// --------------
$config["tinycp_host"] = "";
$config["tinycp_port"] = "";
$config["tinycp_user"] = "";
$config["tinycp_pass"] = ""; 

Great Science Podcasts for Coronavirus Information

Podcasts, for the most part, have yet to be overrun by corporations and political influence. It’s more of a free platform. Podcast shows are allowed to focus on their specific subject without worrying about the noise or the other sides. Here are some podcasts that do a great job. These are not all coronavirus podcasts but podcasts about science that are doing a great job covering the coronavirus from the Scientific perspective.

Photo by Andrea Piacquadio from Pexels

Science VS

Science VS by Gimlet

Science Vs by Gimlet it’s my top favorite. They have real experts who work in the medical research field. You ever hear about a recent study that shows this or that, this show actually has the individuals who did the study. The host Wendy Zuckerman does a great job keeping easy to understand vocabulary and often asks guests to elaborate for listeners. A lot of examples are included as well.

Why do I recommend this first? They do a great job at citing their sources by linking to them in their show notes. Meaning, if you want to learn more, or have reason to second guess their ideas, you can look for yourself. When we are in school, we have to cite our sources, why wouldn’t we appreciate a show that does the same for us.

To science lovers, this show takes the prize as learning about studies and hearing from exports is what we love the most. To science interested listeners it may be difficult to keep up to date because there are seldom laughs or excitement but the show does a great job keeping the vocab understandable to keep it from being a bore.

Coronavirus Content: High

Typical Runtime: 25-30 Minutes,

Support Model: Ads

Entertainment Factor: Science Lovers: High \ Science Interested: Medium

Short Wave From NPR

Short Wave From NPR

Short Wave by NPR does a great job of getting scientific information into your ears very quickly and efficiently. It’s great to listen to during work breaks or when laying your head to rest largely due to its short form. The host Maddie Sofia is very thorough and just line Science VS does a great job bringing those difficult concepts down to an understandable level. It’s short, to the point, and entertaining.

Coronavirus Content: Medium

Typical Runtime: 15-20 Minutes.

Support Model: independent, non-profit.

Entertainment Factor: Science Lovers: High \ Science Interested: High

Science Rules! with Bill Nye

Science Rules! with Bill Nye

I’ve always enjoyed hearing from Bill Nye in any form. Even though he’s not a traditional “scientist” but an engineer, he knows and does what scientists to best. Leave the subject to the experts, he does this by having guest hosts who are in fact an expert in the field. The entertainment factor is high in this one since, people love Bill Nye because he’s relatable, entertaining to listen to, and regularly drops cheesy jokes. The science lover will likely tune in every week without fail since it does a great job having great guests and interesting subjects. It’s also a call-in show so you can call the show, leave a voicemail and potentially have your question aired and answered on the show.

Coronavirus Content: High

Typical Runtime: 20-30 Minutes, Some as long as 50+ minutes.

Support Model: Ads

Entertainment Factor: Science Lovers: High \ Science Interested: High

StarTalk Radio by Neil deGrasse Tyson

StarTalk with Neil deGrasse Tyson

The TV show has yet to return but you can get your continued fill of science and laughs with StarTalk Radio. As advertised, StarTalk Radio combines science with pop-culture. Neil deGrasse Tyson is super easy to listen to and does a great job keeping the science accurate! His comedian co-host Chuck Nice keeps things funny enough to make you laugh while in traffic. Chuck has also become super darn knowledgeable himself, often citing articles he’s read or answering listener questions himself.

The guests are a mix of entertainers, comedians, political figures, and scientists. The entertainment factor is super high to the science interested because of the mix of guests but the science lover may prefer other shows due to that same mix. When I’m thirsty for science info, I would prefer to hear from people who represent science organizations instead of entertainers.

There are times that Neil goes on tangents without regard to his tone and doesn’t always realize that he interrupts other people. Scientists and science lovers aren’t exactly known for having great people skills so this doesn’t bother me much, but it could be abrasive to the science interested I’m not a particular fan of the sports edition shows, but I know the importance of opening the subject matter to capture more audiences. Listener questions are answers in the Cosmic Queries episodes.

Coronavirus Content: Medium

Typical Runtime: 40-50 minutes

Support Model: Ads, offers ad-free for Patreon contributors.

Entertainment Factor: Science Lovers: Medium-High \ Science Interested: Super High

Honorable Mentions

The Osterholm Update: COVID-19 by the Center for Infectious Disease Research and Policy with Michael Osterholm. The host is a long time expert in epidemiology and knows his facts. He knows what the science supports but will not hesitate to let you know when the jury is still out on a subject. He does talk about and consider other factors including economic impact and school closures.

Podcast-19 by FiveThirtyEight subject matter consists of only Covid-19.

Hopefully, you’ll check out some of these coronavirus podcasts. If you’re like me, you like this kind of brain food too.

Featured Image by Andrea Piacquadio from Pexels

Can’t get that interview?

I’ve spent a lot of years applying for jobs/promotions and getting nothing due for a few specific reasons. Once I changed my tailored my resume and prepared for my interviews I got the very next IT job I applied for. In the current economic climate it could be very hard to find work due to Coronavirus. But, here are some other things to consider.

Failing to tailor the resume to the position

My resume had so much focus on the skills that I pride myself in without asking if those skills even mattered for the position I was applying for. Ask a few friends who are already in the position for a copy of their resume and look at which of their bullet points also apply to your skills. Use your own words in your resume. Make sure the most important points are the easiest to find.

Hiring managers aren’t always going to take their time looking at everything. Especially when they are asked to sit in on interview panels and may have only had 1 minute or two to look at it before calling you in to the interview.

Preparing for the interview

Photo by Christina Morillo from Pexels

Compile a list of possible questions. Look for questions online for the position. Watch plenty of YouTube videos to get questions and answers. Pull the job description and create interview questions based on the bullet points. Write these questions on a list and the possible answers with examples. You won’t be able to predict what questions they will ask but if you have enough canned, and well thought out answers, you’ll have enough in your brain during the interview to answer most of the questions with not hesitation.

Actually answer the questions. Make sure the answers show that you have the knowledge needed, and a real world example that illustrates the skill. Ensure you use these during mock interviews.

Mock interviews might sound silly, do it anyways. Ask an honest friend to ask you the questions that you’ve prepared. Find YouTube videos, there are Make sure you are well prepared for these questions using the STAR method of explaining an example. You might have all the right answers in the world, but if you don’t realize that you’re sounding like an ass, you’re not getting hired anywhere.

Tailoring your interview answers to the job posting. If you have a degree and you’re applying for entry level jobs that don’t typically require a degree. You may be focusing your interview answers on your degree based info and not enough on the job description that you are applying for.

Final Note

Lastly, always consider all the side work you’ve done as a part of your employment history. If you have charged to fix laptops or spotty WIFI’s make sure that’s in there as self employed IT work.

Hopefully this helps you land your dream job.

DDNS Client using Node and Typescript

Project Description

Build an DDNS client using Object Oriented Programming and Async code that:

  • Checks the status of a web page.
  • If it’s down check that the DNS record matches the external IP of the server.
  • If not then update the DNS Provider with an HTTP Get request.
  • User can add more than one site.
  • The program will loop through each site on an interval set by the user.
  • The client will be able to make updates to freedns.afraid.org

Project Dependencies

Linux or Windows system running on the same web server, or network that share the external IP of the web server. Since node runs on either, the client will help keep your up-time for either kind of server.

Node.js The app will be written entirely in node. A back-end language built on Chrome’s V8 engine. version: 12.16.3 LTS.

Typescript (optional) If you opt-out of TypeScript, the assumption is that you know enough Node.js that you can figure out how/what to write based on the typescript. version 6.14.5

Planning

First we will list the separate responsibilities and use this plan to maintain Single Responsibility Principle

  • Interval Polling of site analysis.
  • Configuration of website information.
  • Checking site availability.
  • Checking DNS.
  • Updating DNS using HTTP Request.
  • Logging of Errors.

Initialization

Create a folder for the project. I will use C:/git/ddns-client but you can use anything you like.

Run the following commands in the terminal.

PS C:\git\ddns-client> npm init

We’ll start with an npm init to generate our package.json. If this is your first time, accept defaults. You’ll learn the rest along the way. Add a start script below. the package.json file contains the meta information about your project, the dependencies, and the start, build or test scripts that you define.

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node dist/index.js"
  },
PS C:\git\ddns-client> tsc --init

We’ll then use tsc init to generate our tsconfig.json. we’ll make the following changes to the tsconfig.json file.

"target": "ES2017",
"outDir": "./dist",
"resolveJsonModule": true,
//"strict": true,        /* We'll take advantage of typescript, but not to this extreme */  

TypeScript doesn’t ship with the knowledge of every possible import or language. This is on purpose to prevent projects from becoming too large with unused imports. run npm install @types/node -save-dev.

PS C:\git\ddns-client> npm install @types/node -save-dev

The -save-dev adds the dependency to the development dependency portion of the package.json.

How to transpile and run

Run tsc to transpile the TypeScript code into JavaScript and then run the app by running npm start.

PS C:\git\ddns-client> tsc
PS C:\git\ddns-client> npm start

Alternatively, open two terminals and run tsc -watch to automatically transpile every time you save. In another terminal run npm start when needed to start the app.

Terminal 1: 
PS C:\git\ddns-client> tsc -watch

Terminal 2:
PS C:\git\ddns-client> npm start

The Code

Create a fairly empty index.ts file. If you like, add a console.log(“Hello World”) to validate your setup.

We’ll next need to create our classes that will be used throughout the app.

Take note of how the Object.assign(this, initializer) is used in the constructor. For more explanation see Object.assign with this (Javascript). This will later allow us to map the JSON sites into our Site classes with minimal code.

Make an HTTP class. If you use any of the imports out there, find one that uses Promises. We’ll need that in our Async code later. Please examine the following code and comments.

We’ll also need something to check if the DNS is working okay. Not going to re-invent the wheel here. This is basic DNS lookup wrapped in a promise.

Before we can dive in, you need a working site. Define this information in a sites.json file. Modify the Hostname TestURL and Endpoint (username, password and hostname param) properties for your site.

Next we’re going to work on the logic piece. Examine the following code and comments.

No we’ll update the index.ts to start the application.

You can now run the app with npm start and run this through boot scripts or task scheduler.

Please comment below what should be added next to this project, Here are some things that can be added:

  • Save Error logs to JSON file.
  • Move configurable variables to config.json
  • REST endpoint to see status of sites with Express
  • Ability to sent HTTP Post requests.
  • Separate sites from DNS Provider.

Complete Code

Github Repository: https://github.com/rimendoz86/ddns-slim

CORONAVIRUS! Welcome to the artificial re-opening.

States all over the nations are allowing businesses to re-open. Some of the reasons out there are that the numbers are too small, the economy is more important, the numbers are fake or the models were wrong.

Photo by Tim Mossholder from Pexels

The problem with that is, you can’t wish the virus to go away. You can’t will people into not feeling sick. As long as the virus is very real, which it is, people are still going to use their better judgement.

Think back to early March before California’s stay at home order. I remember walking through downtown Riverside to get my coffee. The coffee shops, restaurants were empty. Some of the mom and pop shops were already limiting their hours, some closed their doors completely.

Lifting the stay-at-home orders, are not going to force people to leave their home. Those who understand the seriousness of this issue are still going to stay at home. Paychecks are not going to come back. Employment levels will not rise back up. Those re-opened businesses aren’t going to have enough customers to keep all staff employed.

Photo by B.O.A.photography from Pexels

There will be new problems. The once safe, essential, stores will no longer be safe. The cloth masks will no longer be enough, people will have to go out and find N95 masks. Making it more difficult for health workers to get them.

This re-opening is going to be an artificial one. Purely to give the appearance that there has been improvement. Just like the faith healers who claim to cure blindness and cancer, pretending that the problem is solved, does nothing for the ill.

CARONAVIRUS! So what’s it going to take for you to stay at home?

Photo by Markus Spiske from Pexels

Listen, I know you’re a smart person. I know this because I’ve known you for a long time. Long before the divisive red vs blue bullshit. You were, and still are my friend. But let’s have a little conversation.

I know you don’t agree with staying at home. Maybe you think the coronavirus is not really that deadly. It’s possible that you’re right. You might have heard something that makes a lot of sense to you. Maybe their right. And yeah… you need a haircut, it would be lying if I said it looks good. But, what would it take for you to simply stay at home.

Your parents and grand-parents made a lot of sacrifices for you to be here today. They worked hard hours long before civil rights and fair wages were a thing. They fought wars, collapsing economies, pandemics, discrimination, unfair terminations and worked overtime for nickels. If I said staying at home, is a small sacrifice compared to what they did for you, I would probably be right.

I’m not here to tell you that I’m right and you’re wrong. It’s not to counter your talking points. It’s not to tell you that you’re watching the wrong news channel, or listen to the wrong podcast. I’m not here to tell you that memes are jokes not facts. I mean I’ll probably do those things later in the social media comments. But that’s not what I’m here to tell you today.

We don’t need a million deaths for you to stay at home. You only need one.

Photo by Feedyourvision from Pexels

That parent or grand-parent wants to see you get that promotion you’ve been working for. He wants to see your kids go to college. Do it for them, do it for your friends and family. You don’t want to regret losing them to this stupid virus. You don’t want to lose that one person you looked up to you’re whole life.

So pop open a 12 pack of your favorite beers or wine cooler. Pull a chair outside your front door and have some drinks watching the movie called life. It’s what people did before they had cells phones.

Oh yeah, order some clippers or sheers and watch some videos on how to cut your own hair. You look like an animal.

Obect.assign with this (JavaScript)

Definition

“The Object.assign() method copies all enumerable own properties from one or more source objects to a target object. It returns the target object.” ~ Mozilla Developer Network

There are a million other post talking about what it does so instead I’m just going to dive right into the different ways that Object.assign (JavaScript) method can be used. Also if you’re go to isn’t already https://developer.mozilla.org/ for your JavaScript docs then you should start.

Dynamic Instantiation similar to C#

We all want the C# initializer in JS! So have it.

// the PersonCS class will be used in each example that follows.
class PersonCS{
    constructor(initializer = {}){
        this.FirstName = null;
        this.LastName = null;
        this.DOB = null;
        this.Height = null;
        this.GetFullName = function (){
            return `${this.FirstName} ${this.LastName}`
        }
        Object.assign(this, initializer);
    }
}
let person = new PersonCS({
    FirstName: "John",
    LastName: "Doe",
    DOB: new Date("01/23/2019")
})
console.log(person)
code output

Yep that simple: Replace your list of parameters with a variable and provide an empty object as a default value, then at the end of your constructor add use Object Assign to map the values from the initializer variable.

See how this is used in my next post DDNS Client with Node and TypeScript

Object Inheritance

You can inherit using using EcmaScript 6. We don’t always have that luxury. So here’s object inheritance using with a ES5 class

function Teacher(){
    Object.assign(this, new PersonCS());
    this.TeacherID = 0;
    this.PrimarySubject = "English"
}
console.log(new Teacher());

function Student(){
    Object.assign(this, new PersonCS());
    this.StudentID = 0;
}
console.log(new Student());
code output

Add the Object.assign method at the beginning of your class to effectively inherit the properties of the parent class.

Mapping

So you’re getting back some JSON from an API and you need to map it to your JS Method that has all the juicy Object methods you need for your project. This is more or less what this Object assign is used for.

var response = API.Response();

var models = response.map(element => {
    return Object.assign(new PersonCS(), element);
});
console.log(models[0].GetFullName());
// "John Doe" code output

It’s a simple way to change the object received by an API to the class defined in the JS project. Combine the Ojbect.assign with the Array.prototype.map method to have a ‘one-line’ mapping of parsed objects to your desired class.

Full Code: https://github.com/rimendoz86/Recks.pw-MethodOfTheWeek/blob/master/Object.assign/script.js