You can always get together, cleanse the code of any IP entanglements, and compete with the company that just laid you off. Calls like this one are a good time to suggest it--even if only to make them squirm.
Legal in California, illegal in New York (typically 2-3 years).
That assumes that the code itself was what made the company competitive and brought in the money to begin with.
If I were laid off by my current employer, who has a giant sales team and likely thousands of contracts in every state with most of the existing potential clients, the odds of me being able to compete against them somehow dip into negative numbers.