nchambers

Activity Graph

« Prev | Page 2 of 4 | Next »

2018-11-20

[03:43:50] nchambers: Swyper: try map
[03:43:57] nchambers: erm, .chars.map
[03:45:01] nchambers: .chars returns an array of characters from the string, ie "hello" -> ["h", "e", "l", "l", "o"]
[03:45:33] nchambers: .map is like .each(_char), except it returns the changed values, instead of the original
[03:45:56] nchambers: &>> "abcd".chars.each { |char| char.upcase }
[03:46:03] nchambers: &>> "abcd".chars.map { |char| char.upcase }
[03:46:18] nchambers: sorry, slow typer
[03:46:31] nchambers: its returning the original values
[03:46:45] nchambers: &>> "abcd".each_char { |x| x.upcase }
[03:49:23] nchambers: is there one for String like #map?
[03:54:56] nchambers: ah, fair enough
[03:58:13] nchambers: i haven't seen a case where it does yet
[03:58:25] nchambers: since most constructs have an end-icator
[03:58:48] nchambers: still has the same problem
[03:59:05] nchambers: .each returns the original array, you want .map
[03:59:09] nchambers: your if is missing an end
[04:05:09] nchambers: so couple of notes
[04:05:23] nchambers: is there an end after the return x that you're not pasting?
[04:05:29] nchambers: if not, you need one there too
[04:05:48] nchambers: secondly, im pretty sure that condition should be [A..Z] === el
[04:06:06] nchambers: (i actually just read baweaver's medium post on ===, would recommend)
[04:06:18] nchambers: also, im pretty sure you mean x += el, not el += x
[04:07:49] nchambers: im pretty new myself tbh
[04:09:36] nchambers: can you update the gist?
[04:10:43] nchambers: return goes between those two end's
[04:10:57] nchambers: that second end is the end of the function
[04:13:51] nchambers: ["A".."Z"] == el
[04:13:54] nchambers: ["A".."Z"] === el
[04:13:56] nchambers: the second one
[04:14:05] nchambers: btw it needs to be that order, not the other way around
[04:14:34] nchambers: === performs blackmagic based on the left hand side
[04:16:01] nchambers: https://medium.com/rubyinside/triple-equals-black-magic-d934936a6379
[04:17:15] nchambers: missing quotes around the A and Z

2018-11-19

[00:24:12] nchambers: Ping timeout: 272 seconds
[01:02:15] nchambers: has joined #ruby
[01:02:55] nchambers: has joined #ruby-offtopic
[07:04:03] nchambers: Quit: WeeChat 2.2
[17:03:28] nchambers: has joined #ruby
[17:03:29] nchambers: has joined #ruby-offtopic

2018-11-18

[01:50:01] nchambers: what about net/http?
[01:52:49] nchambers: fwiw, i cheat and use this: https://jhawthorn.github.io/curl-to-ruby/
[04:40:29] nchambers: So I wrote an each method for my class, but I'd like to return an enumerator if no block is given. Is there a good article or doc on how to define an enumerator for your class?
[04:51:17] nchambers: great thank you!
[04:51:25] nchambers: and no i don't :c
[04:52:09] nchambers: what is enum_for?
[17:40:13] nchambers: &>> nil.is_a? Object
[17:40:48] nchambers: its just trying to show you that nil is an object of (I think) NilClass
[17:41:21] nchambers: versus something like None in python, or NULL in C, which effectively means "no data" and is not an object
[17:53:16] nchambers: &>> is just to tell the bot to run the following code
[17:53:27] nchambers: what is the result of nil.is_a?(Object)
[17:53:33] nchambers: and what are you comparing against?
[18:01:20] nchambers: i should probably finish my ruby koans :/
[19:00:45] nchambers: Ping timeout: 252 seconds
[19:40:21] nchambers: has joined #ruby
[19:41:01] nchambers: has joined #ruby-offtopic
[21:19:02] nchambers: is there something like Object#class expcet it outputs the basename of the class? I've got a class named Raspberry::Type::Lambda and I'd like to just get Lambda
[21:19:44] nchambers: other than foo.class.name.split("::")[-1]
[21:29:01] nchambers: thanks phaul, I'll check those out
[21:37:38] nchambers: its just cosmetic anyways

2018-11-17

[01:03:59] nchambers: has joined #ruby-offtopic
[01:03:59] nchambers: has joined #ruby
[07:44:15] nchambers: Quit: WeeChat 2.2
[19:01:45] nchambers: has joined #ruby-offtopic
[19:01:45] nchambers: has joined #ruby
[22:11:59] nchambers: what does the <=> operator do?
[22:13:24] nchambers: ah that makes sense. thanks
[22:18:38] nchambers: yeah, i like that trick

2018-11-16

[00:51:15] nchambers: has joined #ruby
[00:51:16] nchambers: has joined #ruby-offtopic
[08:13:59] nchambers: Quit: WeeChat 2.2

2018-11-15

[00:21:55] nchambers: has joined #ruby-offtopic
[00:21:55] nchambers: has joined #ruby
[00:30:55] nchambers: Radar: I'm sure people will still be supporting legacy COBOL codebases by then
[04:38:59] nchambers: what is \Z?
[07:38:38] nchambers: is there a way to alias the name of a function, besides just wrapping another function around a call?
[07:44:01] nchambers: al2o3-cr: its not a big deal really, but internally in a class i want to refer to a function as get_complete_token (as opposed to its internal method get_token_piece), but externally want to expose it as just get
[07:46:39] nchambers: erm, sorry yes, methods not functions
[07:47:55] nchambers: thats fine. im not trying to hide get_token_piece
[07:48:15] nchambers: get_complete_token just seems like it wouldn't make much sense outside the context of the class internals
[07:50:05] nchambers: "[1 2 3]" -> get_token_piece -> token [, token 1, ..., token ] -> get_complete_token -> list<1, 2, 3>
[07:50:19] nchambers: these are in a class called tokenizer
[07:52:13] nchambers: al2o3-cr: sure, but what about exposing it publicly
[07:52:32] nchambers: i guess i could just always do def get\nself.get_complete_token\nend
[07:55:51] nchambers: al2o3-cr: really im just looking for how to give two names to the same function
[07:57:31] nchambers: the public function users call is Tokenizer.get, but inside the Tokenizer source code it makes more sense to be called get_complete_token
[07:57:43] nchambers: but they both do the same thing
[07:58:40] nchambers: im not really trying to solve any problem
[07:59:19] nchambers: the method name is get_complete_token. that doesn't seem very nice to call externally, since externally you're only ever dealing with complete tokens
[07:59:27] nchambers: so it would be nice to call .get
[07:59:40] nchambers: internally however, the name makes perfect sense
[07:59:53] nchambers: im not sure how else to explain it
[08:00:42] nchambers: im probably just overthinking it :/
[08:00:45] nchambers: yeah ill whip one up
[08:03:26] nchambers: https://clbin.com/DsTlP
[08:03:41] nchambers: not perfect ruby but hopefully it shows what i mean
[08:07:32] nchambers: if it helps im (re) writing a lisp
[08:09:10] nchambers: so get_token_piece might be something like (, foo, 1, 2, (, bar, 3, 4, ), and ), whereas get_complete_token would give (bar 3 4) (foo 1 2 result_of_bar)
[08:10:48] nchambers: referring to the current object
[08:12:10] nchambers: still tokenizer
[08:12:52] nchambers: i can bug you about this tomorrow if its going to be lengthy
[08:13:03] nchambers: hate for you to be late for anything on my account
[08:13:53] nchambers: thanks al2o3-cr
[08:47:50] nchambers: Quit: WeeChat 2.2
[18:34:26] nchambers: has joined #ruby
[18:34:27] nchambers: has joined #ruby-offtopic
[19:20:40] nchambers: Quit: WeeChat 2.2
[21:02:31] nchambers: has joined #ruby
[21:02:32] nchambers: has joined #ruby-offtopic
[22:28:32] nchambers: does `return foo if (foo = super)` work?
[22:32:34] nchambers: seems to work in https://clbin.com/khFjw (although i didn't test it with a class)
[22:44:35] nchambers: what does .tap do?
[22:44:58] nchambers: i guess i can just google that actually
[23:47:23] nchambers: Quit: WeeChat 2.2

2018-11-14

[00:31:15] nchambers: has joined #ruby-offtopic
[00:31:15] nchambers: has joined #ruby
[07:55:04] nchambers: Quit: WeeChat 2.2

2018-11-13

[02:44:20] nchambers: has joined #ruby
[03:54:38] nchambers: Ping timeout: 268 seconds
[03:55:51] nchambers: has joined #ruby
[05:38:06] nchambers: Quit: WeeChat 2.2
[15:26:33] nchambers: has joined #ruby
[19:17:52] nchambers: has joined #ruby-offtopic
[20:15:43] nchambers: i've packaged applications as gems before
[20:15:58] nchambers: ruby-gems actually has a guide for specifically that
[23:23:59] nchambers: Quit: WeeChat 2.2

2018-11-12

[04:42:36] nchambers: has joined #ruby
[07:03:42] nchambers: Ping timeout: 272 seconds
[07:04:37] nchambers: has joined #ruby
[07:41:43] nchambers: Ping timeout: 244 seconds
[07:43:18] nchambers: has joined #ruby
[07:52:45] nchambers: Ping timeout: 268 seconds
[07:53:37] nchambers: has joined #ruby
[08:04:27] nchambers: Ping timeout: 240 seconds
[08:05:46] nchambers: has joined #ruby
[09:06:47] nchambers: Ping timeout: 240 seconds
[09:08:12] nchambers: has joined #ruby
[09:16:37] nchambers: Ping timeout: 268 seconds
[09:19:51] nchambers: has joined #ruby
[09:29:47] nchambers: Ping timeout: 240 seconds
[09:31:20] nchambers: has joined #ruby
[09:49:16] nchambers: Ping timeout: 264 seconds
[09:50:05] nchambers: has joined #ruby
[11:18:50] nchambers: Ping timeout: 252 seconds
[11:20:09] nchambers: has joined #ruby
[11:32:13] nchambers: Ping timeout: 246 seconds
[11:34:23] nchambers: has joined #ruby
[11:53:08] nchambers: Ping timeout: 272 seconds
[11:53:59] nchambers: has joined #ruby
[12:55:27] nchambers: Ping timeout: 240 seconds
[12:56:59] nchambers: has joined #ruby
[13:16:52] nchambers: Ping timeout: 246 seconds
[13:18:09] nchambers: has joined #ruby
[13:34:01] nchambers: Ping timeout: 246 seconds
[13:35:36] nchambers: has joined #ruby
[13:43:20] nchambers: Remote host closed the connection
[13:43:56] nchambers: has joined #ruby
[15:01:44] nchambers: Quit: WeeChat 2.2

2018-11-11

[07:56:43] nchambers: Ping timeout: 245 seconds
[07:57:53] nchambers: has joined #ruby
[08:05:03] nchambers: Ping timeout: 245 seconds
[08:06:14] nchambers: has joined #ruby
[08:31:33] nchambers: Ping timeout: 272 seconds
[08:32:31] nchambers: has joined #ruby
[08:52:52] nchambers: Ping timeout: 252 seconds
[08:54:08] nchambers: has joined #ruby
[09:11:09] nchambers: Ping timeout: 244 seconds
[09:12:40] nchambers: has joined #ruby
[10:34:13] nchambers: Ping timeout: 245 seconds
[10:35:34] nchambers: has joined #ruby
[10:48:27] nchambers: Ping timeout: 240 seconds
[10:50:04] nchambers: has joined #ruby
[11:09:46] nchambers: Ping timeout: 250 seconds
[11:10:56] nchambers: has joined #ruby
[12:12:48] nchambers: Ping timeout: 252 seconds
[12:14:06] nchambers: has joined #ruby
[12:23:07] nchambers: Ping timeout: 240 seconds
[12:24:25] nchambers: has joined #ruby
[12:55:27] nchambers: Ping timeout: 240 seconds
[12:56:52] nchambers: has joined #ruby
[14:15:19] nchambers: Remote host closed the connection
[14:16:19] nchambers: has joined #ruby
[14:27:19] nchambers: Ping timeout: 246 seconds
[14:29:26] nchambers: has joined #ruby
[19:40:19] nchambers: Quit: WeeChat 2.2

2018-11-10

[04:53:23] nchambers: Ping timeout: 244 seconds
[04:55:02] nchambers: has joined #ruby
[15:16:29] nchambers: Ping timeout: 244 seconds
[15:18:02] nchambers: has joined #ruby
[15:59:51] nchambers: Ping timeout: 252 seconds
[16:01:16] nchambers: has joined #ruby
[16:48:48] nchambers: Ping timeout: 268 seconds
[23:38:53] nchambers: has joined #ruby

2018-11-09

[16:52:47] nchambers: Ping timeout: 240 seconds
[16:53:52] nchambers: has joined #ruby
[21:14:20] nchambers: what does [*0..5] do?
[21:14:36] nchambers: oh that makes sense
[21:56:26] nchambers: i would like to go out with a bank
[22:01:06] nchambers: &>> [:HTML, :CSS, :JavaScript, :Python, :Ruby].map(&:to_s)
[22:03:39] nchambers: params.require(:data).require(*mylist)
[22:04:13] nchambers: *mylist gives it symbols
[22:05:30] nchambers: it takes a variable number of symbols right? you could just do something like: fields = [:email, :password]; fields << :name if action_name == "signup"; params.require(*fields)
[22:47:34] nchambers: what does the * operator do?
[22:48:24] nchambers: erm, I meant ? sorry

2018-11-08

2018-11-07

[23:18:47] nchambers: PaulePanter: works fine here

2018-11-06

[19:33:43] nchambers: Quit: WeeChat 2.2
[21:27:40] nchambers: has joined #ruby

2018-11-05

[00:18:15] nchambers: Ping timeout: 244 seconds
[00:33:17] nchambers: has joined #ruby
[00:44:13] nchambers: Ping timeout: 245 seconds
[01:50:50] nchambers: has joined #ruby
[07:38:12] nchambers: Ping timeout: 252 seconds
[08:11:41] nchambers: has joined #ruby
[08:44:48] nchambers: Ping timeout: 250 seconds
[10:41:49] nchambers: has joined #ruby
[11:14:56] nchambers: Ping timeout: 244 seconds
[11:35:09] nchambers: has joined #ruby
[12:08:27] nchambers: Ping timeout: 252 seconds
[13:55:03] nchambers: has joined #ruby
[14:49:57] nchambers: Ping timeout: 252 seconds
[14:50:50] nchambers: has joined #ruby

2018-11-04

[21:28:04] nchambers: has joined #ruby