ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | 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
<FromGitter> <asterite> The "src" folder is something special, there are rules about that in the compiler
DTZUZO has quit [Ping timeout: 268 seconds]
<FromGitter> <bew> For requires in shards, right? Are there other rules?
<FromGitter> <asterite> 1) yes, 2. no
[spoiler] has quit [Quit: Cheers!]
sagax has quit [Ping timeout: 244 seconds]
laaron- has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
alex`` has joined #crystal-lang
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
alex`` has quit [Ping timeout: 245 seconds]
<FromGitter> <girng> hello
<FromGitter> <tenebrousedge> how's?
<FromGitter> <girng> @tenebrousedge good how about you?
<FromGitter> <tenebrousedge> probably good. Pondering API metadata in redux
<FromGitter> <girng> nice
<FromGitter> <girng> are you making a project with redux and crystal together?
<FromGitter> <tenebrousedge> no, it's trivial enough to not need a backend. But there are a dozen similar ways to do any given thing in react/redux world, and I'm not convinced any of them are right
<FromGitter> <girng> interesting. i've never used redux i'm a vanilla js guy
<FromGitter> <tenebrousedge> have you read *You Don't Know JS* ?
<FromGitter> <girng> nope
<FromGitter> <tenebrousedge> https://github.com/getify/You-Dont-Know-JS
<FromGitter> <tenebrousedge> it's brilliant -- a gem
<FromGitter> <girng> i'll give it a look once i'm dong client-side stuff later
<FromGitter> <girng> that's a lot of stars
<FromGitter> <girng> LOL at the gif
<FromGitter> <tenebrousedge> love it
laaron- has joined #crystal-lang
<FromGitter> <watzon> @wontruefree https://github.com/watzon/subnet
laaron has quit [Remote host closed the connection]
moei has joined #crystal-lang
sagax has joined #crystal-lang
<FromGitter> <vladfaust> How to easily convert hexstring to bytes
<FromGitter> <mistergibson> "0xff".to_i(16) ??
DTZUZO has joined #crystal-lang
<FromGitter> <vladfaust> Um, no
<FromGitter> <watzon> ``````
<FromGitter> <watzon> Whoops haha
<FromGitter> <watzon> raw = uninitialized UInt8[4] IO::ByteFormat::BigEndian.encode(hexstring, raw.to_slice) ⏎ raw
<FromGitter> <watzon> Sorry I'm on my phone, but that's basically how you do it
<FromGitter> <bajro17> I think it will be so good if we can do same for crystal
<FromGitter> <vladfaust> @watzon nope
<FromGitter> <bajro17> or like golang https://github.com/go-flutter-desktop/go-flutter
<FromGitter> <vladfaust> Once again, `pp "t".to_slice == Bytes[116] # => true`, but they are not really the same. PQ binding absolutely does not like `Bytes[116]`, but works with `"t".to_slice`. /cc @asterite
<FromGitter> <vladfaust> @watzon it's `String#hexbytes`
<FromGitter> <vladfaust> Also, @asterite, I've got tons of `GC Warning: Finalization cycle involving 0x7fb3385a5500` on error. Any way to suppress it?
sz0 has quit [Quit: Connection closed for inactivity]
<FromGitter> <vladfaust> I'd like to create an `IO::Memory` pointing to `LibC::Char*`, i.e. without allocating internal buffer. Is it possible?
alex`` has joined #crystal-lang
<FromGitter> <vladfaust> That was trivial: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d175b84ffd4b84a8fd0c83a]
<FromGitter> <girng> WOW i just spent an hour or so finding this bug
<FromGitter> <girng> well, not a bug. but a mistake by me. it's modifying the local variable!!!
<FromGitter> <girng> HERP DERP i'm not very smart!!
lucasb has joined #crystal-lang
<FromGitter> <mwlang> @asterite Are the rules regarding "src" documented somewhere? I'd love to read up on it just so I am fully aware.
<FromGitter> <j8r> `src`, the directory?
<FromGitter> <naqvis> Getting `#info` on symbolic links is still yielding the `File::Type` as `File`. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d17713cda128007c6921a1d]
<FromGitter> <naqvis> is there anyway to retrieve the stats?
<FromGitter> <j8r> You can do like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d17778d4db9b92ce36e6535]
<FromGitter> <j8r> unfortunately the API isn't OOP
<FromGitter> <naqvis> Thanks @j8r
<FromGitter> <naqvis> Providing param `follow_symlinks` as `false`, fixed my issue.
<FromGitter> <naqvis> which is `true` by default
thodoris has quit [Quit: Connection closed for inactivity]
alex`` has quit [Ping timeout: 245 seconds]
alex`` has joined #crystal-lang
alex`` has quit [Read error: Connection reset by peer]
alex`` has joined #crystal-lang
<FromGitter> <vladfaust> It's impossible to work with slices and bindings. They (slices) are full of trash contents
<FromGitter> <vladfaust> Nah, that's me.
<FromGitter> <watzon> @wontruefree did you see https://github.com/watzon/subnet? You were kind of the inspiration for it haha.
laaron- has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <girng> power of crystal ;D (https://streamable.com/g2umv)
<FromGitter> <watzon> @girng a game written in Crystal?
<FromGitter> <girng> all backend, yeah ;D <3 crystal
<FromGitter> <watzon> That's awesome. What's the fontend using?
<FromGitter> <girng> @watzon Godot Engine :P. mix that with crystal and you can create some awesome stuff
<FromGitter> <watzon> Thats really cool
<FromGitter> <girng> thanks, wouldn't be possible without the help of the community!
<FromGitter> <girng> when i first started w/ crystal, i didn't even know how to connect and send data through a socket -_-
<FromGitter> <watzon> Well you sure do now lol
<FromGitter> <girng> haha i just needed the foundation i guess now i'm on a roll
<rkeene> Someone should make a PKCS#11 interface for Crystal like TclPKCS11
<FromGitter> <Blacksmoke16> speaking of performance, my jq wrapper is quite a bit faster at parsing large json files
<FromGitter> <Blacksmoke16> than the python lib
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d17ba2cddd2c007c72c89c4]
<FromGitter> <Blacksmoke16> i mean like a lot faster
<FromGitter> <Blacksmoke16> fixed the line count, was printing the output twice
<FromGitter> <watzon> Not surprising. Python sucks.
<FromGitter> <Blacksmoke16> apparently so
<FromGitter> <girng> hey @Blacksmoke16
<FromGitter> <Blacksmoke16> sup?
<FromGitter> <girng> i was curious, on how to start to implement a tree system in crystal, like a web. with connected nodes. got any good starting points
<FromGitter> <Blacksmoke16> whats the goal?
<FromGitter> <girng> basically, allocating nodes with points. but they have to be connected
<FromGitter> <girng> let's say, the user has 5 points to allocate
<FromGitter> <Blacksmoke16> ah, like a skill tree?
<FromGitter> <girng> there is a web (tree) with 5 nodes connected, but the user can't allocate that 1 node unless they have the adjacent node allocated
<FromGitter> <girng> yeah
<FromGitter> <Blacksmoke16> https://github.com/evolve75/RubyTree
<FromGitter> <Blacksmoke16> could maybe port that :P
<FromGitter> <girng> i was curious on how to do this on the backend and store its data
<FromGitter> <tenebrousedge> why store it?
<FromGitter> <girng> player's skill tree data, needs to be saved in a database
<FromGitter> <Blacksmoke16> i used that gem when i was working on my branch and bound project
<FromGitter> <Blacksmoke16> worked quite well
<FromGitter> <tenebrousedge> you can just store the points per skill
<FromGitter> <Blacksmoke16> also would have to store the relationship between the skills
<FromGitter> <tenebrousedge> yes
<FromGitter> <Blacksmoke16> so you cant just put all your points in the later ones before skilling up the earlier ones
<FromGitter> <Blacksmoke16> prob need a few tables to store this
<FromGitter> <tenebrousedge> I'd have a fake root node
<FromGitter> <girng> i was thinking of just storing the skill ids the player allocated. and then if they are try to allocate a skill id that has a dependant, they can't. but i would need to have dependents for each skill id. could be a lot
<FromGitter> <girng> i'm going to try to just do a small one, with 5 nodes or whatnot and see what i can do
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <girng> start small
<FromGitter> <girng> gonna look at this rubytree thingi as well
<FromGitter> <tenebrousedge> give skills a `parent_id`, and a `children` method
<FromGitter> <Blacksmoke16> i like that
<FromGitter> <girng> oh i like that too
<FromGitter> <girng> good idea
<FromGitter> <tenebrousedge> so you can assign skill points to any skill that has less than MAX_RANKS, or any of their children
lucasb has quit [Quit: Connection closed for inactivity]
moei has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <vladfaust> Sneak peak: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Actually works. These are bindings for PQ [https://gitter.im/crystal-lang/crystal?at=5d17c51f03d62b4d28af1941]
<FromGitter> <vladfaust> It also works in crystal-pg, but I got it too! It wasn't easy
<FromGitter> <watzon> Good job @vladfaust!
<FromGitter> <vladfaust> Thanks :3
<FromGitter> <watzon> Crystal's `Hash` doesn't have a method like Ruby's `Hash#key` does it?
<FromGitter> <watzon> Basically returns the key for a value instead of the other way around
<FromGitter> <vladfaust> https://crystal-lang.org/api/0.29.0/Hash.html#key_for%28value%29-instance-method
<FromGitter> <watzon> You're awesome
<FromGitter> <watzon> Thanks :)
rohitpaulk has quit [Ping timeout: 245 seconds]
<FromGitter> <girng> https://github.com/crystal-lang/crystal/pull/7940 what will this allow us to do
<FromGitter> <girng> eli5 plz, ty
<FromGitter> <vladfaust> ```code paste, see link``` ⏎ ⏎ Damn it, that's green as well. [https://gitter.im/crystal-lang/crystal?at=5d17c90dda128007c6951b57]
<FromGitter> <vladfaust> No need for `:text_array`, tho
<FromGitter> <vladfaust> @girng ⏎ ⏎ > Refactor ⏎ ⏎ Well, nothing new [https://gitter.im/crystal-lang/crystal?at=5d17cc7fa8b20942baa866d5]
<FromGitter> <watzon> Looks like right now it's just restructuring how Unions are represented to LLVM
<FromGitter> <Blacksmoke16> yes, another step closer to MT
<FromGitter> <girng> nice ;D
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <mwlang> ugh. *now* same endpoint can return either/or one object or array of objects. Trying to decide how to setup to process and deserialize that!
<FromGitter> <mwlang> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d17db5baa095d404ce1822b]
<FromGitter> <Blacksmoke16> what a shitty api
<FromGitter> <mwlang> So is there the concept of "peeking" on the JSON Puller?
<FromGitter> <Blacksmoke16> nope
<FromGitter> <mwlang> so I can peek and see if it's a begin_array marker?
<FromGitter> <Blacksmoke16> dont think so
<FromGitter> <mwlang> hmm....so best bet is simply attempt to read a begin_array marker and if exception is thrown, process as single object.
<FromGitter> <Blacksmoke16> gross
<FromGitter> <mwlang> I don't think I've ever played so many tricks so quickly with an API implementation.
<FromGitter> <mwlang> looking back at how I utilized Ruby-based version of what I'm rebuilding in Crystal, I pretty much just cheated.
<FromGitter> <mwlang> I would force a response into an Array so it's always an Array with Array(JSON::parse(response.body))
<FromGitter> <mwlang> doing simple hacks like this just doesn't seem to be in crystal's bag of tricks.
<FromGitter> <mwlang> but I digress...time to figure out how to handle this sad puppy.
<FromGitter> <j8r> you could also do a ugly trick, like `content.starts_with? '['` :/
<FromGitter> <tenebrousedge> I'm told that dirty tricks ship
<FromGitter> <j8r> or use `read_array` yes, and catch the exception.
<FromGitter> <asterite> using pull parser, you can check the first token. The pull parser starts with the first token when you create it, so peeking is always on, at least for the next token. Based on that you could parse an array or a single object
alex`` has quit [Ping timeout: 245 seconds]
<FromGitter> <j8r> it reminds me to build a new jsonn pullparser not using tokens
alex`` has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.5]
<FromGitter> <watzon> @Blacksmoke16 you should be proud of me https://github.com/watzon/subnet/blob/master/spec/subnet/ipv4_spec.cr
<FromGitter> <Blacksmoke16> mm look at all them specs
<FromGitter> <watzon> Took forever and a half
<FromGitter> <watzon> But hey, they're passing
<FromGitter> <Blacksmoke16> indeed, now you got coverage for the future :)
<FromGitter> <watzon> Si senor
<FromGitter> <watzon> Well now Crystal has good IPv4 handling at least
<FromGitter> <watzon> I need to add IPv6 support now
<FromGitter> <Blacksmoke16> sounds like a plan
davic has quit [Ping timeout: 245 seconds]
davic has joined #crystal-lang
<FromGitter> <Blacksmoke16> there any blog posts or something on having travis include static binaries on gh releases?
<FromGitter> <Blacksmoke16> hm, that might do it