« first day (703 days earlier)      last day (2552 days later) » 

Anonymous
1:19 AM
@Josh I recommend completing the advent of code calendar (see pinned star message)
 
Anonymous
Using Crystal instead of Ruby - Why Crystal?
 
4:17 AM
@HunterStevens thanks, I'll crack on!
 
 
2 hours later…
6:41 AM
#307 to complete AoC#14. ... yay?
 
 
3 hours later…
9:21 AM
o/
 
 
4 hours later…
Anonymous
12:59 PM
\o
 
1:10 PM
Good morning, all.
 
Anonymous
How was everyone's weekend?
 
Stuck in a hospital Since early Sunday. Nothing frightening. Waiting for the kitchen to open so I can get breakfast.
 
Anonymous
:O What's wrong, @WayneConrad?
 
Good morning
What do you guys think of my personal site?
joellusky.github.io
 
Anonymous
This is what displays after running ./configure for Asterisk PBX:
 
1:19 PM
Rare malady. Idiopathic omental ischemia. It sounds worse than it is. Chances are they will write me a script for some pain pills and send me home today.
 
Anonymous
gist: post configure for asterisk 13.6, 2015-12-14 13:19:26Z
               .$$$$$$$$$$$$$$$=..      
            .$7$7..          .7$$7:.    
          .$$:.                 ,$7.7   
        .$7.     7$$$$           .$$77  
     ..$$.       $$$$$            .$$$7 
    ..7$   .?.   $$$$$   .?.       7$$$.
   $.$.   .$$$7. $$$$7 .7$$$.      .$$$.
 .777.   .$$$$$$77$$$77$$$$$7.      $$$,
 $$$~      .7$$$$$$$$$$$$$7.       .$$$.
.$$7          .7$$$$$$$7:          ?$$$.
$$$          ?7$$$$$$$$$$I        .$$$7 
$$$       .7$$$$$$$$$$$$$$$$      :$$$. 
$$$       $$$$$$7$$$$$$$$$$$$    .$$$.  
$$$        $$$   7$$$7  .$$$    .$$$.   
$$$$             $$$$7         .$$$.    
7$$$7            7$$$$        7$$$      
 $$$$$                        $$$       
  $$$$7.                       $$  (TM)     
   $$$$$$$.           .7$$$$$$  $$      
     $$$$$$$$$$$$7$$$$$$$$$.$$$$$$      
       $$$$$$$$$$$$$$$$.                
 
Anonymous
Is that new? I do not remember gists showing in stack chat before...
 
Probably
 
I'm not so sure about that new feature. We use gists to avoid paying code into the room.
Paying _> pasting
Typing on mobile phone is a chore...
 
Anonymous
@Joel I like the concept of your site. However, the typing magic is a little distracting. Maybe go for a thicker font. Also, the font should go no more than 60% of the total screen width (when on a large screen). Otherwise, it expands too far -- Humans have an easier time reading vertically than fully horizontal.
 
Anonymous
1:23 PM
I would also suggest bullet-pointing your specialties.
 
Anonymous
@WayneConrad I know what you mean. I am still trying to get used to Swype keyboard after a few weeks, after moving to it from google kb.
 
@HunterStevens cool thanks for the advice
 
Anonymous
@Joel you're welcome
 
Anonymous
1:36 PM
0
Q: Allow rooms to opt-out of gist previews

Hunter StevensWe've noticed this new feature in the Ruby chat room this morning: http://chat.stackoverflow.com/transcript/message/27523117#27523117 If you check our room's transcript, you'll see that a couple minutes before I deleted a message, which contained the same code from the gist. When sample code ...

 
Anonymous
If possible, can someone with 1500+ rep add the tag gist-preview, or something similar?
 
Anonymous
@WayneConrad I quoted you in my meta post.
 
Not sure how much I can do with lousy mobile interface.
 
Anonymous
True, I forgot. You can always do "request desktop mode" on your phone.
 
I didn't know that. Cool.
I don't know if a new tag is warranted. It seems pretty narrow.
 
Anonymous
1:41 PM
Okay, just wondering
 
Anonymous
I originally read that as "Oatmeal Infraction"
 
