Activity Graph

Page 1 of 251 | Next »


[14:09:46] jhass: sure, picture blocks as anonymous functions
[14:11:43] jhass: as soon as it's out of testing @ https://www.archlinux.org/packages/extra/x86_64/ruby/
[14:12:11] jhass: that is if that happens tomorrow, will be without laptop for the week after


[17:54:56] jhass: I hope ruby 3 will finally drop the ?x syntax
[17:56:19] jhass: wasn't it introduced because String#[] used to return the codepoint?
[17:57:30] jhass: too bad, it's just confusing and we shouldn't be perl
[18:00:21] jhass: they are, ? is just confusing, forget about it
[18:02:59] jhass: ?a == 'a', thus (?a..?z) == ('a'..'z'). the right hand variant is the common one you should remember and use, forget about the ?a stuff


[09:40:47] jhass: https://stackoverflow.com/a/11810594/2199687
[09:41:08] jhass: okay wait the comments say it's not working :D
[09:42:07] jhass: but something along those lines
[09:44:58] jhass: it's easy to test, if you close your browser now and open it again you should be signed out
[09:45:08] jhass: if you add it and do the same test again you should still be signed in
[09:46:12] jhass: https://www.rubydoc.info/github/plataformatec/devise/Devise/Models/Rememberable there are some options too
[09:48:23] jhass: you can also check the database on whether the field gets updated I guess
[14:58:57] jhass: I think it does different things on different platforms
[14:59:04] jhass: best effort basically
[15:25:38] jhass: mostly style
[15:25:51] jhass: there's a technical differencence in precedence
[15:26:16] jhass: foo bar do x end; # foo will receive the block
[15:26:28] jhass: foo bar { x }; # bar will receive the block
[15:27:16] jhass: but most people follow do/end for multiline, { / } for single line
[15:28:18] jhass: there's also a semantic style some people follow, see http://www.virtuouscode.com/2011/07/26/the-procedurefunction-block-convention-in-ruby/
[15:30:59] jhass: or for probably the earliest formulation https://web.archive.org/web/20041011120013/http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc


[12:41:56] jhass: phaul: well that solution might not be what they want as it doesn't allow for reoccurence of any letter and thus limits the space of possible sequences quite a bit
[12:42:07] jhass: also do you know why ?a is a thing? :P
[12:45:16] jhass: because before ruby 1.9 String#[] used to return the codepoint, and so did ?a then allowing for a quick way to check if a particular character is at a particular position in a string
[12:46:00] jhass: with 1.9 String#[] started to return a single character string and thus ?a was updated to represent that too to not break existing code in a subtle way
[12:46:21] jhass: but at the same time that change made the syntax quite obsoelete, which is why many frown on it
[12:48:56] jhass: I guess I'd gobble together Array.new and sample, so CHARSET = [*'a'..'z']; Array.new(10) { CHARSET.sample }.join
[12:50:26] jhass: or just "".yield_self {|s| 10.times { s << CHARSET.sample } }
[12:51:14] jhass: either is really pretty tbh
[12:51:19] jhass: eh, isn't
[12:53:13] jhass: usually those requirements come from generating some kind of opaque ID which you often can do quite nicely with an idea modulo some large prime and base36'ing the result
[12:53:32] jhass: with an ID I mean, dunno what's wrong with me today
[12:54:42] jhass: so it looks random to the user but knowing the prime you can go back in constant time
[13:02:29] jhass: I actually love it, I needed that behaviour more often than the other
[13:02:47] jhass: and it's much harder to reimplement efficiently
[13:03:18] jhass: .shuffle.take just breaks down once your input collection is big
[13:04:54] jhass: well I can only speculate but I would on more commonly useful and harder to do efficient compared to reimplementing the other behaviour efficiently
[15:44:10] jhass: exact same command to run in both cases?
[15:44:52] jhass: try require_relative instead
[15:46:02] jhass: given it's "ruby" that vanishes I wouldn't even rule out require doing something there
[15:46:19] jhass: anyway, what you're doing there is require_relative's job, let it do its work
[15:49:34] jhass: I'd still urge you to use require_relative ;)


