Activity Graph

Page 1 of 9 | Next »


[00:39:04] adam12: havenwood: Yess!!
[00:39:42] adam12: Tho I've noticed they're reasonably accepting to PRs through Github.
[13:16:05] adam12: dionysus69: Not sure if you're still working on this, but I took your gist and made a smaller gist with a few tests. I think I see the issue? but its too hard to really tell without seeing the method call invocation.
[13:16:33] adam12: dionysus69: What I think you're seeing is some_method(foo: true) is getting passed to method_missing as (args = [{foo: true}]), which you're then trying to splat.
[13:17:39] adam12: dionysus69: I added a keyword arg splat to method_missing and use a predicate to determine if we want to use args or kwargs. I'm sure there's a better way but I can't think of it right now.
[13:42:16] adam12: _ikke_: Sometimes people use the assignment like that to indicate it's intent (ie, if you wanted to call it `headers` to remember what it does).
[13:42:51] adam12: _ikke_: If you wanted to Rubocop from complaining, you could likely prefix the argument with an underscore. So _initheader = ...
[13:54:38] adam12: I wonder how long it will take before we see some RubyKaigi 2019 recordings on YT.
[14:48:02] adam12: Roda is awesome.
[14:51:58] adam12: Roda has a message bus plugin. It works well for single-direction communication (so no websockets) and has (iirc) better browser support than SSE.
[14:53:04] adam12: I use Roda with websockets on one project, but in reality it's actually Iodine, since Roda just hands the socket back to Iodine.
[14:53:14] adam12: (which also works well, fyi)
[14:54:39] adam12: ryouba: That might predate the message bus plugin.
[14:54:55] adam12: ryouba: An issue with the streaming plugin is some servers (ie. Iodine) will buffer the entire response.
[14:55:10] adam12: And then you have to ensure that nginx doesn't buffer _that_ response. It's buffers all the way down.
[14:59:22] adam12: Angelo looks interesting. By avoiding Rack, it's clearly made streaming a bit easier.
[16:13:18] adam12: gajus: My only guess is that it expects you to want JSON and you're not asking for JSON.


[14:33:48] adam12: dionysus69: maybe you wanted **?
[14:34:05] adam12: dionysus69: Hard to say without looking at something reproducable since those 2 lines don't look directly connected?
[15:09:04] adam12: old_relik: Seems like a violation of SRP, depending on what those methods will actually do.
[15:10:28] adam12: old_relik_: In that case I'd probably reach for regular composition techniques and keep the classes separate.
[15:14:49] adam12: old_relik_: Too hard to presume with vague terms. I'd just use your instinct and see what feels right.
[15:15:54] adam12: old_relik_: It's tough, that's for sure.


[15:24:47] adam12: Rakete1111: Just ask. If someone knows the answer then they'll chime in. I can't think of any better channel, tbh.
[15:27:54] adam12: Rakete1111: Indeed that is kinda odd.
[15:28:33] adam12: Rakete1111: Does it happen on every file or just random ones?
[15:32:18] adam12: Rakete1111: That's odd. What OS?
[15:32:28] adam12: Maybe it's an encoding issue.
[15:34:53] adam12: Rakete1111: The binary flag to does some things different. by default doesn't set binary mode. That might be why you see different results as strings.
[15:36:17] adam12: Rakete1111: If you're getting what you want with +, I don't see any reason why you couldn't use that method.
[15:36:40] adam12: Rakete1111: It might. I'd look through the spec/fixtures and see if there are any files that match.
[15:36:55] adam12: Rakete1111: What's your locale, out of curiosity?
[15:38:59] adam12: Rakete1111: Might be a mail bug. Hard to say. If you `s ="/path/to/file", mode: "rb");` does it bug out?
[15:40:52] adam12: Rakete1111: The 'b' flag forces external encoding to ASCII-8BIT.
[15:41:38] adam12: Rakete1111: Do you have a value for `Encoding.default_external` ?
[15:42:09] adam12: How about Encoding.default_internal?
[15:42:23] adam12: Hm. I'd presume that to work just fine.
[15:42:51] adam12: Should "\xC3" == "รถ" be true?
[15:45:56] adam12: Rakete1111: I don't work too much with different locales so likely getting to the extend of my knowledge here.
[15:46:01] adam12: Rakete1111: What Ruby version is this?
[15:46:22] adam12: So no issue there.
[15:46:33] adam12: That looks right.
[15:47:59] adam12: Rakete1111: Maybe. I'm not sure if the `b` flag is necessary to read emails.
[15:48:15] adam12: Rakete1111: If you have the source, I'd remove the flag and run the specs. If they all pass, maybe it's a Windows-only thing.
[15:48:43] adam12: Rakete1111: Could search the issue tracker for encoding. Maybe it's been discussed before.