Hey guys... long time no see @Wayne. How goes things?
 
Anonymous
1:46 PM
@JonClements hey there! How long has it been?
 
Anonymous
@WayneConrad how do they treat it? Wikipedia is empty in that section
 
Umm... haven't popped in here for umm... 3/4 months at least I'd imagine :p
 
I love this line of code:holiday_feast.add_last_minute_attendee("me")
 
How can i do this "my string is cool".index(/\s/) but get the index of all spaces
 
@Jon howdy, good to see you
 
1:48 PM
@WayneConrad I like to keep things true to life
 
@HunterStevens to hide the tall part of the gist preview in your own user stylesheet you can use .ob-gist pre { display: none; }
 
@Hunter search meta. It might be an old feature that was broken and now fixed
 
Anonymous
@WayneConrad I mean your condition. Not the chat feature LOL
 
Anonymous
@CuddleBunny I can figure that out, but it should still be an opt-out thing for rooms.
 
I don't think so. They one-box a lot of things
 
Anonymous
1:50 PM
I mean gist one-box as opt out. Or even select the one-boxes you want to allow
 
If one-boxing is inappropriate in a room, it's in the room rules, and an owner can just move it if someone posts it
The options would be nice, yeah
 
Sorry, don't know how to reply in mobile. The condition is treated with pain meds and time. About one out of ten cases end up needing surgery, but I don't show any signs of heading down that path.
 
Anonymous
@WayneConrad you cannot reply, star, or flag on Mobile. The closest thing to replying is tagging someone's name
 
all those work on IE Mobile
 
Jon's latest comment sounds right. We can edit the room rules to explain why when and how to defeat one boxing.
 
Anonymous
2:00 PM
@WayneConrad I guess that is the only thing we can do... But how often do people read the rules? Are you able to edit a message from someone else?
 
@HunterStevens No you can't edit other user's messages.
You can move them, though
 
Nope only mods can edit other chat user's messages - you can ask the user to delete it/edit it if it's still within the grace period - otherwise - just move it to the bin
 
Anonymous
Okay, that is good to know. @WayneConrad maybe it is best to post the room rules in a gist, instead of a git repo? (1) shorter link, (2) more mobile friendly
 
2:38 PM
Does it really matter? They both render a markdown file
 
Anonymous
Github is not mobile friendly. I think gists are? I am not sure.
 
Anonymous
Also, because IMO one note does not show a need to be a repo. just IMHO
 
Mobile friendly isn't really relevant. it's just a file
Case in point ^
The point of the repo was to host on github pages, it just broke and we haven't fixed it yet
 
Anonymous
Changed focus of question:
 
Anonymous
2
Q: Allow rooms to opt-out of onebox previews

Hunter StevensIn the Ruby chat room, we've noticed that gist one-boxing has been fixed: http://chat.stackoverflow.com/transcript/message/27523117#27523117 If you check our room's transcript, you'll see that a couple minutes before I deleted a message, which contained the same code from the gist. When sample ...

 
2:49 PM
There's a lot of things the chat rooms need improvements on, before customizable one-box options
In my opinion
 
Anonymous
I agree, but this is out-out of all previews. Just something to think about
 
Hah! Braiam makes a good point. They added the feature of gists one-boxing
Which by extension seems to imply that's a more important feature than selective one-boxing options
Though I wonder if it's a catch all solution, and the link is the one providing the one box
Probably the case, given it's apparently been around since 2010
 
3:09 PM
I think the oneboxes add a lot of value to chat, maybe there should be a per-user opt-out?
actually, I bet I could whip up a simple script that adds such an option to the page... Is there a list of all onebox types somewhere?
 
You can opt out with a userstyle
I'll see if I can add options to rlemon's dark theme whenever he fixed the master branch
 
Anonymous
@CuddleBunny I am not sure if there is an official list, but I know there is: SE Q&A, gists, Amazon, Wiki, Twitter, Youtube.
 
The amazon one is horribly annoying
Takes up the entire chat
 
in github's defence they have a mobile app
 
hmm, day 13 is almost exactly the same as day 9
 
3:24 PM
I thought it made way more sense
Day 9 confused the life out of me
 
best seating order is -460 happiness, it must be backwards lol...
 
