You're might be introducing bogus characters. When someone posts sample code in a CODE block, click on the "Select all" link, then command-c to copy, then switch to Indigo, and command-v. Don't do anything else. Don't try to select the code manually.
The errors you're getting might be valid. I'm post code samples, but I'm not testing them myself. Can't do that without setting up all the variables. So it's possible the samples might have errors in them. So post the EXACT message you get, maybe with a cropped screen grab of the dialog box.