[01:01:15] adam12: Net: Maybe? Can you share more than a single line?
[01:03:08] adam12: Net: It might be faster lookup when concerning big-O, but in reality you have 2 guest objects so I'm presuming the puzzle is larger than a single line.
[01:05:14] adam12: Net: It looks fine as it is, but if that line is nested in a loop there's a chance it's suboptimal.
[01:21:13] adam12: Just beware that Roda is obsessed with performance and some code is a bit more opaque because of that. Jeremy comes up with some very creative solutions.
[01:21:18] adam12: Any talks with Sandy Metz are great too.
[01:23:36] adam12: havenwood: are you at rubykaigi now?
[01:23:49] adam12: havenwood: favourite talk so far?
[01:25:04] adam12: havenwood: Ah yeah. Excited to watch that. Been following Falcon fairly closely.
[01:25:30] adam12: havenwood: That sounds like a good one. I feel like CRuby getting that ability would be a huge step forward too.
[01:25:59] adam12: havenwood: Did you catch the zeitwork loader one?
[01:26:27] adam12: havenwood: or the new gem dependency one from matthewd? interested in both.
[01:26:47] adam12: Code loading is probably my biggest painpoint right now.
[01:27:10] adam12: (and in that, code reloading to some degree)


[21:27:52] adam12: fowlduck: I don't test against Rails but I set this up recently: Ruby + CircleCI (Docker) for multiple library testing. Maybe you could do something comparable?
[21:28:17] adam12: s/multiple library/multiple Ruby/


[13:53:04] adam12: elated: To a proc you mean? like Hash.method(:new) ?
[13:53:35] adam12: elated: Actually that returns a method which can be coerced into a proc. My mistake.
[15:15:14] adam12: depesz: There's a few. Standard can do some minimal formatting (since it's built on Rubocop which can format). There's also Rufo. I imagine there are more.
[15:16:55] adam12: depesz: Not that I know of. At least, none the community seem to be rallying behind.
[20:40:29] adam12: zenspider: Right! That's the other one I saw recently.


[18:20:03] adam12: waheedi: I suspect that they might have been called something else and not `roo_*`
[18:22:26] adam12: rubylover: This is likely a shortcoming with Roo. I'm not sure you'll be able to do any better unless you are able to update the roo gem to get the filenames from the xlsx file through the XLS spec (if one even exists?)


[16:49:49] adam12: *.net *.split


[20:25:46] adam12: Net: I don't think it's frowned upon. I imagine the API to be mostly natural. That said, I believe (but not 100% for sure) that might be a slower code path than yield, which is where an explicit block might win out. You'd have to benchmark and determine if that was an issue for you of course.


[01:48:30] adam12: xall: What are you trying to achieve, exactly? ie. what are you expecting as output
[01:55:28] adam12: xall: I think this is what you're looking for? {"win"=>1, "draw"=>0, "loss"=>0}.merge({"win"=>3, "draw"=>1, "loss"=>0}) { |key, oldval, newval| newval + oldval }
[01:55:49] adam12: &>> {"win"=>1, "draw"=>0, "loss"=>0}.merge({"win"=>3, "draw"=>1, "loss"=>0}) { |key, oldval, newval| newval + oldval }
[01:58:28] adam12: xall: What's the math used to get 3? I'm not following.
[02:02:50] adam12: havenwood: Nice solution :)
[02:08:47] adam12: &>> {"win"=>1, "draw"=>0, "loss"=>0}.reduce(0) { |m, (k, v)| m + ({"win"=>3, "draw"=>1, "loss"=>0}.fetch(k) * v) }
[02:08:49] adam12: Because I'm lazy.
[02:09:35] adam12: Breaking it up from a oneliner will make it clearer but maybe havenwood has an idea with destructuring keyed symbols.