3:50 PM
Perhaps you just want to see the world burn?
 
hmm, now it seems to be down
 
@CuddleBunny Hm you're right
@CuddleBunny Why'd you break it :(
 
Apparently me: { anyone: 0 } is less true that it told me...
I guess I should be doing real work
 
4:14 PM
^ That's how I feel every day
 
4:46 PM
Yay, being discharged.
 
@WayneConrad Stay healthy my friend.
 
5:13 PM
@Cereal it is back
 
5:23 PM
We're saved
 
Anonymous
5:43 PM
@CuddleBunny saw you on reddit. I replied :-)
 
ha, nice
 
Anonymous
6:09 PM
 
I wonder how many people are going to end up doing 25
 
Anonymous
Someone graphed it on r/adventofcode -- just a typical regression line.
 
Just looking at the stars, it looks like losing ~600 people a day
 
A bunch of people seem to be doing it in spurts though, most of the second week days were ~2,000 and they've been creeping up.
based on the curve it had around day 9 I thought it would be down to ~100 people by day 17 but doesn't seem like that will be the case.
I'm thinking by the time we get to day 25 though, nearly everyone who does that puzzle within a day or two will get on the leaderboard
 
6:27 PM
Yeah I don't usually do the weekend ones on the weekend
Saturday was an exception
 
6:38 PM
I did Saturday on Saturday too. By my Sunday got invaded...
 
 
1 hour later…
Anonymous
8:01 PM
@Cereal can you explain how you got to your day 4 solution? Why is it 0.upto(10 ** input.length - 1)
 
(10^input.length) - 1
I gives the same number of digits as there is characters in the string
As for why, I have no idea
But it works
\o/
 
Anonymous
Well, that is what I would like to know. Before I commit to github, I want to understand why my solution (which is kind of yours) works
 
because in their example, the answers always matched the length of the given string
So that was the upper bound when I was initially testing
 
@Cereal I'm confused, what is a sample input?
 
If your secret key is abcdef, the answer is 609043, because the MD5 hash of abcdef609043 starts with five zeroes (000001dbbfa...), and it is the lowest such number to do so.
If your secret key is pqrstuv, the lowest number it combines with to make an MD5 hash starting with five zeroes is 1048970; that is, the MD5 hash of pqrstuv1048970 looks like 000006136ef....
I'm going to fix that now, though. It doesn't really have any reason
 
Anonymous
8:06 PM
Thank you, Cereal.
 
Oh, sorry
I thought you literally meant ^, as in bitwise xor
@HunterStevens That doesn't seem like idiomatic ruby to me at all, to be honest
 
Anonymous
@meagar I mean, he used a class and methods. Whereas I am just using methods. That is why I mean Ruby
 
Anonymous
Although I agree, I rarely see until in Ruby
 
8:11 PM
Something like
  def find_value(val='00000')
    99999.times.find do |count|
      Digest::MD5.new.update("#{@key}#{count}").to_s.start_with?(val)
    end
  end
 
Anonymous
Why that many times, though? What is your rationale for that number?
 
Just need to figure out what the real value for 99999 is, which looks like Cereal's `10 ** val.length) thing?
Again, I have no context, so I have no idea what the real range is :|
 
@meagar There's no upper bound
 
I just did a while(true) { ...; if found break; } kinda thing
 
But generally, doing bunch of initialization of local variables, then looping, then explicitly returning a value is not very rubyish. It can almost always be replaced with letting a .find call on an Enumerable fall off the end of the method.
 
8:13 PM
It's the string string + some_number returns an MD5 hash that has x leading zeroes
 
Anonymous
cuddelbunny can you link?
 
Anonymous
Well, that does not help me :-)
 
I should probably have just checked the first six bytes instead of building the string though...
 
@Cereal Ah, I see
 
Anonymous
8:15 PM
@meagar how do you do a .find on something like my solution? Without the upto-some-random-number? gist.github.com/onebree/96c02a6bb2a4c55b615a#file-day04-rb
 
Generate MD5 hashes on a sequence of numbers until you find one that starts with some prefix
 
Anonymous
I mean, you must start with the lowest number, which makes while or until sound convincing...
 
