baweaver

Activity Graph

« Prev | Page 2 of 258 | Next »

2019-04-27

[19:52:28] baweaver: Someone tell Swyper whenever they get back on that - and _ aren't the same
[19:55:45] baweaver: Oi Swyper, what character are you using for a placeholder there on line 13?
[19:56:27] baweaver: ....versus the ones on 50 and 53?
[19:56:50] baweaver: Also use `attr_reader` for guess_word
[19:57:19] baweaver: Make sure to read the RSpec errors carefully, it would have probably told you something like this.
[19:57:37] baweaver: `attr_reader :guess_word` will make a method for guess_word
[19:57:57] baweaver: making 22, 50, and 53 unnecessary
[20:01:06] baweaver: Asterisk is more visually distinct `*`
[20:16:03] baweaver: Radar: You've dealt with webpacker right? Any idea how to import css from a node_module? Anything I'm finding right now isn't working out.
[20:20:50] baweaver: Lovely - https://github.com/rails/webpacker/issues/384

2019-04-19

[02:28:04] baweaver: havenwood: how do you get a list of Ruby operators?
[02:29:09] baweaver: &>> Integer.methods.grep(/^[^a-z]{1,3}$/)

2019-04-18

[02:45:09] baweaver: ...and some more practical examples: https://medium.com/@baweaver/ruby-2-7-pattern-matching-destructuring-on-point-90f56aaf7b4e
[02:45:09] baweaver: Pattern Matching just landed in Ruby as an experimental feature: https://medium.com/@baweaver/ruby-2-7-pattern-matching-first-impressions-cdb93c6246e6
[19:40:23] baweaver: lupine: yep, I wrote the articles on it: https://medium.com/@baweaver/ruby-2-7-pattern-matching-first-impressions-cdb93c6246e6

2019-04-17

[15:58:39] baweaver: havenwood: It brings me great joy to do this
[15:58:58] baweaver: Beat you to a Ruby update XD
[20:28:35] baweaver: Guess what hit Ruby core: https://medium.com/@baweaver/ruby-2-7-pattern-matching-first-impressions-cdb93c6246e6
[20:42:35] baweaver: ACTION shrugs
[20:42:36] baweaver: That's the one that came to mind immediately
[20:42:41] baweaver: Also a note not to write articles at 2am
[20:48:03] baweaver: Honestly me either
[20:48:35] baweaver: The keys bit confuses me, and it seems really prone to race conditions
[20:48:36] baweaver: I'll need to poke Nightly for a while to see what in the world it's even doing.
[21:09:55] baweaver: zenspider: Fair.
[21:10:07] baweaver: It feels like we all gave a ton of input and they went their own way
[21:10:39] baweaver: Some of it got in but they've really taken it in another direction for other parts.

2019-04-16

[20:43:25] baweaver: What the right thing is tends to change as time goes by
[20:43:46] baweaver: In early Ruby everyone was enamored with monkey patching. That one certainly didn't age well.

2019-04-13

[16:49:55] baweaver: *.net *.split

2019-04-11

[18:08:05] baweaver: IGnorAND: The thing to remember about Metz's rules are that they're not a hard and fast law
[18:08:23] baweaver: They were designed to give constraints to people who wanted them as an arbitrary guideline of what to pursue
[18:08:48] baweaver: Artificially refactoring your code to hit those numbers may be counter-intuitive
[18:12:17] baweaver: Yeah, that's what I'd keep in mind in general :)
[18:12:27] baweaver: They're good guidelines in general
[18:12:36] baweaver: just some folks take them very religiously and get carried away.
[18:13:13] baweaver: Have you read her book, Practical Object Oriented Design in Ruby?
[18:14:16] baweaver: It's a pretty good book
[18:14:26] baweaver: Typically I recommend it and Eloquent Ruby

2019-04-10

[20:33:48] baweaver: Just been busy on my end getting ready for RailsConf
[20:34:51] baweaver: maxdoubt: Depends, though a lot tend to be on Slack anymore
[20:35:14] baweaver: I tend to dislike that though as I have enough slacks already and it gets to be a mess keeping track of all of them.
[20:35:29] baweaver: terens: 404
[20:37:56] baweaver: Tech demo is coming up on Friday at work to see how it works
[20:38:04] baweaver: Just bought simphony.dev to use

2019-04-08

[20:02:18] baweaver: Regexp.union str.chars

2019-04-05

[04:29:14] baweaver: havenwood: Did you write an article on it yet?

2019-04-02

[18:40:55] baweaver: As someone who's built similar functionality in-house, it's cheaper in most cases than doing the same yourself.

2019-04-01

