Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
enterprise_time_extensions
Advanced tools
h1. Enterprise Time Extensions
Enterprisey extensions to Ruby's Time class. How else will you know when it's OK to stop avoiding work, and you can actually leave work?
Example:
h2. Un-Fun, All-Business Instance Method Examples
t = Time.now #=> Fri Jan 09 22:12:31 0100 2009
# Enterprisey methods in action!:
t.after_hours? #=> false
t.holiday? #=> false
t = Time.local(2009, 12, 25) #=> Fri Dec 25 00:00:00 0100 2009
t.after_hours? #=> true -- because it's a holiday
t.holiday? #=> true -- I told you!
t = Time.local(2009, 1, 9, 18, 30) #=> Fri Jan 09 18:30:00 0100 2009
t.after_hours? #=> true -- Business hours are 8AM to 6PM ... SHARP!
t.holiday? #=> false
There are question mark methods for the holidays that are paid-time-off for slaves of The Enterprise.
If you need/want more, let me know! You're welcome to do it yourself, if you wish.
h2. Frank, Straight-Shooting Class Methods
# Countdown to the next football game?
Time.next_sunday #=> Sun Jan 11 00:00:00 0100 2009
# The big one:
Time.nth_wday(3, 6, 7, 2009) #=> Sat Jul 18 00:00:00 0200 2009
Time::nth_wday could probably use some explanation. Time::nth_wday will find the 'nth' week day of a month. Above, we found the 3th (hehe) Saturday of July 2009. This is actually used often in the various holiday methods from above. For instance, Thanksgiving is on the 4th Thursday of November. The method looks like this:
def self.nth_wday(n, wday, month, year)
# ...
end
Enjoy!
(I feel obligated to tell you, honestly, that the environment at nFrame is far removed from the usual negative implications of the word 'Enterprise'. It's quite nice, actually. Oh, and we only have like 40 total employees.)
FAQs
Unknown package
We found that enterprise_time_extensions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.