« first day (1064 days earlier)      last day (2191 days later) » 

12:23 AM
I would suggest setter/getter
But I don't see the problem with dependency injection
The constructor would basically look like this:
def initialize(siblings)
  @siblings = siblings
end
The calling class would (presumably) manage the lifetime of the object, including adding/removing it from the list
 
 
11 hours later…
11:20 AM
Oh boy. When they said "allowing many-gigabyte files to be stored in only a few kilobytes", they weren't being hypothetical...
 
11:47 AM
@JanDvorak ?
 
Today's AOC
in SO Close Vote Reviewers, 29 mins ago, by Jan Dvorak
A good algorithm is the difference between taking forever and 0.01 seconds on that one. You'll have to cheese it.
 
12:44 PM
Is nested string interpolation bad, really bad, or kinda OK?
 
I can't think of a situation where I'd need nested string interpolation
 
lands_str = next_lands.select(&:unlocked).map{|land|"#{land.name}(#{land.code})"}.join(", ")
#{lands_str} are available to you."
 
1:16 PM
Is there behavior there that you can move into Land?
But what you've got there isn't odd. Could maybe stand to delegate some work to other objects.
 
Good point to delegate stuff to Land, thanks
This is a part of the UI code (which wasn't made in OOP style)
I guess I shouldn't have .compact.flatten in my code...
 
Does #compact implicitly flatten?
 
I don't think so. I meant I should turn those nils into empty arrays.
 
 
4 hours later…
5:03 PM
i am back!
:)
 
Welcome back, Nima!
@JanDvorak The Array() function will turn nils into empty arrays.
 
thanks @WayneConrad !
 
@Nima The last time you were here, you said you hated time zones (still starred on the right).
 
haha lol
i went nuts with DST stuff
with rails.
 
tzt
 
5:10 PM
we had a test that would randomly fail only on the week of November 6th after 7PM lol
 
Oh that's wicked.
I've had tests like that. We had programmers that would write tests that would break as soon as the next year rolled around. I had a bit of a career fixing those at my previous job.
 
it drove us crazy figuring out why it was failing
and you guessed it.. because of day light saving !
 
We don't do DST in Arizona. Yay for my state.
 
Yay for your state... boo for Nima who had to code just for it ;)
 
yea lol
 
5:24 PM
DST switching - the only time that happens twice.
It also throws up all time tables
 
Yea... everyone should just live in UTC
 
At least, code should live in UTC. We've got a rule where I work (wherever I work that I get to make rules) that timestamps include the time zone always, and are preferred to be in UTC when in the database.
Then convert from/to the user's time zone on input/output.
The team before this one used local time, but is country-wide. So... chaos in the legacy databases.
 
At least they're not local time marked as UTC
 
@WayneConrad You only have to encounter that situation once
The last-last place I worked has an app being used all over North America across multiple timezones, and it was a complete disaster for several weeks
 
@JanDvorak Actually, i think they are.
 
5:38 PM
NIce
 
And, of course, I made the same mistake, earlier in my career. Which is how I know it's a mistake.
Good decisions come from experience; experience comes from bad decisions.
3
 
5:52 PM
Yea, when the junior devs are like "how did you even know that?!" my explanation is usually "because I broke it before"
 
 
1 hour later…
7:00 PM
When I type gem server, it starts a local web server I can use to look at all gem's rdocs. But the formatting is awful. Can I add toss some CSS into a directory somewhere to make it actually be readable?
 
7:42 PM
Yay, I got an up-vote for one of my lonely questions.
 
 
3 hours later…
10:25 PM
Oh man, I forgot to go home, and now traffic is getting bad. Surface streets for me.
I got into writing documentation and lost track of time.
 
Anyone know how I'd write this if I wanted to run, rake first second , and stop execution before second because of some check in first
 
Have second depend upon a new rake step to check git status; the new rake step fails if the git status is not right.
If second is one of your own rake tasks, just add the dependency to the new "check git status" step.
If second is someone else's step, you can still add the dependency.
15
A: Add task dependencies to Rake::TestTask

maprihodaRake enables redefining existing tasks, so this should be possible (add it to your existing code): task :integration => :clean_database

 
10:41 PM
the second is db:migrate =\
only want to run that if its on node 0
 
The new step can check what node it's on and behave appropriately.
task :check_git_status do
  if node0?
    ...
  end
end

task "db:migrate" => :check_git_status
 
oh neeeeat
 
Rake is pretty spiffy.
 
does returning false fail it?
or do i have to raise something.
 
One of the earliest widely successful DSLs for Ruby.
50
A: How to explicitly fail a task in ruby rake?

Richard CookUse the raise or fail method as you would for any other Ruby script (fail is an alias for raise). This method takes a string or exception as an argument which is used as the error message displayed at termination of the script. This will also cause the script to return the value 1 to the calling ...

 
10:52 PM
Oh... well then... Thanks for being awesome at google for me :D
 
It's good knowing what to google for; I knew the right search term.
Alright, traffic time. Talk to you all later. Have a good weekend.
 
Yea, rake chain and rake dependent weren't too successful. I learned how to chain together 8 methods in rake and have them all run if one fails...
kind of the opposite of what I wanted :P
 
It's frustratingly hard to google for specifics on a Ruby internal DSL. For one thing, they all tend to be called common English words. I hate that.
 
Awesome... bundle exec rake db:migrate; rails s hopefully is the trick I needed...
Thanks
Now you can go enjoy your weekend knowing you accomplished something far off in the world ;)
 

« first day (1064 days earlier)      last day (2191 days later) »