If you want to be able to run things locally, you can use something like Atom, GitHub's text editor. With the HTML preview option it's fine for web development, and I use a terminal add-on (terminal-plus I think) to run test code that doesn't use HTML.
Other options instead of CodePen include JSfiddle and JSbin. All three allow you to register accounts and save projects.
Hope that helps!