RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <j8r> There are already plenty in JS
tsundsted has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 252 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #crystal-lang
tsundsted has quit [Ping timeout: 256 seconds]
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
<FromGitter> <HarrisonB> Anything equivalent to `Array#pack` from Ruby?
return0e has joined #crystal-lang
return0e_ has quit [Ping timeout: 264 seconds]
<oprypin> just letting u know i skipped the last question cuz im not gonna go to find out what Array#pack does in ruby
<jokke1> hi there o/
jokke1 is now known as jokke
<jokke> i'm working on an ACME client for crystal and i was wondering how i can create asymmetric keys using the stdlib
<jokke> OpenSSL seems to only support tls and digests
ashirase has quit [Ping timeout: 250 seconds]
ashirase has joined #crystal-lang
Yxhuvud has joined #crystal-lang
<jokke> hm ok so far i've found the shard "cox"
<jokke> but i still have no idea how to extract the required info for JWK from the public key
<FromGitter> <TheOnlyArtz> Did someone try to use Lucky?
tsundsted has joined #crystal-lang
<FromGitter> <TheOnlyArtz> How can I log through the STDIO and read it with IO.pipe?
Jenz has joined #crystal-lang
<FromGitter> <bew> First read it, then output to stdout what you want (and do something else with it)
<FromGitter> <malkomalko> Is there a nice memoize pattern that y'all have been using? I've been using two extra ivar's but I'm not in love with it
<FromGitter> <malkomalko> I would traditionally use `instance_variable_defined?` via ruby
<FromGitter> <Blacksmoke16> would be fairly easy to add that
lucasb has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6o0t
* Jenz :)
<FromGitter> <Blacksmoke16> :slight_smile:
<FromGitter> <asterite> Robert Malko there is, check some object macros like property or getter with a block. They do ||= or similar
<Jenz> No idea wha ary's talking about, but I see "`||=`" I'm a fan of the lazy: `@foo ||= something`
<FromGitter> <j8r> @malkomalko there is the block variant of `getter` which does memoization: https://play.crystal-lang.org/#/r/6o1n
<FromGitter> <jackturnbull> Hi guys, thought I'd try over here instead of creating a forum post for this one... ⏎ ⏎ I've been benchmarking one of my more heavy controller methods and I'm over the moon with performance, but I'm not clear on what I should be expecting memory usage wise - or what's considered normal. `wrk` managed to run 105k POST request writing into Postgres over the space of 5 minutes but my memory usage went
<FromGitter> ... from a few meg to 300+ and now it has been sat there since.
<FromGitter> <jackturnbull> It is the case that I need to wait for a GC collection or something like that for the memory usage to fall again? Bit new to this sort of stuff
<FromGitter> <jackturnbull> Concerned that it could be memory leak territory
<FromGitter> <faustinoaq> Hi @/all Crystal community! Thank you for all you support to keep Crystal awesome 😄 ⏎ ⏎ I apologize again for not being active on github, I've been busy with my new job 😅 ⏎ ⏎ I have some updates: ... [https://gitter.im/crystal-lang/crystal?at=5ca8ccda31aec969e860af8e]
Jenz has quit [Ping timeout: 250 seconds]
<FromGitter> <faustinoaq> Is interesting to see https://shards.rocks/ working on Kemal 0.7.0 and crystal 0.10.2 💪 @sdogruyol 👍
<FromGitter> <Blacksmoke16> @jackturnbull I remember reading something about this but let me see if i can find it
<FromGitter> <Blacksmoke16> https://github.com/crystal-lang/crystal/issues/3997 maybe something in here about it
<RX14> oh wow the Path PR was merged
BaldEagleX02 has left #crystal-lang ["Textual IRC Client: www.textualapp.com"]
<FromGitter> <jackturnbull> @Blacksmoke16 I've found this github issue but I'm just trying to digest it: https://github.com/crystal-lang/crystal/issues/3997 the more pressing question is whether my allocated heap memory is *actually* being used or whether it's just allocated because I have free memory available on my system
<FromGitter> <jackturnbull> Oh sorry missed you'd posted it! Yeah reading it now :)
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <malkomalko> Thank you all on the helpful tidbits for the memoize stuff. I had no idea getter took an optional block to memoize, that's amazing! A general question on the first option. All macros are compile time right? So for anything happening at runtime, something like https://play.crystal-lang.org/#/r/6o0t wouldn't work? I was just reading over the macros docs.
<FromGitter> <Blacksmoke16> that is happening at runtime
<FromGitter> <Blacksmoke16> just the array of ivars for `@type` is at compile time
<FromGitter> <Blacksmoke16> `{{@type.instance_vars.map(&.name.stringify)}}`
<FromGitter> <Blacksmoke16> in the case of `Fred` that would be the same thing as doing like
<FromGitter> <Blacksmoke16> ``` def instance_variable_defined?(name : String) ⏎ {"a", "b"}.includes? name ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5ca8da41759abc043c78b591]
<FromGitter> <Blacksmoke16> but since its defined on `Object` any class would have it, with that specific class' ivars
<FromGitter> <malkomalko> ah hah, makes total sense
<FromGitter> <malkomalko> Also loving picking up https://crystal-lang.org/api/0.27.2/Object.html#getter(*names,&block)-macro to learn about the getter block tip. That's definitely going into my grab bag of tricks.
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6o2p this version might be a bit more performant, uses a tuple instead of array
<FromGitter> <Blacksmoke16> yea
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ca8db91f851ee043d71652d]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5ca8db98a84e0c501ae82230]
<FromGitter> <malkomalko> Tuple option it is! :D
<FromGitter> <Blacksmoke16> im suprised its that big of a diff tho, something else must be going on
rohitpaulk has joined #crystal-lang
<FromGitter> <vladfaust> How to get array of hash values from array of keys? `hash.values_at` works with tuple only
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6o31 ?
<FromGitter> <vladfaust> Yeah, I meant if there is a built-in method which I can't see
<FromGitter> <vladfaust> Well, thanks, this works
rohitpaulk has quit [Remote host closed the connection]
lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter> <Blacksmoke16> but we're now testing all compile time errors
<FromGitter> <Blacksmoke16> er @z64 sorry
hightower2 has joined #crystal-lang
Jenz has joined #crystal-lang
<Jenz> I'm jealous of Julia's documentation...
<Jenz> I guess Julia's just a much more mature programming language
<FromGitter> <bajro17> Hello
<FromGitter> <r00ster91> yeah they are already 1.0
<FromGitter> <bajro17> I have problem with YAML
<FromGitter> <bajro17> is it possible to do each in YAML
<FromGitter> <Blacksmoke16> got an example?
<Jenz> @bajro17: https://carc.in/#/r/6o4y
_whitelogger has joined #crystal-lang
<FromGitter> <bajro17> I cant make this work I try already 3 hours
<FromGitter> <bajro17> https://carc.in/#/r/6o55
<FromGitter> <bajro17> :(
<FromGitter> <Blacksmoke16> whoa
<FromGitter> <Blacksmoke16> what is the goal here?
<FromGitter> <bajro17> I need it for some calculation
<FromGitter> <Blacksmoke16> yea but what is the output you're expecting? Does the hash have to be used?
<FromGitter> <r00ster91> He wants to set `config["params"][name]` to `value` however the type sometimes doesn't match: https://carc.in/#/r/6o5t
<FromGitter> <Blacksmoke16> yea this is why hashes are a pita
<FromGitter> <bajro17> I try with yaml no success :(
<FromGitter> <Blacksmoke16> yaml would be easier
<FromGitter> <Blacksmoke16> or json even
<FromGitter> <Blacksmoke16> can you make a playground link with either of those?
<FromGitter> <bajro17> ok I will now
<FromGitter> <bajro17> https://carc.in/#/r/6o60
<FromGitter> <bajro17> but still dont know how to do initialize
<FromGitter> <Blacksmoke16> yea so where you're going wrong is using `YAML.parse`
<FromGitter> <Blacksmoke16> check this out
<FromGitter> <bajro17> I try convert this to crystal
<FromGitter> <Blacksmoke16> are all these keys different?
<FromGitter> <Blacksmoke16> like some can be int32, others floats, other string?
<FromGitter> <Blacksmoke16> https://carc.in/#/r/6o6m
<FromGitter> <Blacksmoke16> see if thats easier to work with
<FromGitter> <Blacksmoke16> bbiaf dinner
Jenz has quit [Ping timeout: 246 seconds]
moei has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 264 seconds]
<FromGitter> <Blacksmoke16> bk
_whitelogger has joined #crystal-lang
hightower2 has quit [Ping timeout: 240 seconds]
<FromGitter> <Blacksmoke16> did that help any @bajro17 ?
<FromGitter> <bajro17> no it dont
<FromGitter> <bajro17> I start all from scratch
<FromGitter> <bajro17> It will be good for learning
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <bajro17> Thank you anyway :)
<FromGitter> <Blacksmoke16> np