Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:23
    caspiano edited #10531
  • Dec 08 23:04
    HertzDevil edited #12623
  • Dec 08 22:57
    Blacksmoke16 edited #9745
  • Dec 08 22:57
    Blacksmoke16 labeled #9745
  • Dec 08 22:57
    Blacksmoke16 labeled #9745
  • Dec 08 22:54
    HertzDevil labeled #12828
  • Dec 08 22:54
    HertzDevil labeled #12828
  • Dec 08 22:54
    HertzDevil opened #12828
  • Dec 08 22:34
    straight-shoota edited #12827
  • Dec 08 22:32
    straight-shoota edited #12827
  • Dec 08 22:29
    straight-shoota labeled #12827
  • Dec 08 22:29
    straight-shoota labeled #12827
  • Dec 08 22:29
    straight-shoota opened #12827
  • Dec 08 22:15
    straight-shoota closed #12814
  • Dec 08 17:12
    straight-shoota assigned #12814
  • Dec 08 17:12
    straight-shoota assigned #12813
  • Dec 08 17:12
    straight-shoota assigned #12809
  • Dec 08 17:12
    straight-shoota assigned #12802
  • Dec 08 17:12
    straight-shoota assigned #12797
  • Dec 08 17:12
    straight-shoota assigned #12664
From IRC (bridge bot)
@FromIRC
<postmodern> but "<code></code>" worked in kramdown, doesn't seem to work incrystal doc`, so that seems like an issue
oprypin
@oprypin:matrix.org
[m]
again, crystal doc's Markdown is completely broken. that i would say is a waste of time
nanobowers
@nanobowers

I've run into an issue where Crystal's Array#fill doesnt work the same as Ruby's (it doesnt allocate additional space, but throws an IndexError), but not sure if this is intentional.

a=[10]
a.fill(9,1,2)
Unhandled exception: Index out of bounds (IndexError)

Ruby returns [10,9,9]

Unsure if the correct course of action is to file an issue, or manage this myself, though i havent seen a non-private method to increase capacity prior to running the #fill
George Dietrich
@Blacksmoke16
it should prob result in you not trying to overfill an array
nanobowers
@nanobowers
not sure I grok your statement, are you suggesting this is an intentional safety feature to prevent me from overfilling the Array?
nanobowers
@nanobowers
I just found that indexing w/ the range operator works, but this is arguably a little uglier:
a = [10]
# a.fill(9,1,2) # doesnt work
a[1..2]=[9] * 2
George Dietrich
@Blacksmoke16
i imagine its the same sort of idea as why you can do a[3] = 1
nanobowers
@nanobowers
I suppose it's the consistency part of it that's throwing me
E.g.
a=[10]
a[1] = 0 # IndexError
a[1..1] = 0  # => [10, 0]
Benjamin Wade
@RespiteSage
Is @redcodefinal around?
oprypin
@oprypin:matrix.org
[m]
@RespiteSage: sadly only on discord. "sol.vin"
Benjamin Wade
@RespiteSage
Alright, thank you. I'll hop over there, then.
Benjamin Wade
@RespiteSage
Wait, is the conference not actually happening on Discord?
Or is that where the side discussions will be?
Krzysztof K.
@krzyczak
Hello. Can I have a question about the conference. I would like to attend but I won't be able to be on all sessions. Will the conference be recorded?
Benjamin Wade
@RespiteSage
Yes, I believe they've said that everything will be recorded and publicly available afterward.
Krzysztof K.
@krzyczak
Thanks.
Rishav Sharan
@rishavs
Anyone here knows how to generate a public key using RS256 given the modulus and exponent? I am at the end of my rope now, trying to verify the Google IdToken with their public key.
https://www.googleapis.com/oauth2/v1/certs
https://www.googleapis.com/oauth2/v3/certs
Jonathan Silverman
@mixflame
I succeeded with Amber Multichannel Redis Websocket Adapter guys
made the test pass fast
Rishav, have you looked at Crystal OpenSSL libraries and the Crypto module?
Rishav Sharan
@rishavs
I started there but I couldn't find any method which looks like it does what I need
Nikolaii Lodenos
@lodenos

Good Evening form LDN :)
I try to do that but I’ve 

 20 | {% methods = method_listing(descriptions) %}
                   ^-------------
Error: undefined macro method: 'method_listing'

This is the code

macro method_listing(descriptions)
  %methods = [] of String
  {% for description in descriptions %}
    {% for key in description["methods"] %}
      %methods << %key
    {% end %}
  {% end %}
  %methods.uniq!
end

macro method_switch(descriptions)
  {% methods = method_listing(descriptions) %}
end

Do u have some Idea ???

Ary Borenszweig
@asterite
Yes. You can't call a macro from inside a macro.
George Dietrich
@Blacksmoke16
Does this even need to be a macro?
Nikolaii Lodenos
@lodenos
Hum I see but the code can be more reable because I try to refactor 300 lignes code of pure macro
@Blacksmoke16 It’s a exemple of my issue
George Dietrich
@Blacksmoke16
could prob do like method_listing {{descriptions}}
but my question still stands, dont really need a macro to do this type of thing
Nikolaii Lodenos
@lodenos
Ok I understand It’s was an exemple a somthing more complicated
George Dietrich
@Blacksmoke16
fair enough
Nikolaii Lodenos
@lodenos
How can we organised a really big macro ?
like 300 lines
George Dietrich
@Blacksmoke16
use variables, proper indenting etc
got a link to it?
It’s Horrible how it’s writed
I don’t understand my own code
George Dietrich
@Blacksmoke16
oo another framework :P
Nikolaii Lodenos
@lodenos
it’s more a library than a framework
George Dietrich
@Blacksmoke16
unfortunately there just isnt a good way to have clean macro code because you can't define reusable macro methods (yet?)
could probably just add more comments or something, id also suggest writing some tests, be easier to ensure its working at least
Nikolaii Lodenos
@lodenos
Right, thx for the anser, I hope one day we can reuse macro methods can be really powefull
George Dietrich
@Blacksmoke16
have you considered using annotations instead of the hash?
@[Cocaine::Route(path: "/", verb: "GET")]
def controller_index(context : HTTP::Server::Context, params : Cocaine::Param)
  context.response.content_type = "text/plain"
  context.response.print "Hello world, got #{context.request.path} !"
end

@[Cocaine::Route(path: "/user/:id", verb: "GET")]
def controller_user(context : HTTP::Server::Context, params : Cocaine::Param)
  context.response.content_type = "text/plain"
  context.response.print "Hello world, got #{context.request.path} !"
end


################################################################################
# Server
################################################################################

server = HTTP::Server.new { |context| Cocaine.match_endpoint context }
server.listen "0.0.0.0", 5000
Nikolaii Lodenos
@lodenos
I never try that on my own code
George Dietrich
@Blacksmoke16
looks like a good use case for them. However the downside is there isn't a way to iterate over all methods with an annotation, so would need to think of a way around that.