phaul

Activity Graph

Page 1 of 24 | Next »

2019-09-18

[07:31:04] phaul: has joined #RubyOnRails
[07:31:04] phaul: has joined #ruby-offtopic
[07:31:04] phaul: has joined #ruby

2019-09-17

[06:50:09] phaul: Quit: :wq

2019-09-16

[12:26:18] phaul: &>> "string1".sub(/(?=\d+)/, '_')
[14:24:12] phaul: how does it not work?
[16:02:15] phaul: typically ppl would sort an array. what's the role of the proc in your method? Are you trying to sort an array or something else?
[16:03:33] phaul: ok. what's the role of the proc?
[16:09:23] phaul: so to clarify. To implement bubble sort you don't need to take any proc. Just operate on an array. Later when that works you can extend your sort with all sorts of proc support.
[21:18:44] phaul: there is .new and #initialize. .new is on the "class side" and #initialize is on the instance side

2019-09-14

[10:39:58] phaul: it's a module. Modules are versatile feature in ruby and can be sued as namespaces
[10:40:18] phaul: you can nest modules, just like you would nest namespaces.
[10:41:38] phaul: &>> module A; module B; def self.foo; Module.nesting; end; end; end; A::B.foo
[10:42:52] phaul: they can also be used for non instantiatable class like things, similar to what other OO langs would consider interfaces or abstract classes or mixins.
[13:17:52] phaul: I think it's kinda' recent. at least I still remember it being news
[13:21:52] phaul: &>> [1,2,3,Numeric].all? Numeric
[13:22:28] phaul: Numeric is not Numeric. :)
[13:26:58] phaul: that was very "meta"
[13:29:09] phaul: i've seen ppl being caught up by the x = Integer; case x when Integer then 'not this'; else 'this'; end gotcha..
[13:30:36] phaul: it's interesting edge case anyway

2019-09-13

[07:19:46] phaul: 2.6.4. I beleive there is no general rule there, you just try and see. A thorough test suite can give you confidence. Many gem dependencies can make it a nightmare
[10:30:25] phaul: map returns arrays.
[10:31:35] phaul: you can pass a block with new ruby to to_h
[10:32:32] phaul: &ri Enumerable#to_h, throstur
[10:33:49] phaul: I don't understand the relation between foo and bar in that example
[10:34:37] phaul: don't you mean finding id from foo? and name from bar?
[10:36:05] phaul: sorry. I don't get what the task is, if you give us an example input and a desired output we can help. Just make sure it's syntactically correct. [ {"id", "name"}, {"id2", "name2"} ] is not a valid expression
[10:39:58] phaul: sometimes things have to be said twice :)
[10:45:01] phaul: &>> [{"id" => 1, "name": "giraffe" }, {"id" => 3, "name": "elephant"}, {"id" => 2, "name": "goose" }].to_h {|h| [h[:name], h['id']]}
[13:09:58] phaul: multiline stdout only shows the first line of output. see the rest from the link
[13:10:42] phaul: &>> arr = ['a', 'b', 'c'] ; arr.delete('a') ; a
[13:10:46] phaul: &>> arr = ['a', 'b', 'c'] ; arr.delete('a') ; arr
[14:56:47] phaul: well as long as they pay yoou for it ... ;)
[15:03:28] phaul: [a,b,c].uniq.count == 1 ?
[15:03:45] phaul: not sure if it's any better.. just different
[15:46:48] phaul: &>> "foo \" bar\" asd".scan(/\w+/)
[15:47:43] phaul: maybe not. if foo \" bar was spupposed to be kept together... nvm
[15:51:33] phaul: there must be a regex though that does what you want.
[20:30:09] phaul: sort of. You want to read up on ruby modules/mixins. wrt include, extend, prepend trio.
[20:31:17] phaul: in effect yes, you can use the methods like they were defined there - but this is only a short and sort of incorrect answer

2019-09-12