[03:52:51] jhass: Ping timeout: 250 seconds
[04:00:17] jhass: has joined #ruby-offtopic
[04:00:17] jhass: has joined #ruby
[04:00:17] jhass: has joined #RubyOnRails
[11:58:55] jhass: marz_d`ghostman: it seems you're still confused as to when code inside a context/describe block vs when code inside a before/it/let block is run
[11:59:04] jhass: I suggest you think about and review that
[11:59:45] jhass: try with a blank spec file and putting puts statement to confirm the order of execution that you think there is
[12:13:36] jhass: you could probably do exactly that, but it would be quite confusing to most over just consistently using let
[12:21:36] jhass: inner contexts and before blocks there can of course access let definitions of outer ones
[12:21:58] jhass: btw describe and context are technically just aliases, don't worry about differences there
[12:22:48] jhass: another scheme is to use @instance_vars in before blocks, but most people prefer let these days for its cleaner looks and lazy evaluation
[12:32:08] jhass: there's no general answer to that
[12:34:11] jhass: yes, let's throw away their value after each example
[12:38:36] jhass: you're still confused as to when code inside context/describe vs code inside let/before/it is run
[12:46:02] jhass: https://p.jhass.eu/76.rb
[12:46:11] jhass: marz_d`ghostman: ^
[12:57:49] jhass: oh, useful flag for rspec there might also be -f d
[13:00:17] jhass: rspec by default randomizes the order in which it runs your example
[13:00:22] jhass: *examples
[13:00:32] jhass: -seed gives a deterministic ordering
[13:21:10] jhass: now looking it --order defined is maybe the nicer option here to achieve that :D


[16:10:34] jhass: Ookma-Kyi: running on what machine? Can't access it on which port? What machine does your hostname point to? What do you get when you try to access it? What did you try so far to resolve the issue?
[16:11:13] jhass: ah, fucking crosspost


[12:33:20] jhass: dionysus69: wat
[12:44:06] jhass: pid = spawn ...; Process.waitpid pid if last
[12:45:44] jhass: if you really absolutely must exec; args = [...]; if last; exec *args; else; spawn *args; end
[12:47:32] jhass: I'd personally give Process.detach a chance first: pid = spawn ...; Process.detach pid
[12:49:45] jhass: I'm repeating myself: you're just reimplementing spawn there
[12:49:57] jhass: spawn is doing fork & exec for you


[11:58:17] jhass: your best bet is https://bugs.ruby-lang.org/projects/ruby-trunk/search?utf8=%E2%9C%93&q=logger&scope=&all_words=&all_words=1&titles_only=&titles_only=1&issues=1&open_issues=1&attachments=0&options=0&commit=Submit
[12:57:47] jhass: 1) why use ruby for this over a shellscript? 2) why can't the ruby process be allowed to live on? 3) fork & exec is just reimplementing system()
[12:58:19] jhass: ah right it doesn't, system -> spawn
[13:00:17] jhass: for this simple case it'd be just what'd you write on the commandline and tacking an & at the end, but if you need secrets okay
[13:01:43] jhass: albeit if it's just one or two secret="$(ruby -ryaml -e "print YAML.load_file('config/secrets.yml')[ENV['RAILS_ENV']['secret']")" isn't too bad
[13:02:22] jhass: no, use spawn
[13:02:25] jhass: don't reimplement it
[13:05:17] jhass: actually try if you can just spawn six times and let the parent die, I'd expect the childs to get reparented
[13:34:35] jhass: spawn literally is fork & exec
[13:34:55] jhass: system is fork, exec & waitpid
[13:36:33] jhass: Kernel#` is fork, reopen stdout to a pipe in the parent, exec, read that pipe in the parent a& waitpid
[13:37:14] jhass: and then there's the open3 stdlib giving you a shitload more wrappers and options around doing fork & exec
[13:37:27] jhass: because it's actually hard to catch all the edge cases of doing it proper
[15:10:05] jhass: what's bundle -v?
[15:10:23] jhass: maybe something for #passenger or whatever the channel was
[15:12:29] jhass: does your Gemfile have a "ruby" line?
[15:12:35] jhass: if so, what is it?
[15:14:48] jhass: and ypur ruby version is what?
[15:17:41] jhass: mh, seems fine. As a workaround removing that line from the Gemfile should help