[13:45:25] adam12: Bish: Not super familiar with the Mail gem directly (usually use it through Roda) but have you looked at the `add_file` method?
[13:52:14] adam12: Bish: Not sure if it helps?
[14:02:42] adam12: Bish: Loads OK here. Thunderbird 60.6.1 (32-bit) Windows.
[14:05:45] adam12: Bish: The \r\n inside the header?
[14:32:38] adam12: Bish: which?
[14:44:32] adam12: Bish: Are you sure this is the issue? Looking at the RFC, "folding" is permitted to break up lines, by using a \r\n\s sequence.
[14:45:10] adam12: (not specifically that sequence but "a CRLF may be inserted before any WSP").
[14:45:20] adam12: Bish:


[01:10:48] adam12: quarters: Likely rb-readline
[01:14:55] adam12: quarters: How'd you install rb-readline?
[01:15:09] adam12: quarters: and how are you running pry?
[01:15:28] adam12: quarters: Are you using bundler / gem_home / etc?
[01:16:49] adam12: quarters: But not to run pry?
[01:18:17] adam12: quarters: How about running pry with -rreadline
[01:18:47] adam12: I always just ensure that readline is available (or libedit :\) so I haven't ran into this case before.
[01:19:01] adam12: thejamespinto: That was definitely directeded to me?
[01:19:43] adam12: quarters: Same error?
[01:20:49] adam12: quarters: Ah interesting. Does that file exist?
[01:21:13] adam12: (the not the
[01:22:33] adam12: thejamespinto: No offese taken, just confusion. I'm familiar with Ruby. I've published some things.
[01:22:45] adam12: quarters: Just a few more questions, sadly.
[01:23:23] adam12: quarters: Recent install of Ruby via RVM? Is there a reason why you can't install libreadline? Did this ever work?
[01:24:05] adam12: quarters: The fact that exists but doesn't isn't right. I don't think would ever exist without the Ruby compiler detecting libreadline during the running of configure/autoconf.
[01:24:45] adam12: quarters: The way Ruby works is, it tries the $LOAD_PATH for files matching $name.rb or $ Your $ is conflicting with the Ruby gem you installed that's called readline.rb.
[01:24:53] adam12: quarters: It's a system package.
[01:25:54] adam12: quarters: Maybe the library changed path?
[01:27:06] adam12: quarters: If you for sure have libreadline installed, then a reinstall of Ruby is likely easiest.
[01:32:17] adam12: thejamespinto: All I had to do was give my head a shake and some painful memories about readline came falling out.
[01:32:51] adam12: thejamespinto: I'm excited for the work on the new edit mode one of the Ruby core members is working on to replace readline with a better line editor (multi line editor?)
[01:34:37] adam12: quarters: Just out of curiosity, would you mind running this inside pry? $LOADED_FEATURES.grep(/readline/)
[01:34:56] adam12: quarters: It will either be or readline.rb...
[01:35:20] adam12: quarters: Yeah. Borked Ruby install. You could likely uninstall rb-readline to avoid any confusion in the future.
[01:39:54] adam12: thejamespinto: Just realised I never answered your question. I normally use ruby-install from postmodern to install my Rubies, and then use direnv with PATH_add to setup load path (and sometimes I'll set GEM_HOME/etc).
[01:40:50] adam12: thejamespinto: But after realizing a few weeks ago that truffleruby was getting along fairly well, I upgraded ruby-install to try installing truffleruby which turned into a) truffleruby not working on FreeBSD and b) new ruby-install being borked on FreeBSD. So I am just fetching/compiling manually.
[01:58:17] adam12: thejamespinto: I'm not surprised tbh.
[02:29:33] adam12: thejamespinto: Probably just `def self.some_method; @@some_method; end`
[02:29:54] adam12: thejamespinto: Presumably you're talking about class variables and not class instance variables `class << self; attr_accessor :some_method; end`
[02:30:53] adam12: mattr_accessor? It's a Railsism
[18:59:23] adam12: I've become preferential to Caddy, tho they can't seem to decide how they want to license it. Building from source (or using a package manager) gets you the Apache license tho, which is decent.
[19:00:29] adam12: havenwood: Reverse proxy + auto ssl is super simple. Most of my Caddyfile configs are 2-4 lines.
[19:04:05] adam12: havenwood: It supports on-demand TLS negotiation as well, which is nice if you offer custom domains+SSL on projects. You can setup a hook in Caddy to ask your app if it's a legit hostname that requires TLS, and if it is, Caddy handles the LetsEncrypt request and live reloading / serving of the new certificate during the TLS handshake.
[19:07:19] adam12: Zarthus: To some degree I'm with ya. I'm not sure why it's taken so long for everyone to catch up to them in regards to configuration + auto SSL tho. Maybe the new Passenger will get there.
[19:09:24] adam12: havenwood: I'm enjoying Iodine a lot, tho I've been following Falcon.
[19:25:46] adam12: brool: .scan(/[RGB]+/) will likely work.
[19:26:08] adam12: brool: Could likely leave off the +. .scan(/[RGB]/)