[12:26:52] phaul: https://github.com/mame/quine-relay
[13:03:59] phaul: there is a byebug pry plugin. but afaik vanilla pry is a single snapshot state viewer
[13:05:02] phaul: you can look at the state including walking the current callstack though which is usually what ppl want. Also there is pry-rescue which stops in pry repl on exception
[13:06:06] phaul: try byebug or pry-bybug
[13:12:32] phaul: I don't know. If you start pry and type help, do you see the bybug commands there?
[13:17:51] phaul: did that help?
[13:18:17] phaul: my bet is that it's installed with different gem environment.
[13:20:03] phaul: byebug itself has a CLI, just gem install byebug and start as byebug.. if the pry plugin fails
[13:27:48] phaul: Teckuro: I think ruby language specific questions are better answered on #ruby. But I try to give you an answer here...
[13:28:03] phaul: {} is part of string interpolation.
[13:28:51] phaul: In fact it's #{} the # is part of the construct. And it evaluates the expression that's inside, calls to_s (to string) on it and pastes it inside a string
[13:29:29] phaul: example : name = 'Teckuro'; "Hello #{name}!!!!" would result in "Hello Teckuro!!!!"
[13:31:04] phaul: Teckuro: the () is part of the argument passing to a method. mydef(arg1, arg2) is a construct in which arg1 and arg2 are passed to mydef
[13:32:28] phaul: arguments this way are passed by position. they don't have to be passed from local variable. this is valid: mydef(1, 2) and it passes the values 1 and 2. To be able to use the values you have to name them as arguments where you define the method.
[13:37:59] phaul: I'm not sure on the terminology you are using. There is method definition and method call. When you say you specified the method which one do you mean?
[13:45:08] phaul: where you put spaces is significant. formatted this way would work:
[13:45:28] phaul: def divide(number1, number2); number1 / number2; end
[13:45:52] phaul: no probs. you are welcome
[15:13:09] phaul: &fake Faker
[15:13:19] phaul: &fake Faker::Blah
[15:13:45] phaul: &fake Faker.lah
[15:14:26] phaul: &fake Movie.quote
[15:14:30] phaul: &fake Movie.quote
[15:14:37] phaul: &fake Movie.quote
[15:15:37] phaul: ah. sure. tbh those messages should have happened on #rubydoc-dev ;)
[15:25:41] phaul: &>> 'this is all\n + on one line'.split(/\\n *\+?/)
[15:28:35] phaul: actually that only works if the \\n is not missing
[15:32:04] phaul: &>> 'this is all \n on one line'.split(/\\n *\+|\\n|\+/) # but the white spaces around the split are not trimmed
[15:48:28] phaul: yeah I think begin end is not a lexical scope for local variables.
[15:51:01] phaul: begin end is just like while, until, if, case etc. in this regard
[15:53:31] phaul: to my knowledge there is top level binding , source file top levels, class , module, def, and blocks with different rules that define visibility scopes for local variables
[15:55:00] phaul: but I can be wrong, I had been wrong before :D https://github.com/phaul/ruby_101/blob/master/content/book.md#local-variable-scopes
[16:02:30] phaul: throstur: https://github.com/mame/
[16:02:58] phaul: probably the most advanced person in ruby dark magick wizardry
[20:14:57] phaul: replace %W qith %q and remove join
[20:15:13] phaul: &>> %W[a b c]
[20:15:50] phaul: you can also lose join
[20:16:15] phaul: &>> "rubydoc, where are you?"
[20:17:48] phaul: ah. my CI messed up stuff. I just roll back
[20:19:37] phaul: &>> %W[a b c]
[20:19:47] phaul: &>> %W[a b c].join
[20:22:00] phaul: robotcars: np. sorry, bit of mishap with the bot :)
[20:26:22] phaul: you can use heredoc. there are different types, probably <<~ is the best with indentation in code
[20:30:30] phaul: https://gist.github.com/phaul/77f27c1c1b4f8e8af1e6a75e57fe6560#file-x-rb, robotcars
[22:00:03] phaul: &>> a = []; b = { a => 1 }; a << 1; b
[22:00:13] phaul: no idea what this means..
[22:05:52] phaul: when you say a.clear which method do you mean exactly? there is no Object#clear
[22:06:25] phaul: and it could be anything from where we started
[22:10:31] phaul: oh I see. Array#clear would do it.
[22:11:44] phaul: why? is this, leftylink ?
[22:13:12] phaul: excepth a = [] doesn't make it work, a.clear does
[22:13:46] phaul: nvm. I see. I does

