Which kind of license you should pick depends on what exactly you mean by "claiming it and then preventing others from using it in the future".
The two main styles of licensing are:
* Permissive (BSD-style, MIT-style): Anyone can use your code for any purpose, including in proprietary products, but they must retain the copyright notice.
* Copyleft (GPL): Anyone can use your code, on the condition that any software they use it in gives the same freedom to reusers.
Which you should choose depends on what you'd consider fair/unfair reuse of your code. For example, if Microsoft used an adapted version of your code in the next version of Excel, would you consider that a great thing, and be happy to see your code out there, or would you consider it a betrayal of your intent for someone to adapt a version of your code and then keep the adaptation closed-source?