RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.26.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
DTZUZO has joined #crystal-lang
francisl has joined #crystal-lang
wontruefree has quit [Quit: bye]
jokke1 has quit [Ping timeout: 252 seconds]
jokke1 has joined #crystal-lang
jokke1 has quit [Ping timeout: 252 seconds]
jokke1 has joined #crystal-lang
francisl has quit [Quit: francisl]
moei has quit [Ping timeout: 252 seconds]
francisl has joined #crystal-lang
francisl has quit [Quit: francisl]
francisl has joined #crystal-lang
<FromGitter> <Blacksmoke16> is there a way to pretty format numbers
<FromGitter> <Blacksmoke16> like add commas?
francisl has quit [Quit: francisl]
<FromGitter> <drosehn> Hmm. I have a cute trick-regex which adds commas in ruby, but it doesn't seem to work in crystal, and I'm not sure why. I'll try a few more experiments.
<FromGitter> <drosehn> I'm too tired to figure this out right now, but...
moei has joined #crystal-lang
<FromGitter> <drosehn> ```"9123456789".gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/) { "#{$1},#{$2}" }```
<FromGitter> <drosehn> that works in ruby to give you "9,123,456,789". If you get rid of the `#{$2}`, it will work in crystal to add *one* comma, but if you include the `#{$2}` it will error out.
<FromGitter> <drosehn> The thing is, I'd have to look up regex's to remember what that pattern is doing. 😃
<FromGitter> <drosehn> I asked the same question you did on a ruby-lang mailing list maybe 12-13 years ago, and someone replied almost immediately with the above pattern. I've used it ever since then, but I never looked up what it does.
<FromGitter> <Blacksmoke16> :p
<FromGitter> <Blacksmoke16> bit easier to use :p
<FromGitter> <drosehn> Well, I got that pattern before rails was much of "a thing"...
<FromGitter> <Timbus> Newer printf has that format builtin, crystal doesn't seem to support it though
<FromGitter> <Timbus> bummer
<FromGitter> <Blacksmoke16> yea :/
<FromGitter> <drosehn> and the way I use it, it's very trivial to use.
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <Timbus> Just add it and make a pr ?
<FromGitter> <drosehn> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b9c8cd58909f71f75d7180a]
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/4zy1 this seems to work
<FromGitter> <drosehn> and then just: `someNum.to_comma3sep_s`
<FromGitter> <drosehn> Indeed. Showing that you're in much better shape than I am right now!
<FromGitter> <drosehn> ... I'll have to save that away. Thanks. 😄
<FromGitter> <Blacksmoke16> np, just googled how to do it in JS and that seemed to do the trick ;)
<FromGitter> <codenoid> hi @drosehn , long time no c
_whitelogger has joined #crystal-lang
lvmbdv has joined #crystal-lang
<FromGitter> <codenoid> https://github.com/Muonyet/lazy-mongo <3
ashirase has quit [Ping timeout: 252 seconds]
ashirase has joined #crystal-lang
Yxhuvud has quit [Remote host closed the connection]
<FromGitter> <r00ster91> Is there a reason why there's this "sharp" flag in the String::Formatter when it doesn't do anything? https://github.com/crystal-lang/crystal/blob/master/src/string/formatter.cr#L95
Yxhuvud has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <proyb6> How do I parse only "csv_file" and not the whole form data which others will produce nil ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b9cf31ea56b215c97400110]
<FromGitter> <vladfaust> Should I write `at compile time` or `at compilation time`? And should I use hyphen, e.g. `at compile-time`?
<FromGitter> <r00ster91> I'd take the latter
<FromGitter> <bew> @r00ster91 what do you mean "it doesn't do anything"?
<FromGitter> <r00ster91> @bew when I put the `#` in my sprintf format string, it's the same as when I don't put it in ⏎ ⏎ ```sprintf "%#X", -123 # => "-7B" ⏎ sprintf "%X", -123 # => "-7B"``` ⏎ ⏎ so it looks like its useless. So why is it there? is there a reason [https://gitter.im/crystal-lang/crystal?at=5b9cf88ff7e1580625d51839]
<FromGitter> <drum445> Hello, when setting a key or iv for ```OpenSSL::Cipher.new("aes-256-cbc")``` am I right in thinking that if the length of either of those is greater than it needs it simply trims it?
<FromGitter> <drum445> As the error is only raised for too short, not too long
lvmbdv has quit [Quit: WeeChat 2.2]
<FromGitter> <robacarp> @vladfaust
<FromGitter> <robacarp> Both are correct, but the first is more common. No hyphen needed
<FromGitter> <vladfaust> Thanks
<FromGitter> <drum445> Can't see a trim in the code, so would be interested to know please
<FromGitter> <vladfaust> Can I specify crystal master branch in `.travis.yml`?
<oprypin> vladfaust, you can do whatever you want, that field doesnt do anything
<oprypin> sorry, i was thinking about shard.yml
<oprypin> don't know about travis.yml
<FromGitter> <vladfaust> Awesome, thanks, @oprypin
DTZUZU has quit [Quit: WeeChat 1.9]
<FromGitter> <bew> @r00ster91 man printf
<FromGitter> <r00ster91> @bew `man sprintf` was the correct page. thanks
<FromGitter> <bew> Well the flag description is in man printf too :p
<FromGitter> <vladfaust> I get `Unable to locate package crystal-nightly` on Travis. See https://travis-ci.org/vladfaust/core/jobs/429016300, please
<FromGitter> <vladfaust> Check it out (tldr: type-safe ORM): https://github.com/vladfaust/core/releases/tag/v0.5.0-alpha.1
<FromGitter> <vladfaust> @bcardiff ping 'bout Travis issue above
<FromGitter> <nulty> Can anyone point me to an good resource/tutorial for explaining Slice please?
<FromGitter> <cfsamson> @vladfaust wow, looks nice!
<FromGitter> <drum445> Hello, how can I load json from a file and convert it to a hash?
<FromGitter> <r00ster91> @drum445 ⏎ ⏎ ```Hash.from_json(File.read("file.json"))``` [https://gitter.im/crystal-lang/crystal?at=5b9d3c83be4f3006269b3b7c]
<FromGitter> <cfsamson> @nulty Sorry, nothing besides the api docs as far as i know, or you can ask here or SO if you have any questions (I've usually seen questions usually have gotten a reply really fast on SO for exemple)
<FromGitter> <drum445> cheers @r00ster91
<FromGitter> <nulty> I'm looking at IO and how it uses Slices, that's informative. Not got the full picture yet though. It's not something I've had to deal with in interpreted languages so I'm just getting to grips with it.
<oprypin> nulty, what languages have you worked with
<FromGitter> <nulty> Ruby mostly
<FromGitter> <nulty> Javascript, a little Elixir,
<FromGitter> <cfsamson> @nulty I learned about slices just using them, and combining them with what i know about slices in Rust (which have a really good explanation if you can see beyond the rust spesific syntax). If you see here https://doc.rust-lang.org/book/second-edition/ch04-03-slices.html and scroll down to the String Slices section it's atleast something. Crystal slices are not that different...
<FromGitter> <nulty> @cfsamson Thanks for the link, I'll read it now. Looks like a helpful resource.
<FromGitter> <cfsamson> Well it's atleast something :)
sevensidedmarble has joined #crystal-lang
<FromGitter> <drosehn> hi @codenoid -- I'm still checking in here pretty frequently (like, at least once per day), but I'm busy at work so I haven't been saying as much.
thews has quit [Ping timeout: 252 seconds]
thews has joined #crystal-lang