Spark Core Battery Percentage Checking

The spark is arduino-like - it supports a large portion of the Wiring API, so porting high-level code is very straightforward. However, the code you're looking it as low-level code that uses specific features of the arduino chip. The spark isn't an arduino but an entirely different processor, and has its own set of low-level features.

The first thread you linked to provides some hints on how to obtain a bandgap reference.