10 Reusable Code Snippet Topics
Remove Filter
|
|
For those who are afraid of lycanthropes and full moons, here is a way to figure out the phase of the moon. |
|
Some folks go on vacation around the Easter holidays, so it would be nice to know when Easter happens in the years ahead. I had this as a Python snippet in my "oldies, but goodies" file and translated it to Go. It was actually quite easy in this case, and … |
|
OK I know the DateTime structure is very good at doing this. But if you ever wanted to design your own calendar, or just wanted to know how things are possibly done, this could be a handy function. Enjoy. |
|
I did code for challenge that I saw posted for C# by deceptikon: http://www.daniweb.com/software-development/csharp/threads/479304/coding-challenge-string-to-date Here it is. Of course normally the code would be without prints and put in function, but this is enough for now for me. There could also be normalization from '/' separated form not producing ambiguous … |
|
Programming just for fun. |
|
Just a quick snippet for beginners |
|
Is it Mother Date and Father Time? Any way, getting all the different date and time displays working can be imperturbably perplexing at times. You take a look at it in this Windows Console Application. |
|
To be more clear, I post this 'unnecessary optimization' of Vegaseat's code in new thread instead of end of old one. Just to show that this is even simpler than [URL="http://www.daniweb.com/software-development/python/code/363346/1554115#post1554115"]checking if given day is first weekday of the month[/URL]. |
|
Here tool functions, which came up during discussions earlier. Expanded slightly, added elimination of traceback prints by try..except. Added dd.mm.yy routine as that is format in my home country Finland. Optimized docstring beginnings to be informative in editor tooltip (at least IDLE shows, but code must be run or imported … |
|
This is a simple code-snippet that can be used to parse dates with javascript. It's setup to use European dates (dd.mm.yyyy | dd/mm/yyyy | dd,mm,yyyy), but it can easily be setup to use american dates as well (mm/dd/yyyy etc), to do so simply replace "$1" with "$2" and "$2" with … |
The End.