Anonymous
@Cereal what does this line mean? I am shaking on assignments during loops/statements: github.com/HorizonShadow/Advent-of-Code/blob/master/day4/…
 
@HunterStevens You can still start with the lowest number and use an Enumerable
If you have no upper bound, use 0.upto(Float::INFINITY)
 
Anonymous
8:21 PM
I was just looking for that sort of thing! Yay!
 
@HunterStevens here, I converted my solution: github.com/CuddleBunny/advent-of-code-solutions/blob/master/…
 
Though, if you want to loop over a range, you can use an enumerator to make it all nice and Rubyish.
 
Hello
anyone can help me
to find an awesome idea to start open source project
 
Anonymous
@CuddleBunny you can just do:
break if Digest::MD5.hexdigest("#{input}#{answer}")[0...5] == '00000'
 
Anonymous
@meagar like what?
 
8:24 PM
  def find_value(val='00000')
    digests = Enumerator.new do |y|
      count = 0
      loop do
        count += 1
        y << Digest::MD5.new.update("#{@key}#{count}").to_s
      end
    end

    digests.with_index.find do |digest,index|
      return index if digest.start_with?(val)
    end
  end
You can make an enumerator that returns an infinite series of digests, and then find within that enumerator
 
@HunterStevens true, will do.
 
Though in this particular case that's extremely overwrought :p
Generally though, it's much more useful to build enumerators to express loops
You can do all the usual functional goodness then, like find/map/select/filter/zip/etc etc
 
Anonymous
Oh okay. I like Cereal's solution because I actually understand what it is trying to do. :-) Rather than some random 0.upto(x) iteration
 
Anonymous
Is there a difference in memory consumption, etc etc if I decided to do @input = File.read? Right now, I do input, and reference it in my methods. But it seems like @input would be easier since it is used in all methods
 
globals are dumb
 
Anonymous
8:28 PM
it isnt global, it's instance.
 
I dunno what you're doing
Time to go home
 
Anonymous
bye
 
9:08 PM
just starting advent of code now :)
I'm a little more used to programming contests where the inputs are secret, and your answer is a general purpose solution in code
But, for this, the real inputs you need to solve for are available, so I'm pretty much solving things exclusively in irb :p
 
Yeah, I've done all but one right in the browser console...
because JS doesn't have a built in MD5 helper
 
Anonymous
@meagar Actually, the inputs are randomized per authorized user. No two people will get the same answers/input
 
Yes, I know
But as an author, you know what your inputs are
Usually, in programming contests, you don't actually know what your inputs are
Like in CodeWars, the katas give you sample inputs, but the real inputs by which you are judged are hidden
In codewars, and most other programming contests, the challenge is to produce a general-purpose program that can work for any valid inputs, but in Advent of Code, you can solve at least one problem I've encountered so far with a calculator
 
Anonymous
I guess that is true. I like how one person did their solutions, using the example in/out to write tests
 
Anonymous
you could always run your own tests, too. With random inputs fitting the bounds of the input criteria (if any)
 
9:19 PM
The sample inputs aren't very good tests
Or I should say, the sample inputs don't cover the specifications
My day 14 solution fails on the sample input, actually. It's off by one
(and I have no idea why)
 
Anonymous
I could review your day 14 code cereal...
 
@Cereal part B?
 
@CuddleBunny Yup
@HunterStevens Please do!
 
that happened to me too, there can be a tie
 
No one's reviewed my code before. I'm fairly certain it's better for my ego that way
 
9:22 PM
I was wondering how there was 1001 combined points in the sample
 
@Cereal I know you're joking, but code reviews are the best way to level up
 
another case of finishing part A in just a few minutes only to get stuck by not reading part B well enough D:
 
Oh is the sample incorrect? I get 388 for the winner
The sample says it should be 389 ( I think )
 
No, the sample is correct
 
You absolutely want somebody reviewing your code, as long as you can find somebody to do it
 
9:24 PM
No one in my office (re: city) knows ruby
Feel free to open a random AoC answer and rip me to shreds
 
Anonymous
@Cereal Is it because current second is initialized as 1? github.com/HorizonShadow/Advent-of-Code/blob/master/day14/…
 