[10:06:09] jhass: it doesn't render out as one query with a subselect?
[10:06:30] jhass: (which a good RDMS probably rewrites to a join)
[10:08:00] jhass: oh, I misread the parens
[10:13:01] jhass: just turn the .uniq.pluck into .distinct(:id)
[10:14:23] jhass: so it stays a relation and is interpolated as a subquery into the not in
[10:18:23] jhass: since id is the only field we want to select in the subquery it's fine
[10:19:01] jhass: mh, it's indeed undocumented at https://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-where
[13:49:51] jhass: never looked at trailblazer before but I can't find where Wrap comes from
[14:00:21] jhass: but where is it defined? :/
[14:07:07] jhass: ah it's gone in the master branch
[14:10:44] jhass: ok idk this code is too hard to follow
[14:11:27] jhass: given the note about return values in the docs you linked, maybe something always returns something truthy there and it always stays on the right, idk
[16:05:38] jhass: cucumber specs are actually meant to be written by your buisness people, basically a formal format for user stories that you also happen to be able to write code for so they could be executed as tests
[16:05:44] jhass: if you don't need that, don't use it
[16:11:40] jhass: as providing this abstraction is all it does
[16:17:41] jhass: tests should test your code not your environment ;)
[18:42:26] jhass: i4: also think about whether you actually got your hash the right way around (the right things as keys and the right things as values) if you want to operate that much on the keyset
[18:42:59] jhass: or maybe you actually want an array of two element arrays
[18:45:46] jhass: do you ever do your_hash[:something]?
[19:00:38] jhass: are you abusing the i18n gem as a yaml loader there...?
[19:03:14] jhass: just call YAML.load_file?
[19:04:52] jhass: do you actually ever have keys not matching the pattern in the select? Do you actually ever make use of the anchors you define in your YAML?
[19:06:18] jhass: I'm talking about the first select, not the second
[19:06:42] jhass: btw there's never time wasted on proper variable/key names, abreviations you will not remember yourself in half a year
[19:19:01] jhass: I'd probably keep it simple, extract all redundant code to a partial/helper method and then do data[0], data[1], data[2], data[3..-1].each_slice(3) do |item|
[19:19:25] jhass: and make it into an array first
[19:23:24] jhass: btw you can define an array of objects in yaml like so https://p.jhass.eu/75.txt
[20:01:04] jhass: I guess it's akin to what they wanted. Not sure about what they needed :P
[20:01:26] jhass: I mean not sure akin to what they needed
[20:02:06] jhass: why do you use psych directly vs yaml?
[20:03:49] jhass: they usually don't come out of nowhere :P



[18:56:52] jhass: Quit: Bye
[19:00:53] jhass: has joined #RubyOnRails
[19:00:54] jhass: has joined #ruby-offtopic
[19:00:54] jhass: has joined #ruby


[10:33:22] jhass: call .size on it


[10:29:46] jhass: marz_d`ghostman_: because code outside of any blocks given to context, it or let is run before the one inside
[10:30:26] jhass: eh sorry strike context, that's actually invoked directly
[10:30:48] jhass: but let and it memoize their blocks to run them later
[10:36:51] jhass: line 23 is executed before line 16 because it's outside of a block given to it
[10:39:18] jhass: no, from the top of the file line by line, but `it` does not run the block given to it right away, however `context` does
[10:39:47] jhass: not right after, but in general yes
[10:45:29] jhass: marz_d`ghostman_: if we simplify what happens by a lot it'd look like this: https://carc.in/#/r/5l3l
[10:52:32] jhass: marahin: https://relishapp.com/rspec/rspec-core/docs/command-line/fail-fast-option
[10:52:50] jhass: not sure whether it listens to ctrl+c but worht a shot
[10:53:51] jhass: yeah as said, it's something I'd give a try, not its purpose but I see potential for having the effect ;)
[10:55:13] jhass: maybe just send it good ol' sigquit
[10:55:26] jhass: nobody remembers to handle it :D


[14:13:51] jhass: if they come back, they either want .and_return(a, b) to return a for the first call and b for the second or setup one or two mocks that are restricted with .with() to the particular argument
[15:02:38] jhass: structure your code in a way that you can run just the relevant part from your tests
[15:02:45] jhass: that is extract to classes & methods


[00:00:53] jhass: has joined #RubyOnRails
[00:00:54] jhass: has joined #ruby-offtopic
[00:00:54] jhass: has joined #ruby


[23:07:16] jhass: Ping timeout: 264 seconds
[23:13:07] jhass: has joined #RubyOnRails
[23:13:08] jhass: has joined #ruby-offtopic
[23:13:08] jhass: has joined #ruby
[23:56:20] jhass: Quit: Bye


[15:50:39] jhass: LinuxKnight: why is it inside a loop if it should run only once?
[15:57:43] jhass: what if it's a satelite control program?
[16:16:34] jhass: sans the ,
[16:17:38] jhass: eh, without
[16:19:57] jhass: https://en.wiktionary.org/wiki/sans
[16:21:02] jhass: before_save ?
[16:21:16] jhass: after the save it's obviously not changed anymore


