Activity Graph

Page 1 of 1


[19:37:46] z64: has joined #ruby


[18:58:48] z64: hey all - i'm having some trouble making a simple pure ruby native extension. i have looked at docs and some example repos, and have `ext/mkrf_conf.rb` added to `s.extensions` & `s.files` but it does not seem to be executing
[19:01:10] z64: the `mkrf_conf.rb` is suppoed to install some dependencies after doing some environment checks. nothing gets installed with `bundle install`, or even something like a `puts` is not displayed
[19:44:19] z64: ah nevermind i think.. it just isn't installed when running from within the gem repo itself. creating a quick dummy project with a Gemfile, bundle install builds the extension. maybe i just need to add running the ext/mkrf_conf.rb script to our dev rakefile then?
[22:09:15] z64: Ping timeout: 268 seconds


[13:10:50] z64: has joined #ruby


[21:11:57] z64: Ping timeout: 250 seconds


[18:25:51] z64: t0th_-: wild guess, but maybe you aren't using bundler to run your project? you either have to `require "bundler/setup"`, or `$ bundle exec ruby main.rb` (or whatever your main file is named)


[12:53:31] z64: marz_d`ghostman: the receiver of methods defined with module_function is the class; `expect(MyClass).to receive(foo)` would expect that `MyClass.foo` is called
[12:53:49] z64: *`receive(:foo)`


[15:14:18] z64: this is really stumping me. rubocop is claiming that `Bar` in `module Foo::Bar` is missing a top level docs comment in a specific file (`Bar` spans multiple files). However, YARD renders just fine, and we do exactly this with other modules and it does not trigger a warning..


[02:42:51] z64: *.net *.split
[14:14:52] z64: has joined #ruby


[17:36:07] z64: it's a yikes from me
[18:03:52] z64: oh dear.


[18:40:22] z64: yeah. i would be inclined to argue that should be named more explicitly
[18:44:12] z64: i mean you can very well do `klass = Foo`, `klass.new #=> <Foo ..>`. does it actually return a new instance of T?
[18:44:53] z64: i.e. some sort of custom .dup?
[18:46:23] z64: yeah i get you. i'm just curious about the code in question
[18:46:32] z64: like, what does this #new actually do
[18:48:05] z64: my point of `klass = Foo` is that you could write code that might look like its an instance method, so i think its a reason for a double-take for sure


[15:32:35] z64: twitter IDs are uint64
[15:35:28] z64: a twitter ID would not be bigger than 18446744073709551615, though maybe one day it will be uint128
[15:35:58] z64: (i don't know how uint128 is supported in ruby)
[15:36:16] z64: for now it is a uint64 with encoded metadata
[15:36:21] z64: Time.at(((999729751781724165 >> 22) + epoch) / 1000.0)
[15:36:22] z64: => 2018-05-24 19:12:01 +0000
[15:37:11] z64: arup_r: yes i wouldn't worry about it
[15:37:19] z64: you can google "twitter snowflake" for more information
[15:37:46] z64: the function i displayed above ^ prints the embedded timestamp of whenever that resource was created
[15:38:05] z64: with the epoch = 1288834974657
[16:07:27] z64: havenwood: you can, but i think that has edge cases in snowflake
[17:36:31] z64: `raise("foo")` instead


[13:19:04] z64: "#{num_apples.round(2)}"?
[13:21:11] z64: think thats the best you'll get unless you just assign (or re-assign) another variable and interpolate that new rounded variable instead


[00:07:18] z64: *.net *.split
[00:15:50] z64: has joined #ruby


[17:12:37] z64: omitting arguments is done by giving args default values, i.e. `def foo(arg = nil)` can be called as `foo` or `foo(something)`
[17:13:43] z64: splatting an argument (*arg, **arg) works as well if you want variadic args
[17:15:55] z64: sure. definitely think about it in each situation; sometimes a more explicit, differently named method is preferred. for your use case that sounds fine


[18:33:02] z64: kwaaaaaaarg! :D


[15:08:39] z64: cdunklau: i would recommend "learn ruby the hard way" (though mind the dated style choices). if you find that a bit dull, you might try why's poignant guide. ultimately depends on your background / how you learn
[15:24:53] z64: if you're new to ruby style, look at the
[15:25:00] z64: *ruby style guide
[15:25:21] z64: and if you want, use rubocop and research the code it flags and why


[12:58:51] z64: i get `1` on 2.5.0
[13:01:44] z64: i also get `1` on 2.3.1
[13:02:53] z64: gonna say that i dont think you're operating on the data you think you are
[13:04:43] z64: bout all i can say without more information. seems to be working fine


[13:27:08] z64: beefjoe70: if you just have an opaque string, you need to parse that into a ruby object you can traverse first. you likely want to `require 'json'` and then pass that string to `JSON.parse` so you can access the data as a hash
[16:02:11] z64: +1 to crystal :)
[19:19:01] z64: is a lockfile not suitable?
[19:20:27] z64: FWIW, you can generate a lockfile or print it to STDOUT with `bundle lock` (see --help)
[19:20:50] z64: (bundle lock wont actually install the gems)


[02:47:06] z64: *.net *.split
[02:47:56] z64: has joined #ruby


[10:01:18] z64: *.net *.split
[10:08:10] z64: has joined #ruby


