Activity Graph

Page 1 of 14 | Next »


[13:54:41] ytti: has joined #ruby


[11:46:47] ytti: i'm lazy, sorry
[11:46:50] ytti: i have nogogiri document
[11:46:55] ytti: and i want to iterate through all tables
[11:47:06] ytti: without caring wher they are
[11:47:12] ytti: and check the childrens name
[11:53:52] ytti: name = "table",
[11:53:52] ytti: #(Element:0x3fdbf9878588 {
[11:53:52] ytti: children = [
[11:53:57] ytti: like here is one example which is of interest to me
[11:54:48] ytti: NL3limin4t0r, i think you are right
[11:56:23] ytti: doc.xpath("//table").first.xpath("//th").first.children.first.text
[11:56:27] ytti: will do the trick (in a loop really)
[11:56:34] ytti: what i'm trying to do, is convert confluence tables to XLS
[11:56:41] ytti: and confluence doesn't give any name to tables
[11:56:58] ytti: so i'll randomly decide to call first TH as discriminator on what tables need to beconverted
[12:04:35] ytti: darn, i'd need children above what imatch to...
[12:04:54] ytti: NL3limin4t0r, any way to get 1 above match? :>
[12:05:00] ytti: NL3limin4t0r, or before
[12:05:22] ytti: NL3limin4t0r, i'd need that 'management' element
[12:08:56] ytti: NL3limin4t0r, alas that is plentiful and mostly false positive
[12:09:02] ytti: but cpu time is cheap i suppose
[12:11:41] ytti: thank you


[21:18:42] ytti: #new is bit of magic
[21:18:52] ytti: it creates new instance of the class, then calls initialize on the newly created class
[21:20:12] ytti: &>>
[21:20:34] ytti: &>> /new/
[21:22:42] ytti: &>> class Class;def new;false;end:ned
[21:22:50] ytti: &>> class Class;def new;false;end;end
[21:23:01] ytti: hmm i expected it to break :)
[21:24:53] ytti: &>> class Class;def new;"meh";end;end;;p k
[21:25:02] ytti: that's maybe more descriptive
[21:25:40] ytti: what new should do, is call String's initialize
[21:25:47] ytti: but because i rewrote it, it returns meh


[12:30:17] ytti: leftylink, sounds remotely like -


[07:39:25] ytti: what is the problem
[07:40:05] ytti: be specific
[07:41:57] ytti: you could build package which lazily requires
[07:42:38] ytti: i understand the problem now
[07:42:41] ytti: but i can't relate
[07:44:51] ytti: i' dsay lazy require or autoload
[07:45:10] ytti: are most reasonasble idiomatic approaches which cover some of the same problem ground
[07:45:23] ytti: but do not perfectly overlap


[09:54:39] ytti: Tuor, maybe do something like this gem.files = %x(git ls-files -z).split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
[09:54:52] ytti: Tuor, gem.executables %w[bin1 bin2 bin3]
[11:15:54] ytti: Bish, it's not clear to me what you want to do
[11:18:24] ytti: perhaps give input and desired output
[11:19:55] ytti: perhaps Enumerable#partition but unsure
[11:20:01] ytti: would need to understand better what you need
[11:21:18] ytti: &>> (1..10).partition(&:odd?)


[10:10:31] ytti: i'm skeptical of mass migration of github to gitlab
[10:11:57] ytti: i feel like gitlab is more winning users from internal csv, subversion etc systems
[10:12:13] ytti: instead of github


[07:04:44] ytti: TIL: unum, about time we have competing real/float solution
[07:24:39] ytti: tsujp,
[07:24:44] ytti: tsujp, 09:49 < havenwood>
[08:15:52] ytti: Intelo, i would propose to read the single bullet point the output has
[08:18:15] ytti: you already ddi 1 and 2
[08:18:21] ytti: and 3 was written on the output, which you were msising


[12:45:12] ytti: people put way too much thought on how to learn things
[12:45:20] ytti: it doesn't matter, what matters is putting in the hours
[12:45:40] ytti: rest will come


[11:01:06] ytti: i assume them to be same
[11:01:27] ytti: but i wouldn't be terribly surprised if i was wrong, particularly relating i8n stuff
[11:01:39] ytti: that some corner case would exist


[07:19:52] ytti: i think he implies there was implementation change which made them cheaper


[09:44:30] ytti: you may need to show example where you go wrong
[09:44:59] ytti: 1/0.to_f
[09:45:30] ytti: &>> 1/0.to_f
[09:46:24] ytti: why would you return 0?
[09:47:21] ytti: then don't use zero divisor
[09:47:26] ytti: check for divisor first
[09:47:38] ytti: and return something domain appropriate


[12:58:48] ytti: Ping timeout: 245 seconds
[13:06:02] ytti: has joined #ruby


