10 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for Gribouillis
Member Avatar for Gribouillis
0
503
Member Avatar for ddanbe

This is just for fun. You know how old you are(I hope), but do you know how many days you are walking around on this planet? The two routines presented here could be used more practically in an ever present employee application.

Member Avatar for ddanbe
0
696
Member Avatar for vegaseat

With the advent of Python33 the module time has received a high resolution timer/counter. Here we use time.perf_counter() in a decorator to conveniently time two test functions.

3
2K
Member Avatar for vegaseat

Starting with Python 3.3 you now have access to a high resolution time counter (nanoseconds and better).

Member Avatar for vegaseat
6
4K
Member Avatar for tyson567

//$time in the second php code hold the time stored in the database in the same format as above(ie TIMESTAMP Format) //Save the first php code as timeago.php //include first php code u saved in the second php code as i have done.. //Use the Second Php code Wherever You …

Member Avatar for tyson567
0
1K
Member Avatar for JJCollins
Member Avatar for vegaseat

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.

Member Avatar for Tsawm
0
913
Member Avatar for TrustyTony

The code demonstrates running program limitted time by following going over endtime expressed in seconds since midnight, so might fail for playing just midnight (add check that endtime is less than 24*60*60 if you want to be sure). Exciting action :) of the program is that it shows remaining time …

0
443
Member Avatar for TrustyTony

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 …

Member Avatar for TrustyTony
1
951
Member Avatar for sravan953

The user enters the full location of a file and the program determines whether the file is a sound file or an application and opens it after a user specified time. Example: Location: C:\Where ever\file.mp3 OR C:\Another Where Ever\prog.exe TIme(in mins): 10

Member Avatar for sravan953
0
279

The End.