I'm new to using Ruby and this tickled me pink
-
Complicated or not, the interfaces suck. And dont have to. And that's the problem.
exactly why I wrap the parts I need, it's like git, tons of power, zero help.
-
365.2425
didn't we gain or lose 0.00000001ish of a day recently? Like from tonga exploding or antarctica melting or something i can't remember.
-
365.25, surely
Sure, if you want things at midday instead of midnight.
-
The Python won't give an accurate date here because it doesn't take into account leap years.
Does the Ruby version do that though?
I haven't got it installed to check, but seeing constants like SECONDS_PER_YEAR in the documentation makes me think it's just as bad if not worse.
https://api.rubyonrails.org/classes/ActiveSupport/Duration.html
-
I just started a new php gig
I work with Delphi.
-
This post did not contain any content.
Using ruby felt weird, it felt like it shouldn't work but it does.
-
didn't we gain or lose 0.00000001ish of a day recently? Like from tonga exploding or antarctica melting or something i can't remember.
That kind of thing happens surprisingly often.
-
Ok, everyone who's ever had to use datetime hates it, but not because it's insufficient, but because international date/time is such a nightmare that the library must be complicated enough to support all the edge cases I'm convinced that library has a function for traveling trough time.
For years I've wrapped datetime with custom functions that do exactly and only what I want to mitigate its all-plumbing-zero-porcelain approach to the problem.
-
I like Fish Shell better than python, not gonna lie. Easier to read and write. Especially if you already live in the terminal.
Python is more system agnostic though.
-
timedelta
marks time in days, seconds, and microseconds. It doesn't take leap years into account because the concept of years is irrelevant totimedelta
. If you need to account for leap years, you need a different API.You can subtract two dates and get the exact time difference.
-
This post did not contain any content.
I miss Ruby DSLs so much. Python is bland. It's on purpose, I know and even appreciate it.
Yet I feel like Ruby syntax magic compared to Python blandness is like comparing a steaming plate of beautiful aromatic curry to plain rice.
-
Python is more system agnostic though.
Lucky for me I control all the machines I write scripts for. So far...
-
LLM is saying this is a feature of Rails and not particularly Ruby.
I was surprised Python didn’t have a years parameter but learned about
relativedelta(years=10)
LLM is saying...
Stop. Nothing at all past those three words is worth a damn.
-
LLM is saying...
Stop. Nothing at all past those three words is worth a damn.
What is the purpose of this comment.
-
This is exactly why I love PowerShell.
Need the [DateTime] object from 10 years ago? No biggie, just chuck
(Get-Date).AddYears(-10)
down your console.Need it in a specific timezone? That one's trickier, but since PowerShell can do .Net, run this:
$TargetDateTime = (Get-Date).AddYears(-10) $TargetTimeZone = "India Standard Time" $tz = [TimeZoneInfo]::FindSystemTimeZoneById($TargetTimeZone) $utcOffset = $tz.GetUtcOffset($TargetDateTime) [DateTimeOffset]::new($TargetDateTime.Ticks, $utcOffset)
And you get a DateTimeOffset object, which is this beauty:
DateTime : 25/08/2015 23:15:14 UtcDateTime : 25/08/2015 17:45:14 LocalDateTime : 25/08/2015 19:45:14 Date : 25/08/2015 00:00:00 Day : 25 DayOfWeek : Tuesday DayOfYear : 237 Hour : 23 Millisecond : 421 Microsecond : 428 Nanosecond : 600 Minute : 15 Month : 8 Offset : 05:30:00 TotalOffsetMinutes : 330 Second : 14 Ticks : 635761413144214286 UtcTicks : 635761215144214286 TimeOfDay : 23:15:14.4214286 Year : 2015
DateTime
is the time in your target timezone,UtcDateTime
is, well, the UTC time, andLocalDateTime
is the time on host you ran the commands on. -
What is the purpose of this comment.
You didn't seem to be ashamed of admitting to asking an LLM a question as if it was helpful, wise, or respectable for you to have done. You should be.
-
You didn't seem to be ashamed of admitting to asking an LLM a question as if it was helpful, wise, or respectable for you to have done. You should be.
This is a poor perspective to have on things towards a stranger on the internet. I hope you’re just having a bad day and that things get better.
-
People still use ruby?
You probably use it everyday and didn't know it https://github.blog/engineering/architecture-optimization/building-github-with-ruby-and-rails/
-
This post did not contain any content.wrote last edited by [email protected]
There's two of these threads?! Well ok here's the same comment.
10.years.ago On.a.cold.dark.night There.was.someone.killed 'Neath.the.town.hall.lights There.were.few.at.the.scene Though.they.all.agreed That.the.slayer.who.ran Looked.a.lot.like.me
-
ahahaha oh come on, the comment was clearly a joke. To be honest, I'd be far more interested in gothly serious sam on the left.
wrote last edited by [email protected]Can't see the comment but judging by the uname you're right, that's Frank Reynolds' fake name from It's Always Sunny, Mantis Toboggan M.D. lmao. I'd wager 95% of what that person says is at least intended to be a joke/satirical/etc.