[08:19:23] ytti: [2] pry(main)> "moi".object_id
[08:19:23] ytti: [1] pry(main)> 1.object_id
[08:19:24] ytti: => 70185495898120
[08:19:38] ytti: object1.object_id == object2.object_id
[08:20:41] ytti: actually, scratch that, eql? is not about object_id
[08:21:07] ytti: eql? is usually just ==, i.e. object dependent what it does
[08:21:53] ytti: in which object do you see this documentation?
[08:34:44] ytti: that is fine
[08:35:18] ytti: more specifically, no periods
[08:37:00] ytti: &> {:a=>{:b=>1}}.dig(:a,:b)
[08:38:23] ytti: &>> {:a=>{:b=>1}}.dig(:a,:b)
[08:38:31] ytti: there we go
[09:05:03] ytti: as far as i can see, basd on what you tell, this should work
[09:05:12] ytti: perhaps write simple example of failing code in some playground
[09:05:50] ytti: the error implies you are actually accessing Array, not Hash
[09:06:14] ytti: so could it be you're omitting that :subscr actually contains an array?
[09:06:24] ytti: perhaps you need ctx[:subscr].first[:results]
[09:11:01] ytti: that should work
[09:11:07] ytti: unless you trap it and handle it
[09:13:07] ytti: if you press ctrl+c it should just abort the execution of the rugby
[09:13:11] ytti: ruby also
[09:13:14] ytti: sometimes rugby
[09:14:06] ytti: do you want to abort reading user input and continue executing the ruby?
[09:20:36] ytti: it should work without doing anything :>


[15:17:55] ytti:
[15:20:04] ytti: alot of jobs?
[15:20:50] ytti:
[15:26:23] ytti: seems like a good career move, congratulations
[15:26:41] ytti: having some subject matter expertise in any domain makes you much better programmer in that domain
[15:36:05] ytti: leitz, aye, and ceiling is pretty low for sysadmin without development skills
[15:40:05] ytti: yeah you need programming and you need subject matter expertise to be really marketable
[15:40:08] ytti: much like in many other domains
[15:40:26] ytti: like if you're good lawyer, you specialise in specific area where you are also expert in the domain, not just legal
[15:41:56] ytti: i love ruby, but i think market now strongly prefers statically typed languages
[15:42:05] ytti: and facts don't matter
[15:42:08] ytti: demand is what it is
[18:40:44] ytti: I've used this library before: and handled millions of HTTP requests using it.
[18:40:51] ytti: i wonder in what time


[19:03:41] ytti: (golf version, had to tinker around quite a bit, and i'm proud of what i was able to do)


[07:27:51] ytti: because exec works same as in shells
[07:27:55] ytti: it replaces the current running process
[07:28:10] ytti: if you do that in your bash or zsh or whatever, same thing happens
[07:28:44] ytti: use-case is some wrapper which is meant to do something and lauch some program with some arguments
[07:29:10] ytti: because it replaced the forked pid
[07:29:12] ytti: not the ruby pid
[07:29:51] ytti: you may want
[07:30:03] ytti: %x("command here")
[07:30:06] ytti: or system("command here")
[07:30:19] ytti: however, personally, I would always use popen3
[07:30:34] ytti: because shell interpretation usually is undesirable and dangerous
[07:30:48] ytti: and with popen3 you can pass name of executable and its arguments separately
[07:31:54] ytti: i think programmign languages like ruby, should make shell expansion the special case
[07:32:02] ytti: and system(bin, args) the common case
[07:32:07] ytti: so that it would be easy to code safe
[07:32:11] ytti: and hard to code unsafe
[07:32:40] ytti: now it's the converse, people code unsafe shell execution, because the safe way is bit more trouble and they are not aware of the implications


[07:14:56] ytti:
[07:15:42] ytti: anyone know what is going on here? Where is that library even used? Why did someone bother owning rubygems to troyan it? And how did they own rubygems
[07:15:59] ytti: seems like a lot of bother for library i don't immediately see being particularly popular
[11:52:22] ytti: NL3limin4t0r did that
[11:53:51] ytti: no need to notice, there is like 5 sentence doc for it
[11:54:07] ytti: which says ' unique indices into the array in order to ensure that an element doesn't repeat itself unless the array already contained duplicate elements.
[11:54:38] ytti: 14:26 < NL3limin4t0r> &>> [*1...50].sample(6)
[11:54:39] ytti: 14:26 < rubydoc> # => [13, 44, 7, 41, 24, 2] (
[11:54:44] ytti: how is this not doing what you ask?
[11:55:13] ytti: ok, then i misunderstood your 'still ..'
[11:56:04] ytti: ACTION blinks
[11:56:12] ytti: what is happening here
[11:56:52] ytti: perhaps i did acid but forgot
[11:57:45] ytti: i'm gonna be honest with you Bish, i have no idea what you need :/
[11:57:57] ytti: maybe input and desired possible output would help
[11:59:41] ytti: i still have no idea what is going on, but *1..10].combination(6).to_a.sample
[12:00:01] ytti: yes, yes it is
[16:26:30] ytti: list comprehensions are so fugly
[16:27:34] ytti: many things in python obviously shout that it wasnt designed with coherent picture at mind
[16:27:39] ytti: OO stuff seems taped on
[16:27:56] ytti: randomly function(object) object.method, makes it php-esque, you just gotta know
[16:28:23] ytti: map/reduce are 2nd class citizens later added on by someone who missed them from proper languages
[16:28:45] ytti: build-in magic methods you just gotta know __getitem__, __sub__ ...
[16:29:00] ytti: very poor control on what is internal implementation and what is API
[16:29:20] ytti: and yet the general impression is that ruby is bit of a web toy language, while python is more grown up
[16:29:31] ytti: nothing could be further from the truth to anyone with cursory understanding of both languages
[16:30:24] ytti: alas $dayjob is full python
[16:31:11] ytti: of course terrific library overrides language argument
[16:31:18] ytti: and for many domains python libraries are much much better


[15:47:51] ytti: jesus h christ, imgur as pastebin, well at least the bot doesn't complain
[15:48:27] ytti: maybe there is bundle file there locking that file
[15:51:38] ytti: yeah i'm not too familiar either,and i think i'd just strace it to see what happens when i call the bundler
[15:52:03] ytti: but that may be the lazy man's approach, smarter man probably would try to understand instead of brute force


[18:10:43] ytti: {:first=>"moi", :second=>"hei"}
[18:10:43] ytti: [2] pry(main)> foo first: "moi", second: "hei"
[18:10:43] ytti: [1] pry(main)> def foo hash; pp hash; end
[18:10:46] ytti: => {:first=>"moi", :second=>"hei"}
[18:15:33] ytti: this keyword argument style can be done only for one hash
[18:15:39] ytti: rest would need to be passed like normal hash
[18:16:31] ytti: what i showed
[18:16:54] ytti: you may want to google 'ruby keyword argument'


[12:14:36] ytti: TvL2386, i like slop,
[12:15:04] ytti: TvL2386, but you're spoiled for choice with CLI option parsers
[12:15:18] ytti: TvL2386, so there very well may be much better onces which i've not reviewed
[12:16:56] ytti: slop4 is not indeed good for subcommands
[12:17:22] ytti: i've not had the same demand so i can't recommend one for subcommands, i'm sure you are still spoiled for choice
[12:17:40] ytti: TvL2386,
[12:18:01] ytti: can't help you much then it seems
[12:18:19] ytti: yeah, someone might, not me, sorry
[12:19:40] ytti: TvL2386, did you check cri, it seems to specifically mention subcommands and latest commit is under month old
[12:20:27] ytti: the subcommand support seems neat in 3min glance


[16:06:34] ytti: where exactly do you see it, do you have a link to a line in github
[16:07:08] ytti: in python that would be thing, but not in ruby
[16:08:52] ytti: bar ? foo : baz
[16:08:54] ytti: would be ruby equivalent
[16:09:43] ytti: it doesn't do what you asked tho
[16:09:55] ytti: it has two conditions, your ask has true and false branch
[16:10:08] ytti: if both conditinos are true it returns true
[16:10:24] ytti: that is really odd awkard code tho
[16:11:51] ytti: the code is
[16:11:54] ytti: def method
[16:12:02] ytti: it's not else on the return line
[16:12:37] ytti: it's no-op in that code
[16:12:58] ytti: it could be removed with no change to code
[16:13:25] ytti: it only make sense in context of rescue
[16:13:27] ytti: def method
[16:13:32] ytti: rescue some_Error
[16:13:38] ytti: we didnt need rescue
[16:16:44] ytti: there are, unfortunately, many thing in that short piece of code which communicates that person isn't particularly familiar with ruby


[11:10:42] ytti: foo.to_xml(options) { &block }
[11:10:43] ytti: if that helps
[11:19:14] ytti: 14:11 < IGnorAND> do you mean foo.to_xml(options, &block)?
[11:19:30] ytti: no i mean if i were to write foo.to_xml(options) { some_code }
[11:19:35] ytti: &block would be that some_code
[11:21:37] ytti: IGnorAND, i don't know
[11:23:13] ytti: yes, i've never considered why the sigil is &
[11:23:24] ytti: but of course you need some way to communicate it's not second argument method expects
[11:23:53] ytti: i cannot answer about the motivations nor name behind &, it never seemed important to me, as it was always 'its gotta be something, and it's not important to me what it is'
[11:24:02] ytti: so unfortunately i cannot help you
[11:26:52] ytti: IGnorAND, you can pass it like normal variable
[11:27:01] ytti: IGnorAND, it is essentially a proc
[11:27:06] ytti: IGnorAND, you can it
[11:27:09] ytti: IGnorAND, say i have
[11:27:23] ytti: def foo(arg, &mahblock)
[11:27:31] ytti:
[11:27:38] ytti: callerdoes
[11:27:47] ytti: foo(args) { some_code_here }
[11:27:58] ytti: some_code_here is executed when the block is called
[11:28:15] ytti: and yes, i've done such signatures
[11:28:21] ytti: it's very much idiomatic ruby
[11:28:30] ytti: yes just pass it
[11:28:41] ytti: it's just variable ultimately, variable which contains a proc
[11:28:57] ytti: if you pass it, you just pass it as block
[11:29:00] ytti: not &block
[11:29:09] ytti: &block syntax is just for receiving the actual block
[11:29:26] ytti: once it is received in a variable, it's just a proc you can do what ever
[11:31:26] ytti: now you_do_the_work can call it or pass it