o.O
uhh
maybe
 
Anonymous
How do you submit code if no one knows Ruby? Or is someone at a different location assigned to review your code?
 
No one reviews my code
 
I could dump my irb session to a text file and ask for code review :p
It's like... many thousands of lines long, and has about 9 different solutions mixed into it
 
9:28 PM
o.o
@HunterStevens Nope, making that zero breaks the actual answer
 
Anonymous
was that the issue cereal?
 
Lemme try the sample again
Yeah the sample is off by 1 for part B only
 
Anonymous
Okay... I cannot see the issue immediately.. I do not know the challenge, especially on part b. Sorry.
 
vOv works for the actual input
 
Anonymous
Then who cares?
 
Anonymous
9:33 PM
Is the sample input entered correctly (on your end)?
 
I have a slight interest in knowing why my code is technically incorrect
Yeah I just copy and pasted
 
Anonymous
When I get to that day, I will look into it :-)
 
@Cereal there was a couple of times my code worked in either the sample or the input but not the other due to a bug that one of them didn't cover.
 
The part B sample answers add up to 1001 too. I don't trust it
 
Would any of you guys know how to do a conditional association lookup by name?
Right now I have:
has_many :singles, -> { where("album_type_id = ?", 1) }, class_name: "Album", foreign_key: :parent_id
How would I look that up by the album type's name instead of the album_type_id?
 
9:39 PM
@Cereal in the sample there is a tie at t == 521 causing both to get a point
 
@CuddleBunny oh
That's dumb
>.>
I guess I should fix that
 
I missed reading that the first time, and my answer was off by ~30 points
 
I wonder why I get the right answer in the actual input
Are there no ties
 
could be
there were ~120 ties in my input
 
Anonymous
You guys should talk about this on reddit. The mods reply pretty quickly :-)
 
9:42 PM
o/
 
I have a rails application that was updated to 4.x. Now when I try to use new/create/save, all my data is null (even though when I output params, I have all the correct values). I have added strong parameters, but can't seem to figure why I always end up with null values. Does anyone have any ideas?

I have more details of the issue here: http://stackoverflow.com/questions/34273559/ruby-on-rails-new-method-not-storing-values
 
I thought the input generator would make sure that every randomly generated input had the edge cases accounted for, but I guess not.
 
Reddit isn't for talking, it's for karma \o/
 
but it could be possible that ties occurred in @Cereal's input but the leader was never in one
 
Ah true
I just call #max to give the point
 
9:43 PM
I'm still bitter about ['red'] =.=
 
Anonymous
9:54 PM
Whatever the most expensive sandwich is at md donalds, that will be my dinner. (1 free sandwich voucher)
 
If you were going to Wendy's, you could order off the menu and get a Grand Slam
 
Anonymous
They don't have that menu in NJ I think
 
OH SNAP, apparently McDonalds also has a secret menu: secretmenus.com/mcdonalds/secret-menu
 
Anonymous
And the wendy's by me is GREAT, but the parking lot is horrible.... And I have a free voucher for mc donalds
 
It's kind of terrifying that you can get an 8-patty "Monster Mac" for $6.50
You know that's quality beef
 
Anonymous
9:57 PM
quality......
 
Anonymous
It's either McD, a crappy BK, a good/expensive Wendys... Or nothing for dinner tonight. And McD is free, so it's for me
 
I wonder how many McDonalds actually know what that is, or whether it's mostly a made-up thing
 
Anonymous
Probably made up, or regional favorites.
 
Anonymous
I think I will get the new buttermilk chicken sandwich.
 
10:12 PM
I don't think wendys is much better than mcdonalds lol
 
Anonymous
10:50 PM
Wendy's chicken sandwiches are better. The best is by far Popeyes.
 
Anonymous
This is what I had. Too much secret sauce: mcdonalds.com/usmobile/en/food/…
 
11:08 PM
Looking at day 14 now. I think there's some overengineering that can be done to it. I think I'm going to spin up some enumerations (one of my favorite hammers).
 
11:20 PM
Oh, so sad. Nothing so fancy seems to be needed.
 
:(
 

« first day (703 days earlier)      last day (2552 days later) »