[18:30:30] baweaver: JL: RubyKatas iirc
[18:30:35] baweaver: Or RubyMonk
[18:30:52] baweaver: The latter is up and down depending on how much the owners are paying attention

2019-03-28

[04:14:17] baweaver: sevenseacat: Well this makes my work even easier :D
[04:14:18] baweaver: https://github.com/NullVoxPopuli/mesh-relay/blob/80801bb7f20bf4d8c5b48a2899dab8806edc8016/app/models/connected_list.rb
[04:14:52] baweaver: Trying to keep track of connected users to send them all instrument tracks
[04:15:32] baweaver: This gives me a viable way to track connected users, define a channel path for each of them, and a way to send/receive whatever to each individual client :D
[04:15:44] baweaver: Which was the annoying problem I've been trying to find a solution for for a while
[04:19:49] baweaver: Also validates my idea of using Redis for connected users
[22:58:02] baweaver: If you're using TruffleRuby that speed hit is a lot smaller.
[22:59:13] baweaver: https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/yarv-truffle.html
[23:00:22] baweaver: https://pragtob.wordpress.com/2017/01/24/benchmarking-a-go-ai-in-ruby-cruby-vs-rubinius-vs-jruby-vs-truffle-a-year-later/
[23:00:33] baweaver: havenwood: It's showtime
[23:01:00] baweaver: your favorite topic

2019-03-27

[05:01:46] baweaver: Aren't we all anymore? :P
[05:01:47] baweaver: How's things sevenseacat?
[07:30:23] baweaver: Woo, just finished all the new lemurs

2019-03-26

[00:55:08] baweaver: https://twitter.com/keystonelemur/status/1110344055790030848
[03:36:03] baweaver: t0xik: No. What do you think you need it for?
[03:36:04] baweaver: havenwood: Don't correct that :P
[03:36:05] baweaver: or you either al2o3-cr
[04:21:17] baweaver: ^ that. It's called the XY problem, you want a specific solution and fixate on that when another solution may be available t0xik
[04:24:57] baweaver: Most of the time you use methods from Enumerable
[04:26:13] baweaver: Name a use case from C where you would use a goto and we can show you a method from Ruby to do the same
[18:24:53] baweaver: It is, by about 10x graft
[18:24:57] baweaver: I was curious so I looked.
[18:25:39] baweaver: I kinda wonder if that holds up in TruffleRuby
[18:26:09] baweaver: havenwood: `wc -l` vs `File.open(...).foreach.count` in TruffleRuby?
[18:26:24] baweaver: Don't have it installed on the work computer, should probably fix that
[23:14:34] baweaver: 'morning Radar
[23:21:19] baweaver: &ri Enumerable#transform_values
[23:21:27] baweaver: &ri Hash#transform_values

2019-03-25

[04:14:59] baweaver: keyword parameters for one
[04:15:09] baweaver: Though ** would work
[04:15:34] baweaver: Na, just use keyword params
[21:46:46] baweaver: Radar: ohai
[21:47:40] baweaver: Tons of new lemurs, websockets, and react are coming
[21:48:02] baweaver: Busy, it seems. Hackathon and conference coming up next week, then moving, then sprint to RailsConf
[21:48:42] baweaver: (moving closer to work)

2019-03-24

[01:42:58] baweaver: https://medium.com/@baweaver/ruby-2-7-numbered-parameters-3f5c06a55fe4
[04:34:23] baweaver: https://twitter.com/keystonelemur/status/1109674597304066049

2019-03-23

[21:06:26] baweaver: Depends on what you mean by sort.
[21:06:49] baweaver: Anything is sortable if you have a criteria to sort on
[21:09:44] baweaver: xco: You can sort by more than keys
[21:10:36] baweaver: It looks like you're trying to sort by the value, but the problem is if there's more than one value in there
[21:10:43] baweaver: Why does the data look like that?
[21:10:52] baweaver: essentially it's mimicking array indexes
[21:11:28] baweaver: What does the original look like, and what problem are you trying to solve?
[21:13:59] baweaver: &ri Enumerable#each_with_index
[21:14:52] baweaver: >> [4, 1, 5].each_with_index.max_by(&:last)
[21:15:04] baweaver: >> [4, 1, 5].each_with_index.minmax_by(&:last)
[21:15:15] baweaver: >> [4, 1, 5].each_with_index.sort_by(&:last)
[21:15:29] baweaver: ack, by first rather
[21:19:22] baweaver: You're still working with the first element in any case
[21:19:28] baweaver: Just do something with the block
[21:22:26] baweaver: Mostly Sublime.
[21:23:03] baweaver: Been trending towards VS Code because of some React work

2019-03-18