[22:01:15] adam12: Ping timeout: 255 seconds
[22:01:17] adam12: has joined #ruby


[02:39:38] adam12: violentE: Maybe the 1 count is the issue.
[02:40:22] adam12: violentE: I'm not sure of your network or configuration, but a 1 count might mean a dropped packet could cause a failure. And some routers have been known to deprioritize ICMP so that could even compound it.
[02:41:35] adam12: violentE: That said, I'm sure this would likely be fine in Ruby, albeit it with some tweaks. Could use something like the parallel gem to run multiple pings in parallel. You could then remove the 1 count and keep a short wait in case a few of the hosts take too long to respond.
[02:42:56] adam12: violentE: It's always the same host? .7?
[02:44:31] adam12: violentE: Out of curiosity, wha'ts the exit status if you run the ping manually? ping -q -c 3 ; echo $?
[02:47:21] adam12: violentE: Presuming Linux?
[02:47:46] adam12: violentE: Whats the exit code for one of the other ips?
[02:51:33] adam12: violentE: I doubt this is Ruby related. My guess for this specifically is a differing of how the ICMP packet is generated by fping and ping.
[02:54:26] adam12: violentE: Maybe fping is wrong and ping is correct? can you verify?
[02:57:11] adam12: violentE: me too. what about just manually pinging .7 with no arguments. Timeouts?
[02:59:35] adam12: violentE: Maybe ICMP is blocked on the machine and nmap/fping can use some sort of SYN or fragmented ICMP packet to determine response. Hard to say and likely way offtopic for this channel.
[03:02:27] adam12: violentE: Instead of shelling out to ping you might be able to try using the net-ping gem. It's been a while since I used it so can't comment on it, and last I remember ICMP through it was reasonably unsafe due to packet creation. YMMV
[03:02:45] adam12: violentE: But it might get you another datapoint to see if you can figure out whats wrong. But it sounds like ping is broken :)
[03:05:36] adam12: violentE: can you use fping?
[03:05:50] adam12: violentE: you could pair ruby + fping if you really wanted. What's your ultimate goal?
[03:11:35] adam12: violentE: I'd just shell out to fping instead, but use a single host. You could craft your own packet like havenwood is suggesting, if you feel so inclined.


[01:14:10] adam12: xall: Array.slice is likely more intent revealing if you're going for that.
[20:19:30] adam12: PercyThrillingto: How about ctrl-d
[20:20:07] adam12: PercyThrillingto: Surprising. What OS are you running?
[20:20:43] adam12: PercyThrillingto: It should. Ctrl-d is like a universal close STDIN kinda deal.
[20:21:00] adam12: PercyThrillingto: You could ctrl-z, find the job using jobs, then kill -9 %jobid
[20:21:48] adam12: PercyThrillingto: this is likely not an erb issue then, tbh.
[20:24:44] adam12: PercyThrillingto: It shouldnt'. You could just alias erb='irb' too.
[20:25:20] adam12: PercyThrillingto: The fact that ctrl-d and ctrl-z don't work is suspect, but with it being in git-bash .. not likely going to have too many people looking at it.


[00:53:08] adam12: Superhanz: You likely don't need a gem. Ruby comes with a CSV library in stdlib. Rails likely supports it to some degree out of the box but you probably want the #rubyonrails channel.