[10:30:06] jhass: who does, they all pretend :P
[10:31:31] jhass: a blockchain, technically not the buzzword, is just a data structure
[10:31:49] jhass: would you ask "has ruby a place on the field of binary trees"?
[10:34:11] jhass: well, look harder :P
[10:36:17] jhass: https://rubygems.org/search?utf8=%E2%9C%93&query=blockchain / https://crates.io/search?q=blockchain / http://crystalshards.xyz/?filter=blockchain / https://metacpan.org/search?q=blockchain and so on
[12:44:02] jhass: just ask and stick around for an hour or two, if anybody is available with an answer to your question, they'll respond
[13:08:00] jhass: Cork: why can't you prevent it from being set in the first place?
[13:14:46] jhass: Cork: but I mean it's all your code that calls it, no?
[13:16:18] jhass: mh, I guess I'd consider just doing my own flag and doing consistent state with an after_save callback
[13:17:54] jhass: maybe there's something wrong in the data model, actual terms would help thinking about that point :)
[13:18:55] jhass: dachi: maybe it would be simpler if you use the same session but different keys within the session?
[13:20:55] jhass: no, I mean instead of using idk, "current_user_id", for the system. part use "current_system_user_id" etc
[13:28:04] jhass: does your admin thing even share much domain logic? maybe it could be its own thing?
[13:28:12] jhass: own app that is
[13:41:49] jhass: maybe you have some luck with deriving your own session store from ActionDispatch::Session::CookieStore and overriding load_session/delete_session to reset options[:key] based on the host in req
[13:44:01] jhass: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb / https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb / https://github.com/rack/rack/blob/master/lib/rack/session/abstract/id.rb#L202
[13:44:47] jhass: so @key not options[:key]
[16:48:13] jhass: huh, I would think the monkey patch is unecessary/avoidable
[16:48:41] jhass: especially since your custom store redefines one of the redefined methods again
[16:50:16] jhass: yes, CookieStore inherits Peristed
[16:51:00] jhass: so I would imagine just overriding extract_session_id in your custom store is enough
[16:51:57] jhass: not sure how I feel about copying implementation vs just setting @key and calling super, both is hackish but I think personally I'd prefer calling super


[14:19:11] jhass: yes, that's very sad indeed
[14:19:15] jhass: btw ruby has no functions
[15:07:30] jhass: just ask your question and stick around for a couple of hours, if anybody can answer they will ;)


[13:38:34] jhass: maybe something else defines a file called active_record.rb and gets priority now? dump $LOADED_FEATURES directly after the require and check the path
[13:45:12] jhass: johnaj: call redo
[13:49:24] jhass: extension = rails engine?
[13:51:07] jhass: https://guides.rubyonrails.org/engines.html#testing-an-engine
[14:08:43] jhass: that's interesting, I couldn't even find a single thing they have in common
[14:09:24] jhass: from its description "The Listen gem listens to file modifications and notifies you about the changes"
[14:09:32] jhass: what's unclear about that?
[14:10:49] jhass: no, not at all
[14:11:50] jhass: when you do git status, git compares what's in your working copy vs what's the state of HEAD
[14:12:14] jhass: listen hooks the OS to get notified when a file was written
[14:12:18] jhass: very different things
[16:41:11] jhass: like for the sake of it?
[16:42:09] jhass: essentially, the distinction between a block and a proc is that the block is fully anonymous
[16:42:19] jhass: you can make a recursive proc
[16:42:58] jhass: x = -> { x.call }
[16:44:17] jhass: you can make a method that yields a given block as a proc to itself: def x(&block); yield block; end; x {|y| y.call(y) }
[16:44:24] jhass: I never needed any of that in the real world
[17:07:49] jhass: write the data to data- attributes and write a generic click handler in our of your .js files
[17:08:43] jhass: eh, I mean *one
[17:31:41] jhass: I think I'd just make sure it's a string and only contains characters your token generator may produce
[17:32:17] jhass: cheap and easy
[17:33:03] jhass: /\A[a-f\d]+\z/ or whatever it is
[20:03:47] jhass: tbh with that little info and if dropping and recreating the test db doesn't help, I'd pull out wireshark and snoop on the mysql connection to see if that shows some error message


[02:44:11] jhass: Ping timeout: 260 seconds
[02:46:21] jhass: has joined #RubyOnRails
[02:46:22] jhass: has joined #ruby-offtopic
[02:46:22] jhass: has joined #ruby
[03:26:15] jhass: Ping timeout: 252 seconds
[03:33:24] jhass: has joined #RubyOnRails
[03:33:25] jhass: has joined #ruby-offtopic
[03:33:25] jhass: has joined #ruby


[01:49:07] jhass: *.net *.split
[01:58:12] jhass: has joined #ruby-offtopic
[01:58:12] jhass: has joined #ruby
[01:58:12] jhass: has joined #RubyOnRails


[10:28:51] jhass: has joined #ruby-offtopic
[10:28:51] jhass: has joined #ruby
[10:28:51] jhass: has joined #RubyOnRails