17 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for restrictment
Member Avatar for ddanbe

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? :)

0
436
Member Avatar for restrictment

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.

Member Avatar for krieg
0
678
Member Avatar for William Hemsworth

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!

Member Avatar for YassinTAH
1
437
Member Avatar for ddanbe

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 …

Member Avatar for ddanbe
1
3K
Member Avatar for ddanbe

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 …

0
249
Member Avatar for chriswelborn

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. …

Member Avatar for chriswelborn
0
298
Member Avatar for chriswelborn

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. …

Member Avatar for chriswelborn
0
378
Member Avatar for chriswelborn

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 …

0
371
Member Avatar for chriswelborn

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 …

0
1K
Member Avatar for vegaseat

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 …

Member Avatar for nagendra_rao
0
852
Member Avatar for ddanbe

Start a new console application and fill in the about 70 lines of code in the Program.cs file. Run and enjoy!

Member Avatar for ddanbe
2
402
Member Avatar for TrustyTony

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.

Member Avatar for TrustyTony
2
2K
Member Avatar for ddanbe
Member Avatar for Beat_Slayer

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 …

Member Avatar for Beat_Slayer
0
2K
Member Avatar for jcao219

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]

0
216
Member Avatar for ddanbe

Well, I don't think I can make this any simpler. I hope newbies in the C# language can learn from it.

0
1K

The End.