2019-09-11

[16:53:02] phaul: Quit: :wq
[16:53:54] phaul: has joined #RubyOnRails
[16:53:54] phaul: has joined #ruby-offtopic
[16:53:54] phaul: has joined #ruby
[17:57:27] phaul: I thought it was just a shorthand for attr = attr || val. so semantically it's not the attr||= but the attr=
[17:59:44] phaul: then it doesn't match the rest like += and so on
[18:02:25] phaul: yeah. I found it being a "common misconception" http://www.rubyinside.com/what-rubys-double-pipe-or-equals-really-does-5488.html at least I'm not alone :)

2019-09-07

[22:53:36] phaul: hi greengriminal
[23:03:30] phaul: hi jhass , the bot seems to be fast again - no more time outs, did you do anything?
[23:05:04] phaul: oh ok. that's good, that means that we probably will be fine ;)

2019-09-06

[17:22:04] phaul: offtopic: I noticed quite a few ppl have [m] in their nick. What does that mean?
[17:26:14] phaul: I see, it's something to do with the service they are joining from. All joins, parts have blah gateway...matrix.org

2019-09-05

[08:48:33] phaul: try bundler -v ; which bundler
[13:06:51] phaul: you could also look at DRb it's part of the stdlib, though I ve never used it
[18:45:19] phaul: davidw: this is the best I found https://github.com/ruby/ruby/commit/0a71db8a7497df37b984ea97abfce6b6ffd82df3
[18:45:45] phaul: but ultimately I don't know. But you can get pointers from the commit message

2019-09-04

[16:39:38] phaul: Quit: :wq
[16:41:31] phaul: has joined #RubyOnRails
[16:41:31] phaul: has joined #ruby-offtopic
[16:41:31] phaul: has joined #ruby
[17:10:52] phaul: ?crosspost
[17:11:27] phaul: I would try launching the system with bundle exec
[20:06:14] phaul: &>> "2.6 works again #{RUBY_VERSION}, havenwood"
[20:06:46] phaul: yeah, thanks to jhass
[20:17:07] phaul: flip flop was meant to be removed, then it's not then it's depricated again then it's not, then... I'm starting to see a pattern

2019-09-03

[20:03:17] phaul: to make it syntactically correct you could remove the #{} around current_time, and add a coma
[20:03:53] phaul: whether that's correct or not is a different question

2019-09-02

[10:49:33] phaul: Quit: :wq
[10:51:10] phaul: has joined #RubyOnRails
[10:51:10] phaul: has joined #ruby-offtopic
[10:51:10] phaul: has joined #ruby
[12:20:16] phaul: h = Hash.new { Hash.new { Hash.new { Hash.new { :nope } } } }; h[:x][:y][:z][:q]
[12:20:21] phaul: &>> h = Hash.new { Hash.new { Hash.new { Hash.new { :nope } } } }; h[:x][:y][:z][:q]
[12:22:43] phaul: this doesn't raise exceptions to arbitrary levels, but it's not very useful: :) :
[12:23:01] phaul: &>> h = {}; h.default = h; h[:x][:y][:z]
[12:25:34] phaul: I don't think it's possible, without monkey patching Hash
[12:31:45] phaul: ah, so they demonstrate how this can be done..
[12:34:51] phaul: ryouba: it's a neat trick
[12:44:19] phaul: well. it's a neat party trick. I wouldn't use it in production code. It's way too clever for that.
[12:50:07] phaul: maintainablity is the key.
[12:51:21] phaul: yeah just what I wanted to say :)
[13:32:32] phaul: that's what was under the link
[14:24:56] phaul: zulu_: you are loud and clear on freenode/#ruby
[16:10:03] phaul: Ping timeout: 245 seconds
[16:17:23] phaul: has joined #RubyOnRails
[16:17:23] phaul: has joined #ruby-offtopic
[16:17:23] phaul: has joined #ruby

