Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 04 22:42
    straight-shoota closed #12800
  • Dec 04 22:41
    straight-shoota edited #12800
  • Dec 04 22:41
    straight-shoota closed #12770
  • Dec 04 22:41
    straight-shoota closed #12773
  • Dec 04 20:38
    straight-shoota closed #12819
  • Dec 04 17:58
    HertzDevil synchronize #12784
  • Dec 04 15:51
    Blacksmoke16 review_requested #10648
  • Dec 04 15:50
    Blacksmoke16 synchronize #10648
  • Dec 04 15:48
    Blacksmoke16 synchronize #10648
  • Dec 04 15:00
    Blacksmoke16 closed #12820
  • Dec 04 11:38
    straight-shoota closed #12807
  • Dec 04 11:38
    straight-shoota closed #12808
  • Dec 04 11:38
    straight-shoota closed #12816
  • Dec 04 00:00
    douglascamata closed #12820
  • Dec 03 23:10
    Blacksmoke16 closed #12821
  • Dec 03 23:10
    Blacksmoke16 labeled #12821
  • Dec 03 23:09
    Blacksmoke16 labeled #12821
  • Dec 03 22:13
    hutou labeled #12821
  • Dec 03 22:13
    hutou opened #12821
  • Dec 03 22:01
    douglascamata edited #12820
From IRC (bridge bot)
@FromIRC
<frojnd> I see
<frojnd> I have to use typeof more often in this lerning proccess
<frojnd> Thank you oprypin
From IRC (bridge bot)
@FromIRC
<Sankalp> Hi #crystal-lang
George Dietrich
@Blacksmoke16
o/
From IRC (bridge bot)
@FromIRC
<Sankalp> Set{1,2,3}.map(...) returns an Array
<Sankalp> Is this expected?
George Dietrich
@Blacksmoke16
i think so
could call .to_set on it
From IRC (bridge bot)
@FromIRC
<Sankalp> True
George Dietrich
@Blacksmoke16

https://crystal-lang.org/api/1.4.1/Enumerable.html

Note that most search and filter methods traverse an Enumerable eagerly, producing an Array as the result. For a lazy alternative refer to the Iterator and Iterable modules.

From IRC (bridge bot)
@FromIRC
<Sankalp> Ahh.. I see.
<Sankalp> Thank you, Blacksmoke16!
Kirill Zvonov
@kzvonov
Hey guys! I've a problem installing Crystal on my M1 Pro Chip inside a docker container. To be precise (1) I have M1 Pro chip (2) I have a container with ruby powered by Debian 11 (3) I'm trying to run this script RUN curl -fsSL https://crystal-lang.org/install.sh | bash
I suppose I can compile it from the source code, but are there any guides about it?
From IRC (bridge bot)
@FromIRC
<Sankalp> There's a guide on how to install it on a debian system https://crystal-lang.org/install/on_debian/
Kirill Zvonov
@kzvonov
Yep, there's, but it doesn't work for Mac M1 Pro Chip when you are installing crystal in a Docker container
(1) % docker run --rm -it debian bash
(2) apt update && apt install curl
(3) curl -fsSL https://crystal-lang.org/install.sh | bash
(4) crystal -> bash: crystal: command not found
It doesn't work
From IRC (bridge bot)
@FromIRC
<frojnd> @kzvonov what does the output say after you run curl ... command ?
<frojnd> @kzvanov also add dpkg -l |grep crystal to docker and see the output
Kirill Zvonov
@kzvonov
dpkg -l |grep crystal
ii  crystal1.2-docs                    1.2.2-1+1.103                  all          Documentation for the Crystal Programming Language
ii  crystal1.2-samples                 1.2.2-1+1.103                  all          Sample code for the Crystal Programming Language
@FromIRC frojnd thanks for helping
From IRC (bridge bot)
@FromIRC
@kzvonov, I'm a bot, bleep, bloop. I relay messages between IRC (#crystal-lang on irc.libera.chat) and here
<frojnd> @kzvanov can you also paste the output of: curl -fsSL https://crystal-lang.org/install.sh | bash
From IRC (bridge bot)
@FromIRC
<frojnd> Maybe because you are on arm?
Kirill Zvonov
@kzvonov
any suggestions?
From IRC (bridge bot)
@FromIRC
<frojnd> I know there were some experimenting with arm but more on https://forum.crystal-lang.org https://forum.crystal-lang.org/t/docker-images-for-arm-rpi/1105/6?
Kirill Zvonov
@kzvonov
Thanks!
George Dietrich
@Blacksmoke16
Paul M. Lambert
@plambert
Dumb, quick question: anyone know of a relatively loose date/time string parser that allows a whole lot of common patterns? Like 2022-05-02 06:07:08 and 5/2/2022 6pm and such?
Not looking for anything perfect, just to allow CLI users the chance to use whatever format they try first...
moe
@moe:busyloop.net
[m]
didn't find one when i last looked
shouldn't be too hard to port one of the ruby ones tho, if you're so inclined. e.g. https://github.com/mojombo/chronic
From IRC (bridge bot)
@FromIRC
<wwalker> Looking for an ORM recommendation. I did some looking and ended up at Granite, but it's README starts with "Looking for Maintainers"... I only need the simplest of ORMs, but with sqlite support. I might not even need an ORM.
George Dietrich
@Blacksmoke16
https://crystal-lang.github.io/crystal-db/api/0.11.0/DB/Serializable.html works quite well. You would need to handle insert/updates yourself. But that can be fairly easily abstracted into a method
Ali Naqvi
@naqvis

Dumb, quick question: anyone know of a relatively loose date/time string parser that allows a whole lot of common patterns? Like 2022-05-02 06:07:08 and 5/2/2022 6pm and such?

you can use Time::Format with some extra cleanup to try parse String to Time
https://carc.in/#/r/d4wj

Paul M. Lambert
@plambert

Dumb, quick question: anyone know of a relatively loose date/time string parser that allows a whole lot of common patterns? Like 2022-05-02 06:07:08 and 5/2/2022 6pm and such?

you can use Time::Format with some extra cleanup to try parse String to Time
https://carc.in/#/r/d4wj

Wow, thank you, that's a great start!

From IRC (bridge bot)
@FromIRC
<wwalker> if I have multiple source files to build a single binary, what does my shard.yml targets section look like?
George Dietrich
@Blacksmoke16
youd prob require all the required files within 1 file and use that as your target in shard.yml
From IRC (bridge bot)
@FromIRC
<wwalker> Every example I see has main: src/main.cr
George Dietrich
@Blacksmoke16
i.e. you dont specify all your source files as targets
From IRC (bridge bot)
@FromIRC
<wwalker> @Blacksmoke16: thank you.
George Dietrich
@Blacksmoke16
yea, look in that file and you'll see like:
require "..."
require "..."
...
Paul M. Lambert
@plambert
Can I do string manipulation inside a macro?
For example, the equivalent of "foo".gsub(/o/) {|m| "x"}
George Dietrich
@Blacksmoke16
yes, but depends on what exactly you want to do id say, as it only has a subset of the API
Paul M. Lambert
@plambert
Specifically, I am defining classes, and want to define methods with the class names changed from FooBarBaz to foo_bar_baz