adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.2, 3.1.4, 3.0.6, 2.7.8: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://t.ly/9ua4 | Logs: https://libera.irclog.whitequark.org/ruby/
cnsvc has quit [Quit: %bye%]
cnsvc has joined #ruby
<adam12> johnjay: It can stand in for a lot of pieces of make. I don't think it's necessarily better than Make or CMake, but if you're in a Ruby project it's nice to use a tool that is also written in Ruby.
<adam12> johnjay: There's no integration between autotools and rake, so most C projects likely would never use it.
Sankalp has quit [Ping timeout: 256 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
<johnjay> ah ok
<johnjay> i meant in the sense of that yes, using it for non-ruby projects
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
Sankalp has joined #ruby
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
CrazyEddy has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
John_Ivan has joined #ruby
<ox1eef_> There's the rake-compiler gem that's helpful when building Ruby C extensions.
kaivai has quit [Quit: ZNC - https://znc.in]
kaivai has joined #ruby
roadie has joined #ruby
roadie has quit [Remote host closed the connection]
kaivai has quit [Quit: ZNC - https://znc.in]
kaivai has joined #ruby
Rudist17 has joined #ruby
<johnjay> question. if i declare a variable inside a loop, can i access it outside the lop
<johnjay> er loop. e.g. while i < 10 do i += 1; j = 17; end then can I access j
Rudist17 has quit [Ping timeout: 256 seconds]
kokoro has quit [Ping timeout: 248 seconds]
kokoro has joined #ruby
<sphex> johnjay: in this case yes because "while" doesn't create a block for its body
<ox1eef_> You can use loop { } to avoid that, or wrap the while body in a proc.
Linux_Kerio has joined #ruby
grenierm has joined #ruby
<johnjay> proc?
<johnjay> well i tried wrapping it in {} but it didn't like that
<johnjay> how do I know if a loop creates a block or not
roadie has joined #ruby
Pixi` has quit [Quit: Leaving]
Pixi has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
Thiago has quit [Ping timeout: 245 seconds]
johnjay has quit [Remote host closed the connection]
TomyLobo has quit [Ping timeout: 256 seconds]
mexen has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
teclator has joined #ruby
crespire has quit [Ping timeout: 240 seconds]
crespire has joined #ruby
Linux_Kerio has quit [Quit: Konversation terminated!]
Linux_Kerio has joined #ruby
<leftylink> too bad. I would have answered that question had they not left
<leftylink> I remember that back in 2019 we were discussing this, baweaver informed me that in a certain other language they call this the immediately invoked function expression
<leftylink> the departure of baweaver from this channel was a huge loss
niv has quit [Quit: Powered by LunarBNC: https://LunarBNC.net]
niv has joined #ruby
_ht has joined #ruby
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
aesthetikx has quit [Ping timeout: 256 seconds]
aesthetikx has joined #ruby
Linux_Kerio has quit [Ping timeout: 250 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
kaivai has quit [Quit: ZNC - https://znc.in]
kaivai has joined #ruby
gr33n7007h has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
gr33n7007h has quit [Ping timeout: 248 seconds]
gr33n7007h has joined #ruby
moldorcoder7 has joined #ruby
classi10 has joined #ruby
grenierm has quit [Ping timeout: 245 seconds]
<isene> After a few hours of coding, I now got a working shell written in Ruby with configurable prompts and aliases. This is fun stuff. Will aim to make this awesome (at least for me)
<Shell> Nice. Job control next? :)
fat_shinobi has joined #ruby
Bentha has joined #ruby
classi10 has quit [Ping timeout: 260 seconds]
infinityfye has joined #ruby
<rapha> weaksauc_: thats nice to know. perhaps time i checked it out again.
<rapha> isene: what are you aiming for? something like fish?
<ox1eef_> The default rails stack recommends hotwire these days, it is a refreshing approach given the advent of React but I think you will find a lot of Rails shops using React or Vue. So the space is a bit more diverse than before.
<ox1eef_> And I think it makes sense. React and Rails doesn't make a whole lot of sense. There's little need for actionview anymore, and more often than not you just want controllers that spew JSON.
<rapha> hmm. having to learn some react at work atm. colleague showed me vue (might be the project i'll be put in after). vue somehow seems more coherent and easier to understand, especially when react is paired with redux. is hotwire another view framework?
unindi27 has joined #ruby
<ox1eef_> hotwire is somewhat a revert to the classical approach where you have typical actionview views that are rendering HTML, except it is done in a such a way that only the HTML that has changed is sent across the wire.
<rapha> so... something on top of websockets?
<ox1eef_> I haven't actually used it, but that's my understanding of it.
<rapha> k
<ox1eef_> I have used Vue, and React in my past two jobs and I definitely prefer React.
<rapha> because on its own its leaner?
Bentha has quit [Ping timeout: 246 seconds]
<ox1eef_> I like how a component is just a function that returns a JSX element / node.
<ox1eef_> Simple concept. Not a whole lot to learn in that regard.
<rapha> html inside of js did feel weird in the beginning but in practice it works well
<ox1eef_> Agreed.
<ox1eef_> I think Vue only separates the two at the conceptual level as well. In the end it is still bundled into JavaScript.
Linux_Kerio has joined #ruby
<rapha> how do you feel about Svelte?
<isene> rapha: Maybe. But knowing the work Axel put into creating fish, I doubt I'll get that far
<ox1eef_> I don't know much of anything about Svelte.
<rapha> me neither
<rapha> it's just said to be the thing that cleans up the mess created by the current "big 3"
<rapha> i have my doubts but know nothing, so...
<ox1eef_> Yeah, that's how I understand it too. Kind of like the merb of the Rails world or something like that.
<isene> Having a brain fart moment, so please help me out; I have a string STR = "a b c a d" and a hash with the format {"a" => "foo", "b" => "bar"}. I want to replace all occurences of the hash keys with the hash values in STR. The result would be "foo bar c foo d". How do I get this?
<rapha> .map and .gsubm
<rapha> ?
<ox1eef_> As rapha says - something like: h.keys.each { STR.gsub(_1, h[_1]) }
<rapha> i didnt want to give a full solution right away tho :)
<ox1eef_> Woops -_-
<leftylink> gsub takes a block, so you'd want to take advantage of Hash#to_proc with gsub.
<rapha> also why .keys? should work without
<ox1eef_> Indeed.
<rapha> leftylink: how does that work? curious now. i know gsub with a regex and a string.
<leftylink> pandabot: ri String#gsub
<leftylink> > A block that will determine the replacing string.
<ox1eef_> Sure, but what Hash method returns a proc that returns a value ?
<leftylink> pandabot: ri Hash#to_proc
<leftylink> well, in this case it appears Hash#to_proc isn't even necessary. gsub will take a hash.
<isene> SO, how does it take a hash and operate on it?
<leftylink> as stated in the section labeled "Hash replacement"
<leftylink> > If argument replacement is a hash, and pattern matches one of its keys...
<ox1eef_> The block form would appear to not work because gsub is not calling the block with a key.
<isene> Goodie
<leftylink> the block form works fine. the argument to the block is each matched text
<ox1eef_> Can you share an example
<leftylink> pandabot rb '1234'.gsub(/[12]/) { print "GSUB_BLOCK[#{_1}]" }
<pandabot> GSUB_BLOCK[1]GSUB_BLOCK[2]"34" - https://carc.in/#/r/f0mi
<leftylink> pandabot rb '1234'.gsub(/[12]/) { "REPLACEDIT[#{_1}]" }
<pandabot> "REPLACEDIT[1]REPLACEDIT[2]34" - https://carc.in/#/r/f0mj
<ox1eef_> >> h = {a: "foo", b: "bar" }; "a b".gsub("a", &h)
<ruby[bot]> ox1eef_: # => " b" (https://carc.in/#/r/f0mk)
<ox1eef_> >> h = {"a" => "foo", b: "bar" }; "a b".gsub("a", &h)
<ruby[bot]> ox1eef_: # => "foo b" (https://carc.in/#/r/f0ml)
<ox1eef_> Ah I see - works so long as the key is also a string
<ox1eef_> Cool trick indeed
Bentha has joined #ruby
<ox1eef_> >> h = {"a" => "foo", "b" => "bar"}; "a b".gsub("a", h)
<ruby[bot]> ox1eef_: # => "foo b" (https://carc.in/#/r/f0mo)
<ox1eef_> >> h = {a: "foo", "b" => "bar"}; "a b".gsub("a", h)
<ruby[bot]> ox1eef_: # => " b" (https://carc.in/#/r/f0mp)
<ox1eef_> I think it could make sense for Ruby to coerce in that case. What could the block argument be, but a string?
<isene> But how to replace the "a" in gsub("a", h) with any of the keys in h?
<isene> or rather - all the keys in h
unindi27 has quit [Ping timeout: 265 seconds]
<leftylink> pandabot ri Regexp.union
<leftylink> lucky, Regexp.union even takes an array arg so you don't even have to splat.
<ox1eef_> >> {"a" => "foo", "b" => "bar, "c" => "baz" }; "a b c",gsub(/[abc]/, h)
<ruby[bot]> ox1eef_: # => (https://carc.in/#/r/f0mq)
<leftylink> not that splatting would have been particularly burdensome anyway
Bentha has quit [Ping timeout: 256 seconds]
<ox1eef_> >> {"a" => "foo", "b" => "bar, "c" => "baz" }; "a b c".gsub(/[abc]/, h)
<ruby[bot]> ox1eef_: # => (https://carc.in/#/r/f0mr)
<isene> ox1eef_: I mean replace any occurences in the string with any and all (unknown) keys in h
<isene> and not to name them as [abc]
<leftylink> pandabot: ri Regexp.union
<mooff> >> `uname -a`
<ruby[bot]> mooff: # => "" (https://carc.in/#/r/f0ms)
<mooff> foiled!
<ox1eef_> isene: /[#{Regexp.escape("str".split.join(""))}]/
<ox1eef_> Something like that might work, but I'm trying to understand why it fails on the eval bot and not in IRB o_O
<isene> leftylink: Damn. Regexp.union does the trick!
<isene> It's a beauty
<leftylink> you don't want to join("") if there are any keys that are more than one character, therefore Regexp.union
<ox1eef_> Lemme try
<isene> So, I got this: cmd.gsub(Regexp.union(@alias.keys), @alias)
<isene> This will replace all occurences of aliases in a given command
<ox1eef_> >> str = "a b c def"; h = {"a" => "foo", "b" => "bar", "c" => "baz" }; str.gsub(Regexp.union(str.split(" ")), h)
<ruby[bot]> ox1eef_: # => "foo bar baz " (https://carc.in/#/r/f0mt)
<ox1eef_> why does def disappear
<leftylink> because h["def"] has no value.
<ox1eef_> Ah, right!
<ox1eef_> While cool in their own right, I don't think I would use them. Too error prone.
<leftylink> this also needs some care if some replacements are substrings of things not to be replaced
<leftylink> for example if we want to make a swear filter
<isene> But - it will also replace occurences of any command inside other commands. So I need a way to have {"ls" => "ls --color -F"} not replace the 'ls' in e.g. "else". So - only replace if it is preceeded by start-of-line or a pipe and proceeded by a space or a pipe.
<mooff> >> ["ls", "else"].map { _1 =~ /\bls\b/ }
<ruby[bot]> mooff: # => [0, nil] (https://carc.in/#/r/f0mv)
<leftylink> honestly I'd just transform_keys and surround with \b and be done with it
<leftylink> and \b done with it
<ox1eef_> I think this will only get you so far. You should look into building an actual parser that goes through the input char by char.
<mooff> :P
<isene> ox1eef_: Trying not to slow things down to much :-/
<isene> leftylink: What you wrote there was a bunch of characters to me. Elaborate?
<ox1eef_> I think that eventually it is what you will need to do.
<mooff> what are you trying to build isene?
<leftylink> pandabot: ri Regexp
<leftylink> in that case, it would be wise to look at that page and see what \b means.
<isene> mooff: A shell
<mooff> \b matches a "word boundary", like a space or ( or ) or similar
<isene> leftylink: That part was understood.
<isene> lemme check tranform_keys
<ox1eef_> shells are capable of parsing their own languages too, how will you do that with regular expressions ?
<isene> ox1eef_: No idea. Yet.
<ox1eef_> Probably not impossible but usually not recommended.
<mooff> ZALGO, HE COMES!!!
cek has joined #ruby
<mooff> (parsing Ruby with regex probably summons Zalgo like https://stackoverflow.com/a/1732454)
<adam12> LOL
pitara has joined #ruby
<ox1eef_> A killer Ruby shell might be able to understand POSIX shell, so you could copy&paste scripts that already exist.
<mooff> are you currently trying to handle command aliases?
<mooff> for instance, "ls" resolving to "ls --color"
<mooff> are user commands evaluated as Ruby?
<isene> mooff: yes and yes
<mooff> in that case, does the user's command invoke an "ls" method in Ruby?
<mooff> maybe command aliases just override / define a method
<isene> At the moment, I simply system() everything
<mooff> from method_missing?
TomyLobo has joined #ruby
<isene> When I first do @alias.keys.map{|k| "\b#{k}\b"}, I get e.g. {"\bls\b"=>"ls --color -F", "\bl\b"=>"less"}, but when I then do Regexp.union(@alias.keys), the \b changes into \x08 as in /\x08ls\x08|\x08l\x08/ which ends up not matching anything (while the expected result /\bls\b|\bl\b/ would match as intended) - How would I go around preserving the \b with the Union or otherwise?
<leftylink> it's because "\b#{k}\b" is a string, whereas it should be a regex instead
Cork has quit [Ping timeout: 240 seconds]
<isene> OK, but the keys are strings, so where would I interject a command to make it a regex (as union takes strings to transform into a regex)?
<leftylink> pandabot: what's ruby literals
<leftylink> how lucky
<leftylink> > Interpolation may be used inside regular expressions
<leftylink> "union takes strings" is true but not the whole truth either
<leftylink> pandabot: ri Regexp.union
<leftylink> > The patterns can be Regexp objects
<isene> Right, but I cannot have regex objects as keys, so my beautiful construct does not work: a = @alias.transform_keys {|k| "\b#{k}\b"}; cmd.gsub(Regexp.union(a.keys), a)
<leftylink> 13:52:59 < leftylink> it's because "\b#{k}\b" is a string, whereas it should be a regex instead
<leftylink> well, clearly a can't be the replacement arg to gsub
<leftylink> since the replacement needs strings
<leftylink> but the arg to Regexp.union should absolutely be Regexps, each starting and ending with \b
<mooff> try "\\b#{k}\\b"
<mooff> \b means something different in string literals, it's the ancient ASCII "backspace" haracter
unders has joined #ruby
<mooff> so you gotta escape it
<isene> mooff: That doesn't work as the Regexp.union(a.keys) then becomes /\\bls\\b|\\bl\\b/
pitara has quit [Ping timeout: 240 seconds]
<mooff> hmm
<mooff> >> Regexp.new("\\bfoo\\b")
<ruby[bot]> mooff: # => /\bfoo\b/ (https://carc.in/#/r/f0no)
<mooff> does that help?
<isene> Seems a step in the right direction - but here's a weird twist: Regexp.union([/\bls\b/, /\bl\b/]) -> /(?-mix:\bls\b)|(?-mix:\bl\b)/
<isene> If that would have worked, I would have the whole solution wrapped like this: a = @alias.transform_keys {|k| "\\b#{k}\\b"} ; cmd.gsub!(Regexp.union(a.keys.map{|k| Regexp.new(k)), a)
teclator has joined #ruby
<isene> but nope, the Union of regexp objects seems not to like that
<leftylink> feel free to use the block form to debug. for example have it print out "I MATCHED {_1}"
<leftylink> I always forget the # huh
<leftylink> "I MATCHED #{_1}"
<leftylink> been doing that a lot lately
<leftylink> I don't see why there is reason to be concerned about the union
<leftylink> Regexp.union([/\bls\b/, /\bl\b/]) -> /(?-mix:\bls\b)|(?-mix:\bl\b)/ looks exactly correct
unders has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
<isene> With @alias = {"ls"=>"ls --color -F", "l"=>"less"} and cmd = "ls less", the code `a = @alias.transform_keys {|k| "\\b#{k}\\b"} ; cmd.gsub!(Regexp.union(a.keys.map{|k| Regexp.new(k)), a)` leaves cmd as " else"
<leftylink> well of course. because the key doesn't exist in the hash (a)
<leftylink> when you, as I instructed, change the gsub to a { "MATCHED #{_1}" }, you see it says "MATCHED ls". and now we ask, does ls exist in a? no it doesn't. a contains \bls\b, not ls. therefore, replaces with nothing.
<isene> So, how would you go about resolving that?
<leftylink> theh hash passed to gsub needs to have ls as a key, not \bls\b. luckily, you already have one handy that does have ls as a key.
<mooff> >> h = {"ls" => "yay", "l", "also yay"}; r = h.transform_keys { |k| Regexp.new("\\b#{k}\\b") }; "ls && l".gsub(r)
<ruby[bot]> mooff: # => (https://carc.in/#/r/f0np)
<mooff> >> h = {"ls" => "yay", "l", "also yay"}; r = h.transform_keys { |k| Regexp.new("\\b#{k}\\b") }; "ls && l".gsub(/\w+/, r)
<ruby[bot]> mooff: # => (https://carc.in/#/r/f0nq)
<mooff> oh, syntax error
<mooff> >> h = {"ls" => "yay", "l" => "also yay"}; r = h.transform_keys { |k| Regexp.new("\\b#{k}\\b") }; "ls && l".gsub(Regexp.union(r.keys), h)
<ruby[bot]> mooff: # => "yay && also yay" (https://carc.in/#/r/f0nr)
teclator has quit [Ping timeout: 260 seconds]
___nick___ has joined #ruby
<mooff> >> k = "hey"; /\b#{k}\b/ # can write this instead of Regexp.new(...)
<ruby[bot]> mooff: # => /\bhey\b/ (https://carc.in/#/r/f0ns)
<mooff> oh yeah, still want to Regexp.escape
<mooff> >> k = "hey"; /\b#{Regexp.escape k}\b/
<ruby[bot]> mooff: # => /\bhey\b/ (https://carc.in/#/r/f0nt)
<isene> mooff: You are officially a champ. Thank you sooo much!
<isene> It's working
<isene> :-)
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
lena64t has joined #ruby
lena64t has quit [Client Quit]
lena64t has joined #ruby
<mooff> you're welcome isene
<mooff> also note that leftylink provided all the clues!
perrierjouet has quit [Ping timeout: 240 seconds]
perrierjouet has joined #ruby
Cork has joined #ruby
nmollerup has joined #ruby
c10l has joined #ruby
___nick___ has quit [Ping timeout: 268 seconds]
cek has quit [Quit: Connection closed for inactivity]
Guest26nakilon has joined #ruby
<Guest26nakilon> how do I wait until there is a newline-ending string in a socket?
<Guest26nakilon> p(@socket.wait_readable(1)) and @socket.gets(chomp: true)   --   prints "#<TCPSocket:fd 15, AF_INET, 192.168.1.68, 58734>" but then raises Connection reset by peer @ io_fillbuf - fd:15 (Errno::ECONNRESET)
<Guest26nakilon> refactoring the irb bot for 100th time
<Guest26nakilon> *irc
<Guest26nakilon> it always was with #select but I thought the wait_readable is what it should be replaced with today
<Guest26nakilon> was I wrong?
<Guest26nakilon> I wanted to rewrite because with select it was raising the error in the same place in some rare cases, like if select said that there is something but then the following gets could not read that anyway
<Guest26nakilon> or is the exception in gets inavoidable?
<Guest26nakilon> this manual buffer building looks horrible https://stackoverflow.com/a/75161662/322020
__ht has joined #ruby
rvalue- has joined #ruby
unCork has joined #ruby
gr33n7001 has joined #ruby
<Guest26nakilon> oh I feel like this select returns nil when socket is closed or smth
<mooff> Guest26nakilon: is the @socket wrapped with SSL?
<mooff> if it's under control of an SSLSocket, then reading / writing the underlying socket can cause the connection to reset
<Guest26nakilon> nope
Cork has quit [*.net *.split]
gr33n7007h has quit [*.net *.split]
aesthetikx has quit [*.net *.split]
_ht has quit [*.net *.split]
rvalue has quit [*.net *.split]
ox1eef_ has quit [*.net *.split]
unCork is now known as Cork
__ht is now known as _ht
rvalue- is now known as rvalue
<mooff> check out IO#readline
<mooff> though you couldn't use it with select (it'll block until a new line appears in the stream, but select can't indicate when one is there)
<Guest26nakilon> I currently see that Kernel::select([socket], nil, nil, 1) returns socket but [0][0].gets(chomp: true) from it returns nil
<mooff> what does .gets(chomp: false) return?
<mooff> if you share a gist i'll try it
<Guest26nakilon> can't easily share the full code, it's huge
<Guest26nakilon> "but select can't indicate when one is there" -- I need something to indicate
<mooff> ah
<mooff> gets returns the next line in the stream, or nil, if there isn't one
<mooff> presumably your buffer doesn't contain a "\n" yet when it's putting nil
teclator has joined #ruby
<Guest26nakilon> do you mean there is some text but jut without newline?
<mooff> yeah, that's the guess
<Guest26nakilon> fuck twitch, it looks wrong
<Guest26nakilon> let's see...
<Guest26nakilon> socket.read_nonblock(100) throws: end of file reached (EOFError)
<mooff> are you printing everything you send and receive?
<mooff> if so, what does the exchange look like
<mooff> maybe Twitch doesn't like your registration messages and closes the connection
<mooff> have you got a cleartext tunnel to ircs://irc.chat.twitch.tv or something?
<Guest26nakilon> heh, if I use `read` instead of `read_nonblock` it steals data from the following gets and the program can't reach the moment when my issues starts (only after a few seconds of data transfer)
<Guest26nakilon> mooff I always printed only after gets
<Guest26nakilon> yeah maybe it it closes connection telling me some slurs but without \n
<mooff> read / read_nonblock will advance the cursor, so both should 'steal' data from being visible to gets
<Guest26nakilon> mooff never heard about this link you gave
<mooff> ircs:// is just the scheme for IRC over TLS
<mooff> default port 6697
<mooff> probably will end up needing something like that
<Guest26nakilon> I just have to expire my token and since they've made some API changes now the third party service people user to obtain oauth token demands client-secret so I decided to generate token on my own and it appears that it expires often so I have to add the access token refresh  to the irc bot, and that's what I'm now trying to handle
<Guest26nakilon> first, before doing the refresh-token routine I need to figure out the loop I get
<mooff> fwiw, i don't think i've had to change my bot's PASS token in ~3 years
<Guest26nakilon> I didn't either
<mooff> what's changed?
<Guest26nakilon> but I forgot the password, and now tokens are expiring
<mooff> oh God
* mooff shudders in OAuth
<mooff> preserve your sanity and switch to simple readline() loop if you can
<mooff> until you're sure it works
<Guest26nakilon> first you get the "auth code", then get the auth token and refresh token, and you can't specify the expiration -- after hours the auth code is expired and when auth token is expired you have to get new via refresh one
<mooff> ffs, so you have to do OAuth in your bot to get an IRC password?
<Guest26nakilon> yes  )
<mooff> i should hold on to my existing token for dear life
aesthetikx has joined #ruby
<Guest26nakilon> where is io#readline doc?
<mooff> pandabot: ri IO.readline
<Guest26nakilon> ah I see, it's somehow not in google index
<mooff> Guest26nakilon: ri IO.readline :D
<Guest26nakilon> but it's blocking
<mooff> yes
<Guest26nakilon> ok maybe I should face the EOF error but somehow retrieve what was on queue before the end
<mooff> get the auth working before doing non-blocking
<Guest26nakilon> not sure about that; I want to have a clear view on what's happening first
<Guest26nakilon> because I had some infinite and fast loop  when I alt+tabbed to it today
<Guest26nakilon> should better recognize when my auth is broken and not loop
<Guest26nakilon> I imagine I should do #select, then #read to a some StringIO and then gets from it
<mooff> you definitely want some additional buffer, i think
<mooff> expect keeps any unused data in a buffer for next time, if the timeout expires
<Guest26nakilon> but wait, if the connection was closed as we presume, it would not loop like it's seen in my gist (it loops for many pages until I stop it) so the connection is still on; and no matter if I make a kludge with StringIO or use the IO#expect I'll can't use my wanted "\n" delimeter there it won't reach it
<Guest26nakilon> omg, "I'll can't" -- sorry for my english
<Guest26nakilon> rarely use it in last months
<Guest26nakilon> yeah looks like I have to make a buffer or I'll never know what's stuck there
CalimeroTeknik has quit [Changing host]
CalimeroTeknik has joined #ruby
<mooff> of a readline_unblock that keeps partial reads
<Guest26nakilon> thanks!
<mooff> yw
<Guest26nakilon> meh, StringIO is not much useful -- I can rewind it to the start for gets but can't forward it push more
<Guest26nakilon> oh, there is #size
<Guest26nakilon> oh, and stringio does not shrink on gets, so it'll leak
johnjaye has joined #ruby
<Guest26nakilon> hmm, Kernel::select([socket], nil, nil, 1) keeps returning the socket even after I [0][0].read it and it's just forever ""
<Guest26nakilon> I'm missing something, I want select to stop returning it after I read
<Guest26nakilon> maybe the empty string is what glitching my program; I don't expect it and I don't know why it's not stuck on select
<Guest26nakilon> that's weird, socket.nread returns 32, but socket.read hangs for several seconds
mexen has quit [Quit: Connection closed for inactivity]
<Guest26nakilon> ok made it like this https://dpaste.org/wsHpS/slim
<Guest26nakilon> but bad thing is that it loops through the first line like insane when it's nothing to read; but the #select did the same, I don't know why
<Guest26nakilon> so this is what is weird about i all; https://dpaste.org/fyvAt/slim -- for several seconds the #select is rightfully stuck returning nil but then it returns the socket while in fact there is nothing to read from it
<Guest26nakilon> i.e. .read is "" and .nread is 0, but .select isn't nil
<Guest26nakilon> oh lol https://www.ruby-forum.com/t/tcp-socket-connection-reset-but-select-says-its-valid/195681/2 so it's returning when it's eof, but c'mon, I can't check for eof with #eof because it's blocking
<Guest26nakilon> should I assume that if the select returned but the nread is 0, then it's dead?
<Guest26nakilon> probably
Linux_Kerio has quit [Ping timeout: 260 seconds]
<Guest26nakilon> I guess it's done https://gist.github.com/Nakilon/8b019e2ecb3e052b11c1a09657c90e11 now to figure out how to shove oauth into it
<weaksauc_> Guest26nakilon I think there's a typo on your summary... it should probably be non-heuristic instead of non-eursitic
<Guest26nakilon> weaksauc_ thank you!
<weaksauc_> np
<weaksauc_> i see you made a random csgo map
<weaksauc_> that's neat
<weaksauc_> did you see the rouge like one that someone did?
<Guest26nakilon> yeah but guys with weak PCs said it's lagging; I suppose the engine optimizes the static obstacles but props that can be moved consume more rendering power
<weaksauc_> ah
<isene> Can I redefine what "\b" includes or not?
_ht has quit [Remote host closed the connection]
<isene> I need "-l" not to be treated as "l" when doing "\bl\b"
ox1eef_ has joined #ruby
<Guest26nakilon> weaksauc_ I suppose it's about this https://www.youtube.com/watch?v=IfCRHSIg6zo
<Guest26nakilon> you probably can't recompile the BSP on fly so while the usual map is only rendering what you, you have to render all the dynamic stuff, even if it's not all visible
<Guest26nakilon> *what you see
<weaksauc_> this guy got around that somehow... https://www.youtube.com/watch?v=OiHfMwQhekk
<weaksauc_> isene i don't think so no
<weaksauc_> isene what's the bigger context and maybe there's another way
<Guest26nakilon> it does not show benchmarks though ) I also didn't know my map is lagging, but buddy could not play it
<Guest26nakilon> on his laptop
<Guest26nakilon> also it would be better with simplier models but I don't know how to model and the boxes I took, probably, had too much polygons
<Guest26nakilon> another one I saw recently: https://www.youtube.com/watch?v=lz2HEns36T0 and this one looks insightful https://youtu.be/3SvRWWU3s00
<Guest26nakilon> none of those videos have a credit to my one, that AFAIK was the first in csgo ..P
<weaksauc_> ha lame
tomtmym has quit [Quit: Gone.]
ox1eef_ has quit [*.net *.split]
gr33n7001 is now known as gr33n7007h
ox1eef_ has joined #ruby
Linux_Kerio has joined #ruby
infinityfye has quit [Quit: Leaving]
<mooff> isene: can't refine \b, but could use a different pattern in place of \b
windfa83 has joined #ruby
dionysus69 has joined #ruby
windfa83 has quit [Client Quit]
roadie has quit [Ping timeout: 248 seconds]
<isene> While I have full control of regex in vimscript, I'm not quite there in Ruby. How do I do a "match 'l' but not if its preceeded by '-' or followed by '+' "?
<weaksauc_> negative lookbehind probably
roadie has joined #ruby
<weaksauc_> ((?<!-)\|(?!+))
<weaksauc_> i haven't tried that but it should work i think
<weaksauc_> actually you need to escape the +
<weaksauc_> ((?<!-)\|(?!\+))
<weaksauc_> yeah that does it isene
roadie has quit [Ping timeout: 248 seconds]
<isene> Great, thanks 😊
<weaksauc_> the ruby regex page is very detailed if you haven't looked through that for all the options
slothby has quit [Quit: brb ... maybe]
slothby has joined #ruby
slothby has quit [Client Quit]
slothby has joined #ruby
ap4y has joined #ruby
teclator has quit [Ping timeout: 240 seconds]
<isene> Haven't read that one. Thanks for that.
dionysus69 has quit [Quit: dionysus69]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
fat_shinobi has quit [Quit: Leaving]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
lena64t has quit [Remote host closed the connection]
lena64t has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
hwpplayer1 has joined #ruby
<hwpplayer1> hi people !
TomyLobo has quit [Ping timeout: 240 seconds]
TomyLobo has joined #ruby
roadie has joined #ruby
John_Ivan has quit [Quit: Disrupting the dragon's slumber one too often behooves conflagration for eternity.]
roadie has quit [Ping timeout: 248 seconds]
John_Ivan has joined #ruby
TomyLobo2 has joined #ruby
TomyLobo has quit [Ping timeout: 250 seconds]