[05:14:27] baweaver: https://medium.com/@baweaver/ruby-2-7-numbered-parameters-3f5c06a55fe4
[18:19:53] baweaver: dawidof: YARDoc tends to be fairly standard for docs.
[18:20:04] baweaver: It also allows you to get a server up for documentation
[18:20:23] baweaver: and gemstash may well have a YARD flag later for hosting docs for any installed gem on the server

2019-03-14

[23:03:16] baweaver: zenspider: evil me is writing in only double-quotes for the book
[23:03:39] baweaver: It feels like a bad idea to teach newbies otherwise, too much potential for confusion for very little gain.
[23:07:02] baweaver: cxl: HIRB, but it hasn't been updated in quite a while: http://tagaholic.me/hirb/doc/index.html
[23:07:59] baweaver: Fair. Trying not to add a ton of nuance to the book, and more of just "do it this way"

2019-03-11

[17:19:41] baweaver: Excess Flood
[17:19:51] baweaver: has joined #RubyonRails-offtopic
[17:19:51] baweaver: has joined #elixir-lang
[17:19:51] baweaver: has joined #logga
[17:19:51] baweaver: has joined #ruby
[17:19:51] baweaver: Changing host
[17:19:51] baweaver: has joined #ruby
[17:19:51] baweaver: has joined #logga
[17:19:51] baweaver: has joined #elixir-lang
[17:19:51] baweaver: has joined #RubyonRails-offtopic
[17:20:26] baweaver: has joined #ruby-offtopic
[17:20:26] baweaver: has joined #RubyOnRails

2019-03-08

[22:21:42] baweaver: sagax: Use begin / rescue
[22:31:58] baweaver: sagax: Use begin / rescue, you'll have a lot easier time.
[22:32:08] baweaver: What code do you _need_ it for?
[22:32:27] baweaver: begin / rescue can also return a result.
[22:33:12] baweaver: Very often when one thinks they _need_ a language feature that's not entirely accurate. It depends heavily on context, and sometimes we're bent on shoehorning our problem to match.
[22:33:43] baweaver: What problem are you trying to solve?
[22:33:44] baweaver: because it sounds a lot like `break` or `next`
[22:34:11] baweaver: You're fixating on try/catch, not your actual problem.
[22:34:18] baweaver: Do you have a code example?
[22:34:38] baweaver: You can use `return` for that as well.
[22:35:22] baweaver: Can you show us some example code?: https://dpaste.de
[22:35:44] baweaver: What if we said that try/catch is ugly?
[22:35:55] baweaver: If you're bent on using it, use it.
[22:36:32] baweaver: leftylink: fixation is fun.
[23:08:08] baweaver: Yeah, just use `return`.
[23:09:04] baweaver: You're not gaining any clarity there.
[23:09:43] baweaver: If anything you're trying to ad-hoc on pattern matching
[23:10:01] baweaver: It's an approximation of an Either type.
[23:10:32] baweaver: You're using throw/catch as a psuedo-either type to pass additional context with returns
[23:10:49] baweaver: It's more commonly known as Railway Oriented Programming: https://fsharpforfunandprofit.com/rop/
[23:11:42] baweaver: I'm not really sure what you want here.
[23:11:44] baweaver: You're fixated on one solution, so just use it.
[23:11:53] baweaver: Just be warned it's not very common and will likely confuse other programmers.
[23:22:35] baweaver: How's things phaul?

2019-03-07

[04:53:38] baweaver: has joined #RubyonRails-offtopic
[04:53:39] baweaver: has joined #RubyOnRails
[04:53:40] baweaver: has joined #ruby-offtopic
[04:53:43] baweaver: has joined #elixir-lang
[04:53:44] baweaver: has joined #ruby
[04:53:45] baweaver: has joined #logga
[22:20:27] baweaver: ACTION reads back
[22:21:12] baweaver: What's `nwserver` doing BoomerBile?
[22:21:36] baweaver: Left I guess.
[22:21:55] baweaver: al2o3-cr: Doesn't really read like bashing, just annoyance at something breaking.

2019-03-01