[02:20:15] adam12: uplime: Looks OK to me. Might be the best you can get.


[00:02:49] adam12: havenwood: I'm going to look. Last time I looked at it, Oracle wanted me to make an account and do some stuff. Maybe it's better now.


[22:46:06] adam12: ryouba: cat *-dns.txt | ruby -pe 'sub("*", "www") if $_.include?("249") && $_.include?("IN A") && !$_.include?("@")' ?
[22:46:36] adam12: ryouba: I didn't bother to test it since you didn't provide any test data. If you weren't looking for a one-liner then rephrase maybe?
[22:47:25] adam12: ryouba: Could likely optimize it a bunch.
[22:47:53] adam12: ryouba: I use Ruby oneliners all the time! You could of used awk to some degree too.
[22:48:27] adam12: ryouba: If you had a regex that could fit in the conditional, you could simplify it a bunch.
[22:49:08] adam12: like `sub() if /!@\s+IN A\s+249.*/` or something
[22:49:29] adam12: !@ is likely wrong for negation but I can't remember negate off the top of my head. ^ maybe.
[22:50:05] adam12: I find awk more convenient on machines without ruby, but where I'd use grep/cut
[22:50:12] adam12: since cut acts super funny on some strings.
[22:50:42] adam12: awk '/match/ { print $2 }' beats grep/cut a million times in annoynances.
[22:51:21] adam12: ryouba: did you only care about the name portion of the zone file?
[22:51:48] adam12: ryouba: my oneliner preserved the entire file as-is. Likely not what you wanted.
[22:56:00] adam12: the ruby binary has some niceties that it borrowed from Perl. -n, -e, -p, -r, $_, etc. Definitely worth checking out.
[22:57:12] adam12: -p instead of -n? saved me a few characters since $_ is automatically printed for -p and not for -n.
[23:04:16] adam12: I was wondering why truffleruby can't be installed by ruby-install but apparently I'm _many_ versions behind. I wonder how that happened.
[23:06:49] adam12: Oh well. Worth a try. "!!! unknown platform FreeBSD"


[02:38:50] adam12: havenwood: lol
[03:04:15] adam12: Arahael: You likely need to pass a bunch of `nil`'s with corresponding keys that exist in current ENV.
[03:04:39] adam12: Arahael: passing an environment to IO.popen is the same as Process.spawn I believe, which is just a merge of environments and not a clean-room.
[03:05:35] adam12: Arahael: Actually, I'm not sure if IO.popen supports it, but Process.spawn supports `unsetenv_others: true` which will clean missing env variables. Maybe that's what you want.
[03:09:45] adam12: Arahael: lol
[20:05:17] adam12: brool: Are you missing a call to `return` on that line?
[20:05:53] adam12: brool: Oh right. You likely want next.
[20:06:32] adam12: brool: You should be able to `next c unless alphabet.include? c.downcase`
[20:12:48] adam12: brool: presumably you might be mutating alphabet? I didn't look and it's a wild guess.
[20:13:07] adam12: brool: but a = alphabet; a.upcase! but be mutating alphabet by reference.
[20:13:37] adam12: brool: It might be? I never bothered to look that closely, but it stuck out to me.
[20:14:00] adam12: brool: just call dup on it. alphabet.dup.
[20:14:18] adam12: brool: or more specifically, a = alphabet.dup
[20:16:16] adam12: I wonder if there's a list of what's reference and value. I can't remember ever looking for one. But the bang-methods in stdlib stick out to me like a sore thumb for unintended side-effects.
[20:19:26] adam12: brool: frozen string literals would of likely caught it. `ruby --enable-frozen-string-literal caesar.rb` # caesar.rb:9:in `upcase!': can't modify frozen String (FrozenError)
[20:19:29] adam12: rindolf: o/


