17 Reusable Code Snippet Topics
Remove Filter
|
|
Pretty neat text-based RPG that I made. Currently my first game. |
|
This is a small one. Some time ago this table came in handy, testing out low level multiplication. And I just love multiplication tables. We all do, now don't we? :) |
|
I accidentally posted a lower version of the game that had more flaws, and a few less features. This one has a few more minor bugs fixed, and a power attack instead of a normal attack. |
|
Saw [this](http://www.daniweb.com/software-development/cpp/code/216430/add-a-little-graphics-to-your-console) and decided to make a little spinoff with some physics of mine. Enjoy! |
|
The luxuries we now have in the amount of pixels on a screen to draw some amazing graphs with, were lacking in the early days of computing. Most of the time you had to resort to rude printed output. It wasn’t that bad always. Sometimes it was and still is … |
|
Many situations arise when you have to choose between two options: true/false, male/female etc. This short snippet will only allow two chars to pass through: capital 'Y' or capital 'N'. The Read and ReadLine methods can serve also, but have the side effect you have to use Upper and Lower … |
|
I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. … |
|
I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. … |
|
This is another useful script I came across. It prints a color-code chart in your terminal. It can help you find the color-code you are looking for, or view the current color-scheme you are using (people use it on reddit/r/unixporn to show off their system's theme, I use it to … |
|
I didn't write this, the credits are in the code. It's a code-golf version, and I'm sorry about that. I am trying to 'decode' it but I don't have the skills, so the 'decoded' version doesn't have the right colors. This is an example of what you can do with … |
|
I borrowed this from C#, where you can easily send output, that normally goes to the ugly black console window, to a nice looking Windows MessageBox with an OK button to close after you read your results. You can accumulate your output in a string to send to one message … |
|
Start a new console application and fill in the about 70 lines of code in the Program.cs file. Run and enjoy! |
|
This is similar to earlier posts in DaniWeb by vegaseat, but it demonstrates getkey with withdrawn tkinter, restart inside object by re-calling it's __init__ method. |
|
Short piece of code to add a "menu" to your Console application. |
|
Well, it bothers me to build menus for every shell application that needs one. So, I've written a module to handle that, like in the good old turbo pascal times. :) Here it is, the module comments are pretty explainatory, I think, and the sample usage if run as script … |
|
Most people would do something like this: [icode]input("Press any key to continue") #or raw_input[/icode] This way, if the user presses a key other than the Enter (return) key, then the program will still continue. It looks something like this: [URL="http://i42.tinypic.com/2yvp9hj.png"]http://i42.tinypic.com/2yvp9hj.png[/URL] |
|
Well, I don't think I can make this any simpler. I hope newbies in the C# language can learn from it. |
The End.