2019-08-30

[08:04:48] phaul: &bare>> %
[08:05:47] phaul: this is weird. I don't know what's going on. Why is "%" valid ruby?
[08:06:28] phaul: (not talking about % followed by character literal, just a %)
[08:13:25] phaul: &24tok>> %
[08:13:36] phaul: &tok24>> %
[08:15:05] phaul: my ruby -e is unterminated string as well, so Im not sure I trust the bots results. But I don't know what's going on
[10:58:42] phaul: Quit: :wq
[11:00:37] phaul: has joined #RubyOnRails
[11:00:37] phaul: has joined #ruby-offtopic
[11:00:37] phaul: has joined #ruby
[11:17:07] phaul: https://github.com/phaul/ruby_101/blob/master/content/book.md#whitespace-nonsense throstur
[11:18:42] phaul: It's parsed as the expression that follows parenthesized, rather than an argument list
[12:30:39] phaul: me neither
[16:50:42] phaul: do you mean the syntax highlighting in pry?
[16:51:59] phaul: there is a color config setting for pry that can disable colours if you don't like them
[16:53:16] phaul: in your ~/.pryrc ...
[16:57:14] phaul: I don't think it's the inspect methods of classes that colourize, but pry postprocesses the output
[17:02:31] phaul: Pry::Helpers::BaseHelpers.colorize_code('1') is what's called in the background
[17:03:01] phaul: https://www.rubydoc.info/github/pry/pry/Pry/Helpers/BaseHelpers#colorize_code-instance_method

2019-08-27

[07:01:50] phaul: no, if else does not make a lexical scope for locals. nor does for loops afaik
[07:08:15] phaul: oh god. And I thought I had local vars figured out :D
[07:43:17] phaul: right. It's the lexical appearance that counts, before any execution. that's why x = 1 if false still makes x declared
[07:44:15] phaul: I new the rules, but this loop thing managed to fool me ;)
[11:37:57] phaul: is there a development forum for jekyl, maybe on github issues
[11:39:50] phaul: dannysantos: there are a few options mentioned here https://jekyllrb.com/docs/community/
[11:40:17] phaul: it seems they are also on gitter, maybe it's more popular with them than irc
[12:47:39] phaul: cool, thank you!
[12:48:41] phaul: that happened before as well, but we mostly just retried and then it worked
[12:49:27] phaul: also 2.5 was affected
[12:49:34] phaul: &25>> :try
[12:49:59] phaul: &25>> :again
[14:32:53] phaul: C ... yuck ..
[14:39:19] phaul: Go to C is what Plan9 is to Unix :)
[16:47:57] phaul: psilly0: I think this depends. First thing that comes to mind: don't test that your gems do what they promise they do. A bunch of integration tests are good to make sure the app is put together correctly, but otherwise you can assume that sequel is bug free (from testing perspective)
[16:49:36] phaul: I think if you already buy into the idea of reaching the real DB with the tests, then you would need to set up a test DB rails style.
[16:50:15] phaul: A separate DB with predictable and fixed content prior to run each test case.
[16:53:39] phaul: Otherwise after some time you would end up with tests passing/failing based on test order
[16:55:06] phaul: But stubbing out the sequel layer altogether could also work.
[18:37:08] phaul: nius: they don't have their own variable scope
[18:42:40] phaul: defs are lexical scopes and there are a bunch of others. blocks can make a scope with variables explicitly declared block local. But flow control structures aren't
[18:47:10] phaul: because if the declaration like a = 1 appears lexically (phisically in the source file) after the usage it is undeclared
[18:47:23] phaul: swap the useage and the declaration and it works
[18:47:45] phaul: what matters is where it is in the code, within a single lexical scope
[18:48:45] phaul: yes. it's a confusing feature of Ruby
[18:49:11] phaul: things like a = 1 if false # make a declared! even if a = 1 doesn't ever run
[18:49:21] phaul: but only declared after it appears
[18:52:25] phaul: but this is the same with loops. while false; a = 1; end also makes a declared. But then it also doesn't matter on which iteration a = 1 happens
[18:52:41] phaul: if at all
[18:53:10] phaul: &>> while false; a = 1; end; a
[18:53:45] phaul: &>> while false; a = 1; end; a
[18:55:21] phaul: the other way around would throw exception: x = a; while false; a = 1; end # because it's *before* where its declared
[18:59:06] phaul: oh yes. one of my favourites :)
[21:26:11] phaul: you are not talking about hot swapping code, right?
[21:28:12] phaul: Oh I see I think, the code is already swapped to the new one, but the service will change later. got it.
[21:34:31] phaul: or just (body['asset_name'] || body['name'])&.to_s ?

