ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.22.0 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
saadq has quit [Ping timeout: 255 seconds]
saadq has joined #crystal-lang
Philpax has joined #crystal-lang
danielpclark has quit [Quit: Leaving]
onionhammer1 has joined #crystal-lang
hako__ has quit [Read error: Connection reset by peer]
_whitelogger has joined #crystal-lang
gewo has joined #crystal-lang
_whitelogger has joined #crystal-lang
splitty___ has quit [Ping timeout: 276 seconds]
flaviodesousa has joined #crystal-lang
rohitpaulk has joined #crystal-lang
panderssen has joined #crystal-lang
<panderssen> would someone be able to tell me how to convert milliseconds to Time?
<panderssen> Time.new, Time.parse don't do this, ts.milliseconds returns Time::Span instead of Time, ...
<FromGitter> <bew> You can use `Time.new(0, 0, 0, ms)` (giving 0 to hours, minutes & seconds)
<panderssen> let me try that
<panderssen> (already tried Time.new(0,0,0,0,0,0,ms)
<FromGitter> <bew> hmm yeah doesn't seems to work
<panderssen> "Invalid time"
<panderssen> couldn't find in crystal docs, so also tried searching for the solution in ruby but it's not the same
<panderssen> int.milliseconds returns Time::Span; maybe i can add that to Time.new(0,0,0,0,0,0)
<panderssen> if i had ever used ruby maybe i could think of a way but i am stuck at the moment
<FromGitter> <bew> maybe use `Time.epoch_ms`
<panderssen> that is time to timestamp, unless it's also a setter
<FromGitter> <bew> no it's a class method, that allows you to create atime from a milliseconds from epoch
<FromGitter> <bew> `Time.epoch_ms 1498121462868` => `2017-06-22 08:51:02 UTC`
<panderssen> ah ok let me try
<panderssen> yep, works, thank you
<panderssen> i found it in the docs, okay now i've learned something
<FromGitter> <bew> yw ;)
<panderssen> do you happen to know, can the full docs be downloaded or is there some other way to do full-text search of all docs?
<Papierkorb> panderssen: clone the crystal sources, and run `crystal docs` in the project root
<FromGitter> <bew> I just searched in the docs, I don't know everything unfortunatly ^^ No there is no easy way to search anything in the docs
<panderssen> for auto-generated docs they are pretty good, but hopefully method descriptions/comments will catch up
<panderssen> is there a good IDE plugin for autocompletion? that's a good way to discover methods
<FromGitter> <akzhan> you may https://play.crystal-lang.org/#/r/28ic
<FromGitter> <faustinoaq> panderssen See https://github.com/TechMagister/cracker
<panderssen> they don't seem to return the same thing, but in any case the answer was simply `Time.epoch_ms(ts_in_msec)`
<FromGitter> <faustinoaq> Also https://github.com/kofno/scry is good, I'm working in a PR to support Crystal 0.22.0
<FromGitter> <akzhan> forgot to multiply by Time::Span:: TicksPerMillisecond = 10_000_i64
<panderssen> cracker looks good, i use sublime text as well so that's perfect, thank you
<FromGitter> <faustinoaq> https://github.com/kofno/scry is useful to bring support to all editors via http://langserver.org/
<FromGitter> <straight-shoota> panderssen, there is an open issue to add full-text search to the doc generator: #1792
<DeBot> https://github.com/crystal-lang/crystal/issues/1792 ([API doc browser] Method index/search)
<panderssen> yay!
<FromGitter> <straight-shoota> or actually, it doesn't necessarily need to be full-text search. an index of all method and constant names would already be great
<panderssen> true
<panderssen> well and argument types?
<FromGitter> <akzhan> The scry has not been updated for a long time.
<panderssen> how to find methods which take a certain argument type that is, maybe this is not really a good feature for doc search
rohitpaulk has quit [Ping timeout: 268 seconds]
<FromGitter> <faustinoaq> @akzhan yes, I'm working in a PR to update to 0.22.0
<FromGitter> <LuckyChicken91_twitter> how can I make an Array(String) to an Array?
<FromGitter> <fridgerator> AFAIK Array has to have a type
flaviodesousa has quit [Ping timeout: 240 seconds]
<FromGitter> <akzhan> @LuckyChicken91_twitter array of what?
<FromGitter> <LuckyChicken91_twitter> wait
<FromGitter> <LuckyChicken91_twitter> i will write a better question on carc.in
rohitpaulk has joined #crystal-lang
<FromGitter> <akzhan> anyway you can something like [1, 2, 3, 4].map(&.to_s)
<FromGitter> <LuckyChicken91_twitter> my question have to do with colorized strings.. this is a bit stranger
<FromGitter> <LuckyChicken91_twitter> https://carc.in/#/r/28k0/edit
<FromGitter> <LuckyChicken91_twitter> this is my question
<FromGitter> <LuckyChicken91_twitter> i think this is better to understand
<FromGitter> <akzhan> https://carc.in/#/r/28k3
<FromGitter> <LuckyChicken91_twitter> should i do myLoadedArrayWithColorizedStrings.map(&.to_s).map(&.colorize(:red)).map(&.to_s) ?
<FromGitter> <akzhan> Firstly You need to Colorize.enables = true
<FromGitter> <LuckyChicken91_twitter> okay
<FromGitter> <LuckyChicken91_twitter> but why is there &.colorize(:red) ? I have an array with different colorized strings..
<FromGitter> <akzhan> I did just an example. do anything with colorize, get colorized objects and stringify ‘em.
<FromGitter> <LuckyChicken91_twitter> idk how
<FromGitter> <akzhan> Hm. just seen your code. You need to create custom serializer/deserializer for Colorize::Object(T)
<FromGitter> <LuckyChicken91_twitter> im just loading an string out of an file
<FromGitter> <LuckyChicken91_twitter> and i want this string back again to an normal array
<FromGitter> <akzhan> Ok, understood. You need a parser for color codes ;)
<FromGitter> <LuckyChicken91_twitter> oh no. This must be really hard
<Papierkorb> LuckyChicken91_twitter, that doesn't look "really strange", that are the ansi escape sequences to produce the colors
<FromGitter> <LuckyChicken91_twitter> for me it looks really strange
<FromGitter> <akzhan> Ahaha 0))
<FromGitter> <LuckyChicken91_twitter> how can I write an parser for color codes??
<Papierkorb> for what?
<Papierkorb> if you want to allow the user to use them verbatim, nothing needs to be done.
<FromGitter> <LuckyChicken91_twitter> please read the chat progess then you understand
<Papierkorb> if you want to allow them to write something more readable, String#gsub
<FromGitter> <LuckyChicken91_twitter> i need to load an array with colorized strings from my file in my program!
<Papierkorb> colors are nothing special. they're ansi escape sequences, which are part of the string.
<Papierkorb> read up on them.
<FromGitter> <akzhan> Are you need to store strings with color codes?
<FromGitter> <akzhan> It’s easy to store Colorized Objects intead of strings.
<FromGitter> <akzhan> to restore ‘em later
<FromGitter> <LuckyChicken91_twitter> OK
<FromGitter> <LuckyChicken91_twitter> how
<FromGitter> <LuckyChicken91_twitter> just write the answers under the question here: https://carc.in/#/r/28k0/edit
<FromGitter> <fridgerator> you need to learn to fish
<FromGitter> <LuckyChicken91_twitter> fish?
<Papierkorb> or to pay someone
<FromGitter> <fridgerator> teach a man to fish.....
<FromGitter> <LuckyChicken91_twitter> what fish?!
<FromGitter> <LuckyChicken91_twitter> i know what a fish is
<FromGitter> <fridgerator> lol dont worry about it, i'm being silly
<FromGitter> <fridgerator> my suggestion is to experiment until you find something that works
<Papierkorb> fridgerator, that's one way to cope
<FromGitter> <LuckyChicken91_twitter> https://en.wikipedia.org/wiki/Fish
<FromGitter> <fridgerator> i'm a programmer and thats like 90% of my job
<FromGitter> <LuckyChicken91_twitter> i think there are more ways to save variables
<FromGitter> <LuckyChicken91_twitter> then just writing it to an file
Philpax has quit [Ping timeout: 268 seconds]
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <fridgerator> a database? redis?
<FromGitter> <LuckyChicken91_twitter> redis?
<FromGitter> <fridgerator> its an in-memory key value store
<FromGitter> <fridgerator> bummer, no ftp client for crystal :(
<FromGitter> <akzhan> here is a lot of missing shards yet :) by the way, you can port something like https://github.com/giampaolo/pyftpdlib
<FromGitter> <bew> this seams to be a nice FTP server library, a good *client* lib would be a good start imo
<FromGitter> <fridgerator> where did you find the server lib?
<FromGitter> <bew> @fridgerator you can add an issue here https://github.com/johnjansen/crystal-libraries-needed/ for the perennity of the request
<Papierkorb> Please with a use-case
<FromGitter> <bew> and/or link to good library worth looking for ideas
<FromGitter> <fridgerator> use-case for an ftp-client?
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
<oprypin> meh ftp client is so easy to write in an hour
<oprypin> especially if you have a narrow use case
rohitpaulk has quit [Ping timeout: 240 seconds]
<oprypin> a universal one is another thing
rohitpaulk has joined #crystal-lang
Renich has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
Renich has quit [Quit: Renich]
<FromGitter> <bew> Do I miss something? https://carc.in/#/r/28nd
<FromGitter> <bew> (trying to understand #4605)
<DeBot> https://github.com/crystal-lang/crystal/issues/4605 (Passing blocks around returning value)
<FromGitter> <bew> but it works with yield: https://carc.in/#/r/28ne
<FromGitter> <bew> Ok it seems that capturing a block is broken here... https://carc.in/#/r/28nf
<FromGitter> <bew> or do I always need to specify the types with captured blocks?
<FromGitter> <bew> (it works ok when I do
<Papierkorb> yes you need to in that case
<FromGitter> <bew> yeah just looked-up the docs, thanks
<Papierkorb> And OP in that issue thinks that blocks are blocking the process, which is not how it worksl
<FromGitter> <bew> not sure he meant that
<FromGitter> <bew> he was just saying that he get no result from a captured block (without type anotation)
go|dfish has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <straight-shoota> Does anyone know of a tool to automate generating and publishing api docs?
<oprypin> so like crystal doc and commit to gh-pages?
<oprypin> http://docrystal.org/ is ded
<FromGitter> <straight-shoota> Yes. I mean it is not that complicated...
<FromGitter> <straight-shoota> Oh, I didn't even think about a centralized documentation hub. But this would be also nice...
<FromGitter> <straight-shoota> I had more like a build script for CI in mind
<crystal-gh> [crystal] mverzilli closed pull request #4592: Parser: fix #4590, correct to parse empty parenthesis "()" (master...fix/crystal/4590-wrap-paren-nop) https://git.io/vHjy5
<oprypin> straight-shoota, i've tried pushing docs after every commit but it's too much noise
<oprypin> i'd recommend doing that on release
<FromGitter> <straight-shoota> yes, this should not run for every commit, of course
<oprypin> straight-shoota, for a manual solution https://gist.github.com/oprypin/88c2b5061ed356c9c2c0551a43be4003
<oprypin> for an automated solution feel free to dig through https://github.com/oprypin/crsfml/blob/03e7dbb8/.travis.yml#L16-L20 but this stuff is too specialized for my project
greengriminal has joined #crystal-lang
go|dfish has joined #crystal-lang
<FromGitter> <crisward> @straight-shoota We use gitlab internally, the the gitlab build script allows you to do a crystal docs them push the public folder to a live server. Works ok, though you'd have to use gitlab...
<FromGitter> <straight-shoota> Yes, I am using Gitlab for some projects. Their integrated CI is amazing! =)
<FromGitter> <straight-shoota> Though you should be able to do pretty much the same with Github and travis-ci
<FromGitter> <crisward> The bit of our gitlab.yml file looks like this... ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=594c0a887bf0f2951a2ce411]
_whitelogger has joined #crystal-lang
<FromGitter> <faustinoaq> Hi people! I improved my extension for crystal in VSCode, take a look :point_right: https://marketplace.visualstudio.com/items?itemName=faustinoaq.crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter> <mverzilli> nice! I use VSCode so thanks a lot for this :). I'll enjoy it!
<FromGitter> <straight-shoota> @oprypin @crisward This is what I've come up with: https://github.com/straight-shoota/crinja/blob/master/bin/autodeploy-docs.sh
<FromGitter> <straight-shoota> I tried to generalize as much as possible and it can be called locally as well as by CI
rohitpaulk has quit [Ping timeout: 240 seconds]
<oprypin> i'd add 2>/dev/null in addition to >/dev/null to every push command for good measure.
<oprypin> `==` is not a valid operator for `[`, `=` is
<FromGitter> <straight-shoota> Ah yes, it felt weird but works :D
<FromGitter> <straight-shoota> stderr might be useful if something goes wrong, wouldn't it?
<oprypin> i would not risk the push outputting anything because it spews full remote path with GH_TOKEN
<FromGitter> <straight-shoota> true
<FromGitter> <straight-shoota> I'll probably better switch to SSH key anyway
<oprypin> uhhh that's not a well explored approach
<FromGitter> <straight-shoota> it's tricky, yes
<FromGitter> <straight-shoota> It seems doable, though, but I'm still looking for better ways than putting an (encrypted) file with ssh key into the repo
<oprypin> i'd recommend sticking to the current approach
<FromGitter> <straight-shoota> Tokens are not ideal either... they have broad access rights
<oprypin> straight-shoota, i dont see how they have more access than a ssh key
<FromGitter> <akzhan> @faustinoaq oh, i have Crystal, Crystal IDE and Crystal Language plugins. What I need to remove)
<FromGitter> <akzhan> ami need to remove?)
<FromGitter> <straight-shoota> Deploy keys with write access only grant push privilege to a specific repository. A token is an identification for my user account. While the kinds of actions it legitimizes can be regulated, it can perform these actions on any repository that my account have access to.
<FromGitter> <akzhan> Btw, @mverzilli can you merge https://github.com/crystal-lang/crystal/pull/4571 ? it’s good for linters.
<FromGitter> <straight-shoota> This can be mitigated by a special user account for this specific purpose. Then a token for this account should mostly be similar to an ssh key in this respect.
panderssen has quit [Ping timeout: 260 seconds]
onionhammer1 has quit [Ping timeout: 260 seconds]
onionhammer1 has joined #crystal-lang
onionhammer1 has quit [Ping timeout: 268 seconds]
<FromGitter> <asterite> Hi everyone. I just wrote a Ruby code formatter similar to how the one in Crystal is done. It's also a bit configurable. https://github.com/asterite/rufo . Feedback is welcome :-)
hako has joined #crystal-lang
hako has quit [Read error: Connection reset by peer]
onionhammer1 has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
onionhammer1 has quit [Ping timeout: 268 seconds]
hightower3 has joined #crystal-lang
onionhammer1 has joined #crystal-lang
greengriminal has joined #crystal-lang
hightower4 has quit [Ping timeout: 246 seconds]
<FromGitter> <akzhan> Ripper based. Thanks, take a look
onionhammer1 has quit [Ping timeout: 260 seconds]
<FromGitter> <faustinoaq> @akzhan :sweat_smile: the 3 plugins do the same. Just pick one. I recommend you my plugin because formatting support and lightweight syntax checking using `crystal tool format --check -f json --no-color -`. Also my plugin use `crystal build --no-codegen` to check types and methods however this could be a bit heavy in some workspaces.
<FromGitter> <faustinoaq> @akzhan also is the only one with ECR support ⏎ ⏎ ((http://i.imgur.com/w9aBlIH.gif))
<FromGitter> <akzhan> thanks )
<crystal-gh> [crystal] MakeNowJust opened pull request #4609: String: implement Rabin-Karp algorithm for #byte_index (master...fix/string/byte-index-rabin-karp) https://git.io/vQqZk
onionhammer1 has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
hightower2 has joined #crystal-lang
<hightower2> Howdy fine sirs
<FromGitter> <markusvaikjarv> I'm new to this language and considering that I have had no exposure to Ruby, is Crystal's documentation good enough to learn this language?
<FromGitter> <faustinoaq> I never used Ruby before, just Python, Java and C and I learned A lot with Crystal :sweat_smile:
<FromGitter> <faustinoaq> For me syntax is not the main goal not even the performance but the Type inference and channel concurrency model.
<FromGitter> <markusvaikjarv> Sounds great, I guess I should give it a try
<FromGitter> <faustinoaq> and compiled binaries for easy distribution is another reason for me.
onionhammer1 has quit [Read error: No route to host]
cyberarm has quit [Ping timeout: 246 seconds]
onionhammer1 has joined #crystal-lang
cyberarm has joined #crystal-lang
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang