This clip from Comedy Central illustrates it nicely.
As the NPR blog honestly explains, their definition of code-switching is a tad looser than linguists might have it:
Linguists would probably quibble with our definition. (The term arose in linguistics specifically to refer to mixing languages and speech patterns in conversation.) But we're looking at code-switching a little more broadly: many of us subtly, reflexively change the way we express ourselves all the time. We're hop-scotching between different cultural and linguistic spaces and different parts of our own identities — sometimes within a single interaction.
When you're attuned to the phenomenon of code-switching, you start to see it everywhere, and you begin to see the way race, ethnicity and culture plays out all over the place.
You see it in the political world. In January 2009, then-President-elect Obama went to Ben's Chili Bowl, a famous eatery in a historically black D.C. neighborhood. When the (black) cashier asks him if he needs change, Obama replies, "nah, we straight."
It's clear that we all do this to some extent; I know I do when I switch between talking to other teachers in the workroom and talking on the phone to an electrician. It's a natural part of language use: adapting what we say to fit in with our perceptions of how we might be perceived. You get me?