[16:32:02] adam12: ryouba: You likely want
[16:35:57] adam12: ryouba: lol. sneaky method names are sneaky.
[17:19:24] adam12: ryouba: One of the answers (the one that calls f.getc) is _kinda_ similar to the C implementation (at least the FreeBSD one You could benchmark them and see which perform better.
[17:27:41] adam12: havenwood: nice trick with sum { 1 }.
[17:30:00] adam12: al2o3-cr: Indeed!
[18:28:36] adam12: Anyone seen a way to simulate ARGF? (single stream of endless File objects)
[18:30:43] adam12: Actually nm. I thought it was lazy but just reads in everything.


[20:00:04] adam12: xco: Weechat


[13:24:53] adam12: dminuoso: I _think_ it's related to how their extconf.rb file is configured. Options available in --build-flags are related to what enable_config methods are called in extconf.rb.
[13:25:14] adam12: dminuoso: So it's likely up to the library author to provide access to specific build flags.
[13:25:27] adam12: dminuoso: If this is what I think you're referring to, anyways.
[13:35:57] adam12: dminuoso: Story of my life, since /usr/local/lib isn't in LD_LIBRARY_PATH on FreeBSD.
[13:38:15] adam12: dminuoso: Nope. I actually don't run into missing flags _too_ often, thankfully. Just some libraries (like sqlite) need a bit of help to compile.
[19:56:55] adam12: each_slice(2) maybe


[20:24:56] adam12: has joined #ruby


[17:25:52] adam12: has left #ruby: ("Leaving...")


[01:26:23] adam12: has joined #ruby


[12:13:27] adam12: has left #ruby-offtopic: ("Leaving...")
[12:15:36] adam12: has left #ruby: ("Leaving...")


[00:01:07] adam12: mynameisdebian: ruby-install supports all versions and does this without requiring updates. Is that an option for you?
[00:02:25] adam12: mynameisdebian: No package, you mean?
[00:02:48] adam12: mynameisdebian: if you're not stuck on packages, it's simple to install from source, since it'a dependency free outside of bash.
[00:03:00] adam12: mynameisdebian: I'm assuming you'd be OK without being packages considering your installing ruby from source.
[00:03:06] adam12: mynameisdebian:
[00:03:36] adam12: Pretty sure that's what rbenv / ruby-build is doing?
[00:05:21] adam12: mynameisdebian: can you use ppa repos? maybe the ruby-ng repo from Brightbox would work for you. I don't know if it works on Debian.
[00:05:37] adam12: matthewd: Is that directed at me?


[01:54:42] adam12: PettanShoutaKun: Can you show some code?
[01:54:51] adam12: Make a gist of your class and what you're working on.
[01:58:40] adam12: matthewd: plot twist, the software is for grocery store inventory management :P
[02:00:34] adam12: PettanShoutaKun:
[02:03:41] adam12: just call `fruit_number`
[02:03:48] adam12: Although `@fruit_number` should exist.
[02:05:06] adam12: PettanShoutaKun: One's an instance variable, one's a method call defined by attr_accessor that gets the instance variable


[19:15:30] adam12: The damn concurrent gem name gets me everytime
[20:49:21] adam12: al2o3-cr: concurrent isn't concurrent-ruby
[20:49:42] adam12: and everytime I install concurrent, it fails with a C error, which I then google, before realizing I've got the gem name wrong :)


[16:14:03] adam12: Wow - 2008. How time flies.
[17:18:26] adam12: amirite: o/
[17:20:02] adam12: use the ascii, luke
[17:21:41] adam12: oh fancy.
[17:22:34] adam12: baweaver: o/


[19:46:18] adam12: dwn: If you find anything that supports that, I'd be very surprised.


[01:39:38] adam12: Radar: Cool.
[04:20:46] adam12: Ping timeout: 264 seconds


[15:00:41] adam12:
[15:00:55] adam12: I wonder if a similar audit has been done against rubygems.
[15:56:34] adam12: Why not just select it the first time
[15:56:37] adam12: User.find(1234)
[15:57:59] adam12: Well, instead of using `select`, maybe you can use `find` or `detect` which returns first element that matches
[15:58:09] adam12: instead of iterating over the entire group just to return the first one found.
[15:58:34] adam12: users.find { |u| == 1234 }
[15:58:50] adam12: Then convert it to an array first
[15:59:00] adam12: users.to_a.find { |u| == 1234 }
[16:01:08] adam12: ule: That would return the user at array position 1234, and not with the id of 1234, so no
[16:01:39] adam12: That would work aswell.