2019-08-26

[09:57:52] phaul: has joined #RubyOnRails
[09:57:52] phaul: has joined #ruby-offtopic
[09:57:52] phaul: has joined #ruby
[12:48:31] phaul: https://dictionary.cambridge.org/dictionary/english/permission seems to be uncountable
[12:57:50] phaul: personally I would use strings for the file names, not symbols
[12:59:33] phaul: '/tmp/delete.me/delete.me' => # just use the rocket hash syntax and the key will be a string
[13:01:36] phaul: to me file names are naturally represented with the String type. You can have many different file names, their concatenation, String manipulations all make sense. For :mode or :owner Symbols are good.
[13:01:50] phaul: as text manipulation doesn't make sense in that context
[13:02:39] phaul: :mode + :owner is not valid as it shouldn't be
[22:25:01] phaul: leftylink: I am aware of the situation.. jhass is in here and he is the one who did carc.in.. all I can do is ping him from time to time
[22:25:49] phaul: jhass, if you see this.. can you please take a look in to ruby 2.6 being broken with carc.in? thanks
[22:27:03] phaul: or we decide to ditch carc.in, but Im not sure what else to replace it with
[22:30:18] phaul: I also kind of liked the simplicity of ui + the web API with stdin/stderr strings in json response

2019-08-21

[05:41:15] phaul: Quit: :wq
[05:43:44] phaul: has joined #RubyOnRails
[05:43:44] phaul: has joined #ruby-offtopic
[05:43:44] phaul: has joined #ruby
[17:26:36] phaul: Quit: :wq
[17:29:35] phaul: has joined #RubyOnRails
[17:29:35] phaul: has joined #ruby-offtopic
[17:29:35] phaul: has joined #ruby
[20:25:06] phaul: Quit: :wq

2019-08-19

[10:14:55] phaul: ah leftylink already mentioned TracePoint... nm
[10:16:37] phaul: Ruby is a general purpose programming language designed without any particular appication domain in mind. It was largely popularized by the Rails web framework though.
[10:18:29] phaul: BlackSalmon: these categories can give you an idea of what applications you can expect : https://www.ruby-toolbox.com/categories
[10:59:48] phaul: someone with the rights should !badconn kyrylo
[11:10:47] phaul: Try both for a few days, and then decide which experience you liked better? Sometimes documentation and additional materials are more important then the framework itself
[11:11:29] phaul: https://www.railstutorial.org/book is pretty good to get started on Rails
[15:17:05] phaul: don't get too excited about kyrylo :) they are in a constant rejoin loop, they will lose connection in a minute
[15:17:19] phaul: they beat me to it :)