RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.25.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
akaiiro has quit [Ping timeout: 265 seconds]
greengriminal has quit [Quit: Leaving]
duane has quit [Ping timeout: 264 seconds]
zachk has quit [Quit: Leaving]
rocx has joined #crystal-lang
johndescs_ has joined #crystal-lang
johndescs has quit [Ping timeout: 240 seconds]
johndescs_ is now known as johndescs
akaiiro has joined #crystal-lang
wontruefree has quit [Quit: bye]
akaiiro has quit [Remote host closed the connection]
wontruefree has joined #crystal-lang
jokke has quit [Ping timeout: 268 seconds]
jokke has joined #crystal-lang
fifr has quit [Ping timeout: 248 seconds]
fifr has joined #crystal-lang
wontruefree has quit [Quit: bye]
alex`` has joined #crystal-lang
<FromGitter> <rishavs> Hi folks. is there a jwt creation/consumption module bundled with Crystal? Or should I use `crystal-community/jwt?`
<FromGitter> <bendietze_twitter> @straight-shoota thank you very much :) can you ping me here? I found no way on gitter android chrome to start chat and using the App on my phone is very laggy - even all of them don't upgrade the other one - a chat on my phone isn't viewable on laptop and so on. Gitter android app is hanging all the time, so i better stay with browser on mobile ;) i would like to talk to you (in german :P) šŸ‘
<crystal-gh> [crystal] sdogruyol closed pull request #5623: Implement File and Dir for win32 (master...feature/windows-file-dir) https://git.io/vN2Ua
<FromGitter> <bararchy> Boom! File\Folder for Windows merged
<FromGitter> <bararchy> šŸŽ‰
<FromGitter> <bararchy> RX14 nice work!
<FromGitter> <bendietze_twitter> @bararchy šŸ˜šŸ’ŖšŸŽ‰
<FromGitter> <bararchy> now @straight-shoota go work on the ENV XD
<FromGitter> <bendietze_twitter> RX14 šŸ’ŖšŸ’Ŗ
<FromGitter> <straight-shoota> @bendietze_twitter I sent you a private message. Did you receive it? Gitter works great on a desktop browser... =)
<FromGitter> <straight-shoota> @sdogruyol wasn't the merge a bit too fast?
lvmbdv has joined #crystal-lang
<FromGitter> <straight-shoota> before giving time for a final review?
<travis-ci> crystal-lang/crystal#b5ef578 (master - Implement File and Dir for win32 (#5623)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/400307689
<DeBot> https://github.com/crystal-lang/crystal/pull/5623 (Implement File and Dir for win32)
Raimondii has joined #crystal-lang
<FromGitter> <sdogruyol> @straight-shoota nope. it's fine
Raimondi has quit [Ping timeout: 264 seconds]
Raimondii is now known as Raimondi
<FromGitter> <bararchy> @straight-shoota I think it was reviewed by @bcardiff, @sdogruyol and @ysbaddaden , which means it's 1+ minimal need to review and merge
<FromGitter> <bararchy> btw is #6333 ready for review after RX14 latests requests?
<DeBot> https://github.com/crystal-lang/crystal/pull/6333 (Extract platform-specifics from ENV to Crystal::System::Env and implement for win32)
<FromGitter> <straight-shoota> I interpreted RX14's request for final reviews as a call to all who had previously reviewed it to take another look at it. And at least @bcardiff was obviously under the impression it wouldn't be merged soon (before Path type). But, I'm fine with it. Things can be changed later, anyway.
<FromGitter> <bcardiff> It was fine. I was 99% ready to merge (and I think that was clear in the PR). The missing 1% i double check it after merge, and šŸ‘ .
<FromGitter> <straight-shoota> All right. I was just surprised :D
<FromGitter> <straight-shoota> But it's great to see this merged šŸ‘
<FromGitter> <bararchy> Lets get `ENV` merged and we are in a great speed for Windows support :)
<FromGitter> <straight-shoota> `ENV` isn't that important, actually. Reading an environment variable was already implemented. It just adds reading all and setting which isn't used too much. But it was fairly easy to do. And will get us towards running the spec suite.
<FromGitter> <j8r> I see there is termios bindings, āŽ āŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b3dee5e63042f2df3582294]
<FromGitter> <j8r> Yes i think, don't see any TIOCGWINSZ
<FromGitter> <rishavs> Hi. I have a generic question about sending authorization headers from my webpage. Currently I store the jwt that the server generated, on the client in localstorage. On every page request, i can use JS to add the auth headers to my http request. But I was wondering if it is the normal way of sending them. Is there a native implementation in HTML itself which is recommended for this? Perhaps the html>head>meta>
<FromGitter> ... tags are used for this?
<FromGitter> <bararchy> Will `WebSocket.send` send the message before `run` is called?
lvmbdv has quit [Quit: Leaving.]
<FromGitter> <j8r> nvm for my question, I've just generated the bindings of `/usr/include/asm-generic/ioctls.h` with crystal-autobind
<FromGitter> <bararchy> cool :)
<FromGitter> <bararchy> I use crystal_lib for generating bindings
<FromGitter> <bararchy> What do you guys feel about adding timeout option for a websocket socket
<FromGitter> <bararchy> ?
<FromGitter> <sdogruyol> meh...
<FromGitter> <sdogruyol> I don't feel like it belongs to std
<FromGitter> <bararchy> WebSockets in general?
<FromGitter> <sdogruyol> timeout and keep-alive for websocket deserves a shard
<FromGitter> <j8r> there is https://github.com/alternatelabs/bifrost
<FromGitter> <Grabli66> I think i found a bug https://play.crystal-lang.org/#/r/4gep
<FromGitter> <straight-shoota> @Grabli66 there is already an issue for that
<FromGitter> <Grabli66> Good
<FromGitter> <rishavs> How would I set a cookie in my response? doing `context.response.cookies["Set-Cookie"] = HTTP::Cookie.new("foo", "bar", "/admin", Time.now + 12.hours, secure: true)` throws overload errors.
<FromGitter> <rishavs> Doing this works `context.response.headers["Set-Cookie"] = "foo=bar; HttpOnly"` but `context.response.headers["Set-Cookie"] = HTTP::Cookie.new("foo", "bar", "/admin", Time.now + 12.hours, secure: true)` fails. o.0
<FromGitter> <Blacksmoke16> are trying to set a cookie object to a header try calling `to_set_cookie_header` on it
<FromGitter> <Blacksmoke16> which will build the cookie string based on values in the Cookie obj
<crystal-gh> [crystal] veelenga closed pull request #6055: Useless assigns (master...fix/useless-assigns) https://git.io/vp2KJ
<FromGitter> <bararchy> @veelenga are you dropping ameba?
<crystal-gh> [crystal] laginha87 opened pull request #6336: Improve docs of big module overloads (master...laginha87-improve-big-docs) https://git.io/fbhC8
<FromGitter> <rishavs> @Blacksmoke16 thanks. will try out as soon as I start my pc
<FromGitter> <Blacksmoke16> šŸ‘
<FromGitter> <Blacksmoke16> @rishavs browser would send it along if you stored it in a cookie. But for localstorage, depending on what framework (if any) there are options
<FromGitter> <Blacksmoke16> Angular2+ for example has the concept of HTTP Interceptorshttps://medium.com/@ryanchenkie_40935/angular-authentication-using-the-http-client-and-http-interceptors-2f9d1540eb8 for this.
<FromGitter> <rishavs> currently, i am using no frontend frameworks. Pure js for now
<FromGitter> <Blacksmoke16> would have to add the header on each request
<FromGitter> <Blacksmoke16> so could like wrap the api call in a function that does it
<FromGitter> <rishavs> btw, I am not sure how to use to_set_cookie_header. āŽ āŽ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b3e2d03f1664406611c122d]
<FromGitter> <rishavs> this does nothing
<FromGitter> <Blacksmoke16> `context.response.headers["Set-Cookie"] = HTTP::Cookie.new("foo", "bar", "/admin", Time.now + 12.hours, secure: true). to_set_cookie_header`
<FromGitter> <Blacksmoke16> need to actually set the cookie response header
<FromGitter> <cserb> Hey guys, what's the best way to get a timestamp in crystal
<FromGitter> <Blacksmoke16> in any particular format?
<FromGitter> <cserb> Updated question
<FromGitter> <cserb> Similar to the linux timestamp
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.25.1/Time.html#epoch%28seconds%3AInt%29%3ATime-class-method
<FromGitter> <Blacksmoke16> er
<FromGitter> <rishavs> @Blacksmoke16 thanks! it works now
<FromGitter> <Blacksmoke16> `Time.utc_now.epoch`
<FromGitter> <Blacksmoke16> that would prob work
akaiiro has joined #crystal-lang
<FromGitter> <Blacksmoke16> or `Time.now.epoch` for local tz
<FromGitter> <cserb> @Blacksmoke16 it does thanks. So I was looking for this one: https://crystal-lang.org/api/0.25.1/Time.html#epoch%3AInt64-instance-method
<FromGitter> <Blacksmoke16> šŸ‘
<FromGitter> <rishavs> @Blacksmoke16 I think there is a bug in cookie.new
<FromGitter> <Blacksmoke16> oh?
<FromGitter> <rishavs> `context.response.headers["Set-Cookie"] = HTTP::Cookie.new("foo", "bar", "/admin", Time.now + 12.hours, secure: true).to_set_cookie_header` does sets a response cookie called Set-Cookie. but the cookie is not actually saved in the browser. I am assuming its because the cookie format is throwing some browser exception. āŽ āŽ However using simply `context.response.headers["Set-Cookie"] = "ding=dong"` sets a
<FromGitter> ... response header and then the cookie is also set in the browser
<FromGitter> <Blacksmoke16> could be setting the cookie on a diff domain
<FromGitter> <rishavs> Or maybe the the doc where I took the example of `HTTP::Cookie.new("foo", "bar", "/admin", Time.now + 12.hours, secure: true)` is outdated
<FromGitter> <Blacksmoke16> what if you just did `HTTP::Cookie.new("foo", "bar")`
<FromGitter> <Blacksmoke16> `. to_set_cookie_header`*
<FromGitter> <rishavs> that works
<FromGitter> <Blacksmoke16> yea so i think the issue is the `"/admin"` is saying only set the cookie for that domain
<FromGitter> <Blacksmoke16> whereas it defaults to `"/"`
<FromGitter> <rishavs> This is the problem bit `secure: true`
<FromGitter> <rishavs> this works ` context.response.headers["Set-Cookie"] = HTTP::Cookie.new("foo", "bar", "/admin", Time.now + 12.hours).to_set_cookie_header`
<FromGitter> <Blacksmoke16> oh really
<FromGitter> <Blacksmoke16> oh
<FromGitter> <Blacksmoke16> doesnt get set because you arent on https prob
<FromGitter> <rishavs> yep
<FromGitter> <rishavs> :D
<FromGitter> <Blacksmoke16> not really a bug then :p
<FromGitter> <rishavs> Thanks for all the help. Not a bug but I did learn a lot. šŸ˜„
<FromGitter> <Blacksmoke16> np
moei has quit [Read error: Connection reset by peer]
moei has joined #crystal-lang
duane has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <talbergs> @valamorgon yes global variables are not supported (I assume $var is older syntax, and @@ is for class properties) āŽ āŽ @valamorgon You did help me, the while loop now, when created with default output `output: :pipe` did exit as expected, Hooray. āŽ āŽ > you could save the proc variable somewhere ... [https://gitter.im/crystal-lang/crystal?at=5b3e386e60c38707836056e0]
<crystal-gh> [crystal] bcardiff opened pull request #6337: Update bountysource link (master...docs/readme-bs) https://git.io/fbhVA
<FromGitter> <veelenga> > @veelenga are you dropping ameba? āŽ @bararchy no, why do you think so?
<FromGitter> <bararchy> @veelenga Because of: Thanks, everyone for the collaboration. I don't plan to continue working on it.
<FromGitter> <bararchy> but now I guess you just meant the actual issue
<FromGitter> <bararchy> lol
<FromGitter> <bararchy> nvm
<FromGitter> <veelenga> yes, the actual issue. Seems like the team is not really interested in getting it done, so i just closed it.
<crystal-gh> [crystal] sdogruyol pushed 1 new commit to master: https://git.io/fbhr7
<crystal-gh> crystal/master f446e1b Brian J. Cardiff: Update bountysource link (#6337)
wontruefree has joined #crystal-lang
<travis-ci> crystal-lang/crystal#f446e1b (master - Update bountysource link (#6337)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/400505813
<DeBot> https://github.com/crystal-lang/crystal/pull/6337 (Update bountysource link)
lvmbdv has joined #crystal-lang
ua has quit [Ping timeout: 245 seconds]
<lvmbdv> anyone has a trick to emulate `String#rsplit` ?
<lvmbdv> all the solutions i can think of right now are ugly
duane has quit [Ping timeout: 268 seconds]
<FromGitter> <Blacksmoke16> why not jus use it?
<FromGitter> <Blacksmoke16> oh it doesnt exist
<FromGitter> <Blacksmoke16> what would it do differently? split right to left where first result was the match closest to the end?
<FromGitter> <Blacksmoke16> prob could just do like `"A fox jumping over a river".reverse.split(' ')`
cyberarm has joined #crystal-lang
<FromGitter> <Blacksmoke16> ah no, words are reversed too :/
ua has joined #crystal-lang
<FromGitter> <Blacksmoke16> no, could just do like `"A fox jumping over a river".split(' ')[-1]`
<FromGitter> <Blacksmoke16> which would be the first value from the right (end) of the array
<FromGitter> <Blacksmoke16> or even `"A fox jumping over a river".split(' ').reverse`
<FromGitter> <drujensen> @j8r thanks! I found this apt-get repo http://public.portalier.com/raspbian/ but its still Crystal 0.24.2
<FromGitter> <drujensen> anyone know if this is being maintained?
<FromGitter> <drujensen> Iā€™m hoping I can use the raspian os
<FromGitter> <drujensen> although, the armbian os looks pretty nice. hhmm.
<lvmbdv> Blacksmoke16: yeah but i need to use the `limit` parameter too
<FromGitter> <Blacksmoke16> hmm
wontruefree has quit [Quit: bye]
<FromGitter> <reiswindy> Maybe this could work? āŽ https://carc.in/#/r/4gg9
<FromGitter> <Blacksmoke16> lots of reversing :P
<FromGitter> <Blacksmoke16> but yea thats prob the cleanest you going to get
wontruefree has joined #crystal-lang
<lvmbdv> yeah that's exactly what i want reiswindy
<lvmbdv> alas, lots of reversing
duane has joined #crystal-lang
duane has quit [Ping timeout: 255 seconds]
zachk has joined #crystal-lang
zachk has quit [Changing host]
zachk has joined #crystal-lang
<FromGitter> <talbergs> @bew thank you, you helped me.
<FromGitter> <talbergs> ```code paste, see link``` āŽ āŽ At line 8, how do I pass the block, tried all kinds of things `<-&block` and `do block.call end`, but no luck [https://gitter.im/crystal-lang/crystal?at=5b3e634fbd92d8078296db64]
Nik736 has joined #crystal-lang
Nik736 has quit [Client Quit]
<oprypin> talbergs, delete `)(`
awgepragnoerg has joined #crystal-lang
<awgepragnoerg> Hi! I am banging my head because of this compilation error: `type must be NoReturn, not String`. `String` apparently is not important, `NoReturn` is. I am guessing that Crystal believes the code will always throw? It won't but how do I find out the problem?
<awgepragnoerg> Also, it is not easy to get a smaller reproducible case...
kosmonaut has quit [Remote host closed the connection]
kosmonaut has joined #crystal-lang
<oprypin> get any reproducible case. as long as it's one file
<oprypin> worst case, just put any relevant code snippet
<awgepragnoerg> Sorry, I'll have to come back about this tomorrow...
awgepragnoerg has quit [Quit: Page closed]
cozachk has joined #crystal-lang
zachk has quit [Ping timeout: 245 seconds]
<FromGitter> <adamgotterer_twitter> Can someone explain what's happening to "Server::Context" is in this statement: "def initialize(&@proc : WebSocket, Server::Context ->)". it doesn't appear to be used or assigned?
<oprypin> where is that code
<FromGitter> <bew> You have a captured block, saved into `@proc`, that takes 2 args (Websocket and Server::Context), and returns nothing
<oprypin> later you have ` @proc.call(ws_session, context)`
<FromGitter> <adamgotterer_twitter> Oh! I get it now. I kept seeing it as two params. Makes sense.
<FromGitter> <adamgotterer_twitter> Thank you
<oprypin> actually is `def initialize(&@proc : ((WebSocket, Server::Context) -> Nil))`
TCZ has joined #crystal-lang
<FromGitter> <straight-shoota> Maybe the parenthesis around the argument types should be required...
<FromGitter> <talbergs> @oprypin https://cl.ly/2J3F2s2j3D2R this did not help
<oprypin> @straight-shoota yes pls
<FromGitter> <bew> @straight-shoota yes that would help a lot
<oprypin> talbergs, you didnt do what i said
<oprypin> there is only one place with literal `)(` and you need to remove that
<FromGitter> <talbergs> yes, now i removed them, but this time also it says "wrong number of arguments"
<FromGitter> <reiswindy> You need to specify the input type āŽ āŽ ```def screen(&block : Process -> _) āŽ Process.run("bash", args: {"test.sh"}, &block) āŽ end``` [https://gitter.im/crystal-lang/crystal?at=5b3e7730bd92d80782970c95]
<FromGitter> <talbergs> Hooray, thanx @rwi
<FromGitter> <Blacksmoke16> awgepragnoerg do you have a code example?
TCZ has quit [Quit: Leaving]
duane has joined #crystal-lang
wontruefree has quit [Quit: bye]
RabbitWolf has joined #crystal-lang
<FromGitter> <talbergs> continung the story. I wanted to pass the block outside module methods: āŽ āŽ ```code paste, see link``` āŽ āŽ but an error on last line, how this would be done? again tried like `Aaa.screen &Aaa.prox` and `Aaa.screen <-Aaa.prox`, but no luck. [https://gitter.im/crystal-lang/crystal?at=5b3e89c733b0282df403a18d]
<FromGitter> <talbergs> followup question how typehint may be applied on blocks? `screen do |p : Process|` not the correct syntax
<oprypin> can't
<oprypin> about the previous thing: `Aaa.prox` is `Aaa.prox()`
<oprypin> `Aaa.screen(&->Aaa.prox(Process))`
<oprypin> `Aaa.screen { |p| Aaa.prox(p) }`
<oprypin> are your options
<FromGitter> <talbergs> Yes, this works. Thank you. I see I, gotta walk the docs one more time, I begin to feel uncomfortable. Hope to cach on soon.
<FromGitter> <talbergs> thou I do not come from ruby world, but php's.
DTZUZO has quit [Ping timeout: 264 seconds]
lvmbdv has quit [Ping timeout: 268 seconds]
<FromGitter> <bendietze_twitter> @talbergs much stuff in Crystal - no worry :)
RabbitWolf has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
return0e has quit [Read error: No route to host]
wontruefree has joined #crystal-lang
return0e has joined #crystal-lang
johndescs has quit [Ping timeout: 248 seconds]
johndescs has joined #crystal-lang
wontruefree has quit [Ping timeout: 265 seconds]
<FromGitter> <bew> @j8r hey I tried to polish things a bit, if you want to try my terminfo shard: https://github.com/bew/terminfo.cr
wontruefree has joined #crystal-lang
wontruefree has quit [Ping timeout: 265 seconds]
wontruefree has joined #crystal-lang