Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 00:07
    Blacksmoke16 labeled #12783
  • 00:07
    Blacksmoke16 labeled #12783
  • Nov 26 23:55
    carlhoerberg opened #12783
  • Nov 26 11:21
    straight-shoota milestoned #12781
  • Nov 26 11:21
    straight-shoota milestoned #12781
  • Nov 26 02:15
    straight-shoota assigned #11331
  • Nov 25 23:24
    straight-shoota labeled #12782
  • Nov 25 23:24
    straight-shoota labeled #12782
  • Nov 25 23:24
    straight-shoota opened #12782
  • Nov 25 23:17
    straight-shoota labeled #12781
  • Nov 25 23:17
    straight-shoota labeled #12781
  • Nov 25 23:17
    straight-shoota opened #12781
  • Nov 25 23:01
    straight-shoota synchronize #11635
  • Nov 25 22:56
    straight-shoota synchronize #11840
  • Nov 25 22:49
    straight-shoota labeled #12636
  • Nov 25 19:21
    straight-shoota labeled #12780
  • Nov 25 19:21
    straight-shoota labeled #12780
  • Nov 25 19:21
    straight-shoota labeled #12780
  • Nov 25 19:21
    straight-shoota opened #12780
  • Nov 25 19:11
    straight-shoota labeled #12779
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
George Dietrich
@Blacksmoke16
{{ pp "foo".gsub /o/, "x" }}
.underscore?
Paul M. Lambert
@plambert
Wow! Thanks. :)
I never thought to search for that. :)
Paul M. Lambert
@plambert
OK, while I'm here, a question I've had for a while…
I'd love to be able to create a macro that defines a class
But also adds it to a list, and later populate a case statement and an enum
I think this is possible, and if it's possible, it's surely been done... so if anyone has an idea where I might find an example to look at and learn from, I'd love to know!
George Dietrich
@Blacksmoke16
im sure its possible
can you put together a quick playground link of what you want to do and what it should generate?
can prob fill in the blanks from there
Paul M. Lambert
@plambert
playground link?
the play.crystal-lang.org site?
George Dietrich
@Blacksmoke16
yea
Paul M. Lambert
@plambert
This is what I'd like to write: https://play.crystal-lang.org/#/r/d51a