<FromGitter>
<johnjansen> there might be other ways, but I’m sure they wont be on hash
<FromGitter>
<johnjansen> if you are going to ignore the keys, as you seem to be doing, you could `hash.values.sort{}`
<FromGitter>
<jots_twitter> yes i do need the keys, need to print out key/value in sorted order
<FromGitter>
<johnjansen> @jots_twitter elements in the array will be a tuple so you can do the following `to_a.sort{ |(a_key, a_val), (b_key, b_val)| a_val <=> b_val }`
<FromGitter>
<johnjansen> sort_by may allow similar
maxpowa has quit [Ping timeout: 256 seconds]
maxpowa has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 256 seconds]
[spoiler] has quit [Ping timeout: 268 seconds]
[spoiler] has joined #crystal-lang
foca has quit [Ping timeout: 250 seconds]
foca has joined #crystal-lang
ryanf has quit [Remote host closed the connection]
buse has joined #crystal-lang
buse has quit [Remote host closed the connection]
soveran has joined #crystal-lang
manuel has joined #crystal-lang
manuel has quit [Remote host closed the connection]
soveran has quit [Ping timeout: 256 seconds]
mgarciaisaia has quit [Quit: Leaving.]
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
bjmllr has quit [Ping timeout: 258 seconds]
hako has quit [Ping timeout: 260 seconds]
hako has joined #crystal-lang
Philpax has quit [Ping timeout: 252 seconds]
soveran has joined #crystal-lang
bjz has joined #crystal-lang
soveran has quit [Ping timeout: 250 seconds]
bjz has quit [Read error: Connection reset by peer]
<FromGitter>
<sdogruyol> @jots_twitter that's great
soveran has joined #crystal-lang
<FromGitter>
<jots_twitter> @sdogruyol : you wrote kemal right? I've just started using it, it's very nice! one question: If I put index.html file in public I still need http://myserver/index.html on the url, http://myserver/ does not render the index file. is there a setting to make that work?
<FromGitter>
<sdogruyol> anything under `public` is treated as static and `index.html` is no exception
<FromGitter>
<jots_twitter> ok, thanks. I'll go with that. might be nice to have kemal automagically serve index.html files at some point to reduce routes in the code.
soveran has quit [Ping timeout: 265 seconds]
<FromGitter>
<sdogruyol> @jots_twitter i'd rather be as much explicit as i can :)
<FromGitter>
<jots_twitter> oh then i better not tell you about my idea of auto views (same idea but for views) :-)
<FromGitter>
<sdogruyol> :)
<FromGitter>
<sdogruyol> it's okay to have ideas and you can open an issue for those
<FromGitter>
<sdogruyol> thanks for using kemal
<FromGitter>
<jots_twitter> i really like it.
soveran has joined #crystal-lang
gloscombe has joined #crystal-lang
bjmllr has joined #crystal-lang
sane_k_ has quit [Ping timeout: 250 seconds]
gloscombe has quit [Ping timeout: 250 seconds]
gloscombe has joined #crystal-lang
soveran has quit [Remote host closed the connection]
triangles has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Philpax has joined #crystal-lang
soveran_ has joined #crystal-lang
soveran has quit [Ping timeout: 268 seconds]
<FromGitter>
<xdougx> Hi Guys, im writing a lib, to try its features beyond the tests, i have to create an `init.cr` and compile it?
<FromGitter>
<xdougx> and call what i want to try, or i have something else?
<RX14>
@xdougx yes, just create a file and then use require to require the library
Philpax has quit [Ping timeout: 260 seconds]
<FromGitter>
<xdougx> like ruby defined?(CONST), has this method?
<FromGitter>
<luislavena> @xdougx there is no `defined?`, since that is a runtime check and Crystal is a compiled language.
<FromGitter>
<kbrock> Hi all ⏎ Trying to get crystal_ruby to compile ⏎ I came across `require "compiler/crystal/**"`, and `require "llvm"` which no longer compile. ⏎ Any pointers where I can track down moved packages for crystal? ⏎ Or packages for porting older crystal code? [https://gitter.im/crystal-lang/crystal?at=583303f652af72f05432d50c]
<FromGitter>
<kbrock> Or if there is a better example of ruby calling crystal, that would be cool too
<FromGitter>
<fridgerator> Sorry thats not something I've tried doing. I can see though that the `crystal_ruby` library hasn't been updated in a while
<FromGitter>
<phoffer> Is there something specific you are thinking of doing?
<FromGitter>
<phoffer> In reality (at least right now), there’s probably limited use case for using Crystal inside Ruby
<FromGitter>
<luislavena> @xdougx I think will be better if you explain what you're trying to do more than the specific tools. As a compiled language, things can be done differently than a dynamic one.
<FromGitter>
<luislavena> You can conditionally require some files, using the macro language and compile flags, you can also check if some constant is defined, however, all that is done at compile time, not runtime, which is why I ask what is the problem you want to solve to point you in the right direction.
<FromGitter>
<kbrock> Thanks @phoffer and @fridgerator - I'm just looking for more of a use case to get some crystal into our rails.
<FromGitter>
<fridgerator> should the macro expand to `def initialize(hash : Hash(String, string))` instead?
<FromGitter>
<xdougx> But in this Hash i can receive Hash(String, String|Int32|Int64|Nil|Array|JSON|.....)
<FromGitter>
<xdougx> i need the most generic Hash as possible
<FromGitter>
<xdougx> in crystal 0.17 i had no probleman with this macro
<FromGitter>
<fridgerator> ah
<FromGitter>
<phoffer> @kbrock PM me if you’re serious about getting some Crystal into your Rails app. I’ve done it but it currently has deployment issues
<FromGitter>
<xdougx> @fridgerator not even setting `def initialize(hash : Hash(String, String))`, it throws the same error when it compile
<FromGitter>
<luislavena> @xdougx what is the error? from the output is missing the specific error message. Most likely is because is missing the types for the instance variables.
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
<FromGitter>
<xdougx> @luislavena above i've all the error output
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<FromGitter>
<luislavena> @xdougx can you provide the entire `init.cr` source for testing? It feels is missing something about the error message. Says an error but I cannot see the error in the output you pasted.
<FromGitter>
<kbrock> @phoffer thanks so much for the offer. it will take time. 50 person team...
<FromGitter>
<luislavena> My upgrades from old versions to 0.16+ were only painful in relation to types on the variables, after that was smooth.
<FromGitter>
<xdougx> i was reading the blog, but didnt read this one
mark_66 has quit [Remote host closed the connection]
gloscombe has quit [Quit: Lost terminal]
kulelu88 has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<FromGitter>
<johnjansen> hey @sdogruyol i was trying to mess with a request within a handler (i.e. changing the path), should that work in your opinion
<FromGitter>
<sdogruyol> redirect?
<FromGitter>
<johnjansen> nah, just change the path and call_next
<FromGitter>
<johnjansen> i can redirect, but its not the ideal behaviour
<FromGitter>
<sdogruyol> in theory it should work
<FromGitter>
<johnjansen> thats what i thought … ill take another look
<FromGitter>
<sdogruyol> havent tried though
<FromGitter>
<sdogruyol> let me check
<FromGitter>
<johnjansen> ;-)
<FromGitter>
<johnjansen> it needs to wind up at a static address
<FromGitter>
<johnjansen> static content i should say
<FromGitter>
<johnjansen> ok cool, i must have got something slightly wrong… ⏎ yeah i was intercepting everything, and mapping queries into paths (for my purposes), i must have messed something up as i was getting blank pages back
<FromGitter>
<sdogruyol> and be sure to use Kemal master for now
<FromGitter>
<johnjansen> now that i know it should work, i will persist a litlle more
<FromGitter>
<johnjansen> sure am dude, i got that message loud and clear ;-)
<FromGitter>
<sdogruyol> :smile:
<FromGitter>
<xdougx> is this possible to this router instead of call an block, call a class method?
<FromGitter>
<sdogruyol> @xdougx it is possible to do whatever you want
<FromGitter>
<johnjansen> oh BTW i got another site up too http://www.naming.com/ its only tiny, but its all kemal
<FromGitter>
<sdogruyol> I think i need to write a cookbook for these patterns :P
<FromGitter>
<sdogruyol> @johnjansen awesome :+1:
<FromGitter>
<sdogruyol> @johnjansen can i shamelessly advertise this :P
<FromGitter>
<xdougx> will be rendered” “Index Action”?
<FromGitter>
<sdogruyol> @xdougx yes
<FromGitter>
<sdogruyol> you can define your controller in seperate files and use them in routes.cr just like Rails if you want
<FromGitter>
<xdougx> MainController could extend render methods from kemal, and be more funny :D
<FromGitter>
<sdogruyol> @xdougx it already has everything within `env`
<FromGitter>
<sdogruyol> like i said this is just a way of doing things
pawnbox has quit [Remote host closed the connection]
<FromGitter>
<johnjansen> sure @sdogruyol, and so you know, this is the one i was talking about the other day … i had a handler intercept the requests and download missing resources from wayback machine, caching them in public ...
<FromGitter>
<xdougx> :thumbsup:
<FromGitter>
<sdogruyol> @johnjansen oh i see
<FromGitter>
<johnjansen> it was easier than trying to get an old wordpress installation working again, and / or migrating the data
pawnbox has joined #crystal-lang
<FromGitter>
<xdougx> i need to take a look in this kemal soon
<FromGitter>
<phoffer> @sdogruyol I was just starting to put together some examples/snippets actually, I think it is a good idea. At least in my experience, a lot of time I end up thinking “how do I do this one little thing?” —things that don’t necessarily fit in docs but are nice to have example somewhere
<FromGitter>
<sdogruyol> @phoffer yeah you are right
<FromGitter>
<xdougx> whats the best way to perform a configuration, is using yams file and loading, or doing a initializer with the configuration params in a block, o use both?
<FromGitter>
<sdogruyol> depends
<FromGitter>
<xdougx> building up a database configuration
<FromGitter>
<xdougx> port, host, user, password
<FromGitter>
<sdogruyol> well KISS make a block at first
<FromGitter>
<johnjansen> If it were me I'd pass env vars in
<FromGitter>
<spalladino> @jots_twitter env vars is typically the easiest way if you're running containers, though you should avoid using them for passing secrets into the container, such as the db pass (see https://github.com/docker/docker/issues/13490). If you're using an external yaml file for settings, and you have control over which host the container will be running, I'd mount the file it as a volume rather than `docker cp`-ing it.
Ven_ has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<FromGitter>
<johnjansen> thanks @cjgajard that is exactly what i was looking for
<FromGitter>
<johnjansen> so much to try and remember ;-)
<FromGitter>
<jots_twitter> `previous_def` neat! AOP building block :-)
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<jots_twitter> I need to connect to mysql database from kemal app. what is best? crystal-lang/crystal-mysql or crystal-lang/crystal-db or something else? I'm used to using "Sequel" gem on ruby.
bjz has joined #crystal-lang
<FromGitter>
<PandaWhisperer> Just noticed that Crystal has builtin OAuth2 support in the standard library. Very cool. Does anyone have usage example?
mgarciaisaia has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]