[23:26:29] baweaver: Darmani: How do blocks work in Ruby?
[23:26:55] baweaver: Give you a hint: they're not parens in this case.
[23:27:08] baweaver: Also that scan isn't going to do what you think it will.
[23:27:33] baweaver: Also it's `grade`, not `string`
[23:27:57] baweaver: psuedo code might not run so well in Ruby :P
[23:28:15] baweaver: also `sort_by` only works on Enumerable types.
[23:28:29] baweaver: Is the grade a string or what is it?
[23:28:40] baweaver: If it's an array you might want to call it grades instead.
[23:28:48] baweaver: and also split the string
[23:29:08] baweaver: Line 5 though, that's a string?
[23:29:42] baweaver: What's an example of input?
[23:29:46] baweaver: and the expected output?
[23:30:42] baweaver: What's in the string?
[23:30:53] baweaver: and what's a greade
[23:31:02] baweaver: Anything doesn't really help.
[23:31:09] baweaver: There we go
[23:31:28] baweaver: and you want to sort by those grades lexically? (alphabetical order)
[23:31:54] baweaver: You want sort, which yields two items
[23:32:11] baweaver: collection.sort { |a, b| ... }
[23:32:27] baweaver: sort_by if you have a property available
[23:32:49] baweaver: I wonder...
[23:33:06] baweaver: &>> %w(A+ F B- B B+).sort
[23:33:45] baweaver: So it'll get the letter right, you just have to give a higher priority to the +.
[23:33:46] baweaver: which property?
[23:33:56] baweaver: No, that's what you're sorting
[23:34:01] baweaver: each item would have a property
[23:37:17] baweaver: Make a map for the second property
[23:37:45] baweaver: yeah, sort_by would work here, not thinking clearly.
[23:43:43] baweaver: &>> OPS = { '+' => 0, nil => 1, '-' => 2 }; %w(A+ F B- B B+).sort_by { |g| [g[0], OPS[g[1]]] }
[23:47:57] baweaver: Just tend not to post full solutions in channel
[23:48:04] baweaver: Kinda curious how I'd teach that though
[23:50:49] baweaver: It's a hard balance
[23:51:04] baweaver: iirc Darmani was a bit vampy

2019-02-28

[04:30:12] baweaver: Swyper: You're on your own for syntax errors, you need to look those up.
[04:31:21] baweaver: What have you tried to fix your syntax errors?
[04:32:24] baweaver: How do you write a Ruby method?
[04:32:54] baweaver: What's the syntax?
[04:34:15] baweaver: Fix the indentation as a first step
[04:34:39] baweaver: Second, what's your method name?
[04:34:58] baweaver: Third, where is that method defined when you call it on 7 through 10?
[04:36:44] baweaver: 2: No it's not
[04:36:59] baweaver: Ruby isn't that smart.

2019-02-27

[02:40:23] baweaver: havenwood: https://twitter.com/keystonelemur/status/1100584320752848896

2019-02-26

[22:57:46] baweaver: Probably shellwords.

2019-02-25

[08:36:38] baweaver: ntt: Do you only want the IP?
[08:37:08] baweaver: That's not really too complex.
[08:37:17] baweaver: Break it down a bit, you have a hash with nested hashes
[08:37:29] baweaver: the key is the name of the node, and the value is its configuration
[08:38:05] baweaver: So when using map, ask the configuration what the IP is
[08:38:13] baweaver: It's a hash, how do you get a single value from a hash?
[08:41:01] baweaver: You should probably lead with that
[08:41:32] baweaver: So you only need ipaddress?
[08:41:39] baweaver: Not network?
[08:43:02] baweaver: So really you only need the nodes
[08:43:20] baweaver: Can you use other gems?
[08:44:05] baweaver: Xf.trace(:ipaddress).get_value(hash)
[08:44:20] baweaver: data.map(&Xf.trace(:ipaddress).get)
[08:44:51] baweaver: https://github.com/baweaver/xf
[08:46:32] baweaver: Traces basically go down through a hash until it can finally find a key that matches
[08:46:41] baweaver: or key and value, but that's a different thing.
[08:48:05] baweaver: The two articles up top explain how it works
[08:49:02] baweaver: Yeah, trace is slow-ish because of how it works
[08:49:17] baweaver: Though to be fair it won't matter unless you have something like 10k nodes or more
[08:49:33] baweaver: and even then, maybe a quarter second
[08:50:30] baweaver: The answer to what's the best way to do something is: it depends
[08:51:14] baweaver: Now if there were a way to potentially know what those paths are you could use dig instead.
[08:52:47] baweaver: but my advice for sysadmin type tasks: optimize for writing time, not runtime, until it becomes an actual issue.
[08:54:56] baweaver: for 30 nodes the time difference is non-existent
[08:56:05] baweaver: So merge based on similar keys?
[08:56:34] baweaver: Hash#merge is nice for that.
[09:01:20] baweaver: V1s1ble: https://bpaste.net/show/9b308d3810ec
[09:01:31] baweaver: reduce / each_with_object is good for that type of problem
[09:02:05] baweaver: grep can take a regex (it uses === for compares)
[09:02:18] baweaver: Then just reduce it into a hash with arrays as the default value