jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
deavmi_ has quit [Ping timeout: 264 seconds]
deavmi has joined #crystal-lang
Welog has quit [Remote host closed the connection]
dostoyevsky has quit [Ping timeout: 265 seconds]
dostoyevsky has joined #crystal-lang
go|dfish has quit [Ping timeout: 265 seconds]
V has quit [Ping timeout: 265 seconds]
twosecslater has quit [Ping timeout: 265 seconds]
V_ has joined #crystal-lang
V_ has quit [Client Quit]
V_ has joined #crystal-lang
V_ is now known as V
chachasmooth has quit [Ping timeout: 260 seconds]
f1reflyylmao has joined #crystal-lang
chachasmooth has joined #crystal-lang
f1refly has quit [Ping timeout: 256 seconds]
go|dfish has joined #crystal-lang
chachasmooth has quit [Ping timeout: 256 seconds]
chachasmooth has joined #crystal-lang
lanodan has quit [Ping timeout: 244 seconds]
lanodan has joined #crystal-lang
woodruffw has quit [Ping timeout: 260 seconds]
f1reflyylmao has quit [Ping timeout: 246 seconds]
zorp has joined #crystal-lang
coderobe has quit [Quit: Ping timeout (120 seconds)]
oddp has joined #crystal-lang
sorcus has quit [Ping timeout: 272 seconds]
sorcus has joined #crystal-lang
coderobe has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <j8r> wow there are 36 CI tests...
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #crystal-lang
woodruffw has joined #crystal-lang
zorp has quit [Ping timeout: 256 seconds]
zorp has joined #crystal-lang
zorp_ has joined #crystal-lang
zorp has quit [Ping timeout: 265 seconds]
oddp has quit [Quit: quit]
deavmi_ has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
<repo> Blacksmoke16: which db adapter did you recommend again? based on annotations?
<repo> granite, right?
<FromGitter> <Blacksmoke16> yea
<repo> and the models would probably work with https://athena-framework.github.io/serializer/Athena/Serializer.html right?
<FromGitter> <Blacksmoke16> yup
<repo> nice
<repo> thanks :)
<FromGitter> <Blacksmoke16> np
<repo> Blacksmoke16: kudos for that documentation. Really well done!
<FromGitter> <Blacksmoke16> ❤️ i try :p
<repo> Blacksmoke16: what would be the steps required to add a custom (de)serializer
<repo> implementing a visitor?
<repo> and adding the type to the enum?
<FromGitter> <Blacksmoke16> would have to implement the visitors yea, however you cant reopen enums so you would have to do this
<repo> i'm thinking about maybe adding one for x-www-form-urlencoded
<FromGitter> <Blacksmoke16> and like check if the provided string is your format, otherwise just call `previous_def` or something
<repo> right
<repo> but i could fork :P
<FromGitter> <Blacksmoke16> never really thought of that being a serialization format before
<FromGitter> <Blacksmoke16> suppose it is tho
<repo> :)
<repo> i mean it's fairly common to have forms sent in this format
<repo> and it'd be pretty awesome to be able to define one model, that would work in an api as well as in a "classic" web app
<FromGitter> <Blacksmoke16> yea for sure. i wouldnt be opposed to including that in the core shard
Human_G33k has quit [Quit: Leaving]
HumanG33k has joined #crystal-lang
deavmi_ has quit [Quit: Eish! Load shedding.]
deavmi has joined #crystal-lang
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter> <mixflame> is there a crystal multilingual badwords filter shard? is there a shard that allows parsing links out of a string as well?
<FromGitter> <mixflame> i want to extract all the links from a string and then do some parsing on them to check the domain, and i also want as many bad words filtered as possible
<FromGitter> <dscottboggs_gitlab> the stdlib has `URI.parse`, would that work?
<FromGitter> <mixflame> that will work once the URL's are regexed or removed from the string
<FromGitter> <mixflame> the string could have multiple urls in it
<FromGitter> <j8r> how bad?
<FromGitter> <mixflame> anything a 4 year old cant handle
<FromGitter> <Blacksmoke16> sounds like a pita
<FromGitter> <mixflame> apple requirements to launch my app
<FromGitter> <mixflame> 1) Require that users agree to terms (EULA) and these terms must make it clear that there is no tolerance for objectionable content or abusive users ⏎ 2) A method for filtering objectionable content ⏎ 3) A mechanism for users to flag objectionable content ⏎ 4) A mechanism for users to block abusive users ⏎ 5) The developer must act on objectionable content reports within 24 hours by removing the
<FromGitter> ... content and ejecting the user who provided the offending content [https://gitter.im/crystal-lang/crystal?at=5f3d82c9a8c17801765d230a]
<FromGitter> <dscottboggs_gitlab> I know @watzon has a NLP shard -- but I don't think it has that feature yet.
<FromGitter> <Blacksmoke16> boo 🍎
<FromGitter> <mixflame> yeah we weren't fans when they sent that in, especially because my protocol is similar to IRC
<FromGitter> <mixflame> where servers take care of users and not the IRC originator
<FromGitter> <j8r> you could get a list somewhere
<FromGitter> <j8r> keep in mind it is impossible to be exhaustive
<FromGitter> <mixflame> yeah I understand. they only asked for the ability to filter
<FromGitter> <j8r> people bypass this by using typos, or similar wording
<FromGitter> <j8r> *sound
<FromGitter> <mixflame> yeah but the post can also be reported when i implement that
<FromGitter> <mixflame> then I could add the post itself to the filter
<FromGitter> <j8r> yep, you can have a mechanism where users can report and censure others
<FromGitter> <mixflame> yeah that's the current design
<FromGitter> <mixflame> i just wanted to keep the filtering stuff within crystal because its fast
<FromGitter> <Blacksmoke16> hard for that to be automated tho no?
<FromGitter> <mixflame> and without having to exfiltrate non-reported messages to the server under weaker encryption
<FromGitter> <Blacksmoke16> otherwise i could report you saying any normal word
<FromGitter> <mixflame> it won't be 100% automated
<FromGitter> <mixflame> I will have to moderate via a backend
postmodern has quit [Quit: Leaving]
<FromGitter> <dscottboggs_gitlab> @mixflame I think this is what you want https://github.com/cadmiumcr/cadmium
<FromGitter> <mixflame> thanks
<FromGitter> <dscottboggs_gitlab> np
<FromGitter> <j8r> I'm quite surprised there were no js library to encode/decode datatypes to/from bytes
<FromGitter> <j8r> so I made https://github.com/j8r/js-byte-format, which will talk with the crystal backend which uses https://crystal-lang.org/api/master/IO/ByteFormat.html
<FromGitter> <j8r> I see that some games uses Socket.io
<FromGitter> <j8r> not an option for me, since I use Crystal :)
<FromGitter> <dscottboggs_gitlab> can't you send binary data through websockets? or is it just strings?
<FromGitter> <dscottboggs_gitlab> oh I see, you can't pass a float or int through ws
<FromGitter> <dscottboggs_gitlab> neat! thanks @j8r!
HumanG33k has quit [Ping timeout: 260 seconds]
deavmi has quit [Ping timeout: 246 seconds]
sorcus has quit [Quit: WeeChat 2.9]
deavmi has joined #crystal-lang
<oprypin> so in C you can just write `static int foo = 0` anywhere in a function. it's an init-once global that's accessible only locally... what would the closest equivalent be in crystal?
<FromGitter> <Blacksmoke16> prob just a local variable in the method
<FromGitter> <Blacksmoke16> :shrug:
<oprypin> no but it's persistent
<FromGitter> <dscottboggs_gitlab> pretty sure that's not a thing in Crystal
<FromGitter> <dscottboggs_gitlab> yeah, not the same thing @Blacksmoke16
<FromGitter> <dscottboggs_gitlab> the closest we'd have is something namespaced to a module with `class_property foo : Int32 { 0 }`
<FromGitter> <Blacksmoke16> constant with a getter method?
<FromGitter> <dscottboggs_gitlab> @Blacksmoke16 it's mutable but default initialized the first time
<FromGitter> <dscottboggs_gitlab> oprypin, what's wrong with that?
<oprypin> sucks that i cant be put into a macro https://carc.in/#/r/9kek
<FromGitter> <dscottboggs_gitlab> you could just do `static y : Int32 = 4` though
<FromGitter> <Blacksmoke16> `static`? :thinking:
<oprypin> Error: declaring the type of a class variable must be done at the class level
<FromGitter> <dscottboggs_gitlab> also, again, this is just a `class_property` with a block, and leaks to the surrounding scope
<oprypin> egh i'm just looking for proximity to surrounding code (yes, horrible)
<FromGitter> <dscottboggs_gitlab> TBH I wouldn't mind seeing how a feature request for this would go over
<oprypin> LOL
<oprypin> to have a good laugh, or something
<FromGitter> <dscottboggs_gitlab> yeah true, I don't think I've ever had a feature request go over well...
<FromGitter> <RespiteSage> Is the C `static int` mutable?
<oprypin> RespiteSage, yes
<FromGitter> <RespiteSage> Huh. I'm looking at how it behaves now, and it's very strange.
<oprypin> it's literally just a global variable *but* it's accessible only inside the function and also enjoys the benefit of being located with the rest of the function body
<FromGitter> <RespiteSage> Yeah. I guess that's a bit safer than true globals...
<oprypin> writing `static int x = 5` is nothing like `int x = 5`, the definition is kinda yanked at very early stages of the compilation, and behaves as if you wrote `int x = 5` at the top of the program instead
<FromGitter> <RespiteSage> So for `static int x=5; x-=1`, two runs of the containing method would leave `x` equal to 3?
<FromGitter> <RespiteSage> *`x--`.
<oprypin> ye
<FromGitter> <RespiteSage> Yeah, I'm struggling as well to come up with a way to do that in Crystal.
<oprypin> RespiteSage, well https://carc.in/#/r/9keb is it
<FromGitter> <dscottboggs_gitlab> it would need added as a compiler feature
<oprypin> if macros could escape their caller scope it'd be easy
<oprypin> "upon calling this macro append the following to the end of the program"
<FromGitter> <RespiteSage> Yeah...
<FromGitter> <mixflame> how do I convert ```["*","*","*"]``` to ```"***"``` in crystal
<FromGitter> <Blacksmoke16> `.join`?
<FromGitter> <mixflame> thx
<FromGitter> <mixflame> I just ported the rubygem Obscenity to crystal with tests https://github.com/mixflame/obscenity-cr have a look
<FromGitter> <mixflame> if anyone wants to help me make it into a shard, we have a new shard there
<FromGitter> <Blacksmoke16> maybe update the readme, i dont have any idea what this is
<FromGitter> <mixflame> ok
<FromGitter> <RespiteSage> A link to the gem you ported would be nice, too.
<FromGitter> <mixflame> it's a direct port of this https://github.com/tjackiw/obscenity
<FromGitter> <mixflame> k
<FromGitter> <RespiteSage> I just meant in the readme.
<FromGitter> <mixflame> yup np I did it
<FromGitter> <RespiteSage> Cool. That was a quick turnaround, though.
<FromGitter> <mixflame> I just lead back to the original readme because I left the api the same
<FromGitter> <dscottboggs_gitlab> I'm sure that you just copied the original `blacklist.yml` from the original gem, but I find it weird to use YAML to represent a flat list of strings. Why not just newline-separate them and do `File.open "blacklist", &.each_line.to_a`?
<FromGitter> <mixflame> that's right I copied what they had. they were doing ```YAML.load_file``` which loads it directly to an array, which Crystal doesn't have
<FromGitter> <Blacksmoke16> `Array(String).from_yaml File.read "blacklist.yml"`
<FromGitter> <mixflame> I'm taking pull requests :)
<FromGitter> <dscottboggs_gitlab> yeah, I'll do a PR to switch to NDL if you wouldn't mind
<FromGitter> <dscottboggs_gitlab> Idk I'm pretty opinionated about stuff that I know doesn't matter and it's hard to know when something I'm saying is just an inconsequential opinion vs something worth submitting a PR over
<FromGitter> <mixflame> true
zorp_ has quit [Ping timeout: 265 seconds]
<FromGitter> <mixflame> I'm successfully using the Obscenity port in my Crystal server. Just to let you guys know.
<FromGitter> <alexherbo2> why does crystal does not support `private` / `protected` declarations?
<FromGitter> <Blacksmoke16> it does
<FromGitter> <alexherbo2> not aligned with `def`?
<FromGitter> <Blacksmoke16> `private def foo`
<FromGitter> <alexherbo2> in ruby we can do
<FromGitter> <alexherbo2> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5f3dae933dac5343401a747b]
<FromGitter> <Blacksmoke16> yea you cant do that, just do
<FromGitter> <Blacksmoke16> ```private def foo ⏎ end ⏎ ⏎ private def bar ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5f3daea533878e7e602dc7c2]
<FromGitter> <3n-k1> anyone know where `Crystal::CodeGenVisitor::Context` is defined in the compiler?
<FromGitter> <3n-k1> having trouble finding it with grep
<FromGitter> <3n-k1> oh duh it's in codegen/context.cr lol
<FromGitter> <dscottboggs_gitlab> haha yeah
<FromGitter> <3n-k1> low contrast terminal, misread it for codegen.cr :P
<FromGitter> <dscottboggs_gitlab> ah