[11:38:47] z64: is there a convention in ruby for distinguishing if i want to provide blocking/nonblocking options for the same behavior? should i accept a boolean arg or maybe provide `foo` and `foo!`?
[11:50:05] z64: yeah for sure. do you think `foo!` ("bang for blocking") is too implicit? maybe `foo_sync`..
[15:37:01] z64: yes, you need to export/transer/import. you apps (at least non-static) data should not be on github
[15:37:46] z64: *transfer
[16:28:06] z64: idontknowanythin: https://stackoverflow.com/questions/8390256/a-json-text-must-at-least-contain-two-octets
[16:29:50] z64: and? it explains exactly what the error means
[16:30:31] z64: it means this line: `JSON.parse(`sudo /usr/local/openvpn_as/scripts/sacli VPNSummary`)`, JSON.parse is being passed an empty string
[16:32:01] z64: i have no idea what it is, so i can't tell you why its returning an empty string
[18:23:46] z64: thats not printing to STDERR is it? `foo` will only capture things flushed to STDOUT
[18:25:39] z64: do this: go to your terminal and run "irb", then run your sudo command
[18:35:04] z64: idontknowanythin: at your terminal, type irb. you should get a prompt. right?
[20:00:44] z64: idontknowanythin: you enter ruby code at that prompt. enter your sudo command in backticks (`) exactly as you had it in your script
[20:02:00] z64: it will show you that its getting an empty string back


[18:56:22] z64: heya dminuoso. if i've been following right, you've been getting into haskell yeah? would you have any sage words for a rubyists approach to haskell? i understand its best to take a blank canvas to it, i'm just struggling to find it as engaging to dive into as ruby was.
[19:28:42] z64: dminuoso: i've been picking it up/down for maybe a year. its been a bucket list thing for longer. i've always been more of a static typing / compiled lang guy, so haskells world of purity / type safety is super intriguing
[19:31:26] z64: i feel like what i need is like to take a class or something. i always wind up with way too many questions when i dive in than would be reasonable to dump onto someone for free.. lmao
[19:33:52] z64: yeah i think thats the thing really. i need something practical to *do* with it beyond academic exercises, and its tough finding something when i could immediately do it in another lang i already know
[19:37:17] z64: dminuoso: compile time safety and strong typing is super valuable to me, in the kinds of bugs it eliminates from runtime entirely. and haskell seems to accomplish it in such a detailed, frighteningly interesting way lol.
[19:38:04] z64: it just seems like a tool i would exercise a lot, if i could grasp it :) lol
[19:48:50] z64: dminuoso: yeah, i totally get that:) i tried cis194 a long time ago, i'll have to revisit it with gusto. and yeah, thats another reason why i was interested, from stories like those that i've heard ^^
[19:56:26] z64: right, exactly. hard to leave those "at the door", haha
[20:01:12] z64: well, i gotta fly. thanks for the words guys :)! have a good one


[19:00:27] z64: 'foo' and "foo" are string literals with the same exact value
[19:01:42] z64: cagomez: https://carc.in/#/r/3zez
[19:02:45] z64: there must be something else going on if you're getting different results, i.e. the hash is changing since you accessed it last
[19:23:48] z64: havenwood: ...??
[19:25:04] z64: i have no idea what you're talking about. you know it was cagomez asking about this right?
[19:25:44] z64: no problem lmao


[13:12:55] z64: Quit: WeeChat 2.0.1
[13:14:30] z64: has joined #ruby


[12:26:00] z64: *.net *.split
[12:27:23] z64: has joined #ruby
[15:01:31] z64: *.net *.split
[15:03:14] z64: has joined #ruby


[10:15:58] z64: *.net *.split
[10:22:41] z64: has joined #ruby


[23:31:40] z64: Ping timeout: 276 seconds


[12:44:38] z64: send bypasses protection; it can be used to call private methods on a class
[12:45:00] z64: that is one use
[12:45:33] z64: its used often in metaprogramming concepts in ruby
[12:45:52] z64: where some other code might generate the name of the method to be called
[12:46:52] z64: you can get pretty creative with it. it can also cause some nasty bugs if you're not careful. no problem


[15:18:47] z64: has joined #ruby


[22:57:34] z64: Quit: WeeChat 1.9.1


[02:29:00] z64: has joined #ruby


[16:44:28] z64: has joined #ruby


[14:04:11] z64: Quit: WeeChat 1.9


[13:15:42] z64: has joined #ruby


[16:00:20] z64: Quit: WeeChat 1.8


[02:44:13] z64: Ping timeout: 260 seconds
[02:44:30] z64: has joined #ruby
[02:57:04] z64: Ping timeout: 255 seconds
[03:00:01] z64: has joined #ruby


[02:34:35] z64: Ping timeout: 240 seconds
[02:43:30] z64: has joined #ruby


[00:17:34] z64: *.net *.split
[00:23:01] z64: has joined #ruby


[15:34:35] z64: Ping timeout: 240 seconds
[15:43:54] z64: has joined #ruby


[16:58:42] z64: has joined #ruby


[20:00:37] z64: Quit: WeeChat 1.7


[11:45:46] z64: hey all. curious if anyone here happens to have experience using a similar toolchain to my project; nobrainer(rethinkdb), sinatra, and haml. been having some strange issues
[11:47:10] z64: essentially: we can inspect model instances fine via pry, however if we use the same model query inside of a controller to render into our view the object is corrupt
[11:49:02] z64: in fact, not only the model, but queries about the table return incorrect information as well, like getting Model.count


[12:04:48] z64: has joined #ruby


[14:11:02] z64: Quit: WeeChat 1.6


[21:37:48] z64: i mean.. can read the file split into lines and then eval it
[21:38:05] z64: if theres something to do that already, i dunno