Live data from Hacker News

A command-line weather app built using Elixir

github.com

51–60 of 67 posts

Re: A command-line weather app built using Elixir

#52

I'm excited about this not because I want to use it, but because it is a great example of an Elixir app. I'm in the process of learning Elixir, and it was cool to see someone else's code and be able to make sense of most of it. Thanks for posting this!

I don't know Elixir, but it does some questionable things. For instance, it appears to read and process the entire ascii_chars.txt file for each character in the output. It's not a big file, but it wouldn't be difficult to read it once.

I thought of that but for a starter I didn't want to optimise too much. But still it's a good suggestion and I will apply "boy scout rule" for sure!

Re: A command-line weather app built using Elixir

#53

I'm excited about this not because I want to use it, but because it is a great example of an Elixir app. I'm in the process of learning Elixir, and it was cool to see someone else's code and be able to make sense of most of it. Thanks for posting this!

I know :). I am learning Elixir as well! Glad that you liked it :)

Re: A command-line weather app built using Elixir

#54
post #9
post #4

Another ASCII art weather (forecast) utility, but in Go: https://github.com/schachmat/wego

This is much much better. Closer to "beautiful" than the one featured here.

Yeah, it's beautiful if

1) you think mutable variables are beautiful

2) you think stuffing everything into one file is beautiful

3) you think defining functions at the root namespace is beautiful

4) you think consecutive repeated property accesses stuffed into a consecutively repeating boolean check like this are beautiful: if h.Time == "0" || h.Time == "100" || h.Time == "200" || h.Time == "300" || h.Time == "400" || h.Time == "500" || h.Time == "600" || h.Time == "700" || h.Time == "1400" || h.Time == "1500" || h.Time == "1600" || h.Time == "2300"

5) if you think embedding ANSI color codes across all strings instead of centralizing all that ugliness somewhere is beautiful

6) if you think not separating your command-line-handling code from your problem-modeling code is beautiful (see: Hexagonal Architecture http://alistair.cockburn.us/Hexagonal+architecture)

7) If you think having no fucking test suite to speak of, given all that mangled mutating code is beautiful (to me this is the MOST egregious non-beautiful thing in the entire "project")

Then, yes. WeGo is beautiful.

Frankly I'm shocked that what people call "beautiful" can differ that fucking much.

Re: A command-line weather app built using Elixir

#56
post #37

Ya know, I was just thinking about doing something like this just a couple of days ago, but instead I wrote a python script to get the weather from forecast.io api, then brought that into my tmux status bar.

That's great! would be nice if yo could share the source as well.

Re: A command-line weather app built using Elixir

#57
post #27

function weather(){curl -s "http://api.openweathermap.org/data/2.5/weather?q=$1&units=metric" | jq .main.temp | figlet -kcf big} $ weather london __ _ _ ___ _____ /_ || || | |__ \ | ____| | || || |_ ) || |__ | ||__ _| / / |___ \ | | | | _ / /_ ___) | |_| |_|(_)|____||____/

May be you should post a gist. The line is getting truncated.

Re: A command-line weather app built using Elixir

#58

Earlier quoted context omitted.

I am sorry for that. It was a hobby project of mine when learning Elixir and I got excited about it.

I've got nothing against it. it's a fun little hobby app, but yeah, I've got to agree with the commenter above this is FAR from any standard definition of a "beautiful" app.

I admit that :)

Re: A command-line weather app built using Elixir

#59
post #27

function weather(){curl -s "http://api.openweathermap.org/data/2.5/weather?q=$1&units=metric" | jq .main.temp | figlet -kcf big} $ weather london __ _ _ ___ _____ /_ || || | |__ \ | ____| | || || |_ ) || |__ | ||__ _| / / |___ \ | | | | _ / /_ ___) | |_| |_|(_)|____||____/

May be you should post a gist. The line is getting truncated.

It should scroll horizontally.

Re: A command-line weather app built using Elixir

#60
post #41
post #27

function weather(){curl -s "http://api.openweathermap.org/data/2.5/weather?q=$1&units=metric" | jq .main.temp | figlet -kcf big} $ weather london __ _ _ ___ _____ /_ || || | |__ \ | ____| | || || |_ ) || |__ | ||__ _| / / |___ \ | | | | _ / /_ ___) | |_| |_|(_)|____||____/

Perhaps I'm a bash noob, but when I try to paste that in my shell, it complains about a syntax error near `{curl`. Am I doing something wrong?

I wrote this in zsh. It seems in bash you need to add a space before the bracket
Post reply on HN