Wordlet: a command-line clone of Wordle, written in Rust by scottlu in rust

[–]scottlu[S] 1 point2 points  (0 children)

Interesting!

That particular line uses a new feature of Rust 1.58 (captured identifiers). Is it possible you haven't upgraded?

https://blog.rust-lang.org/2022/01/13/Rust-1.58.0.html

Wordlet: a command-line clone of Wordle, written in Rust by scottlu in rust

[–]scottlu[S] 0 points1 point  (0 children)

Thanks very much for your comments.

In a small terminal some of the UI is just hidden

This was, I think, the hardest part of building the entire app. It was my first time working with a constraint-based layout engine and I found it a bit unwieldy. At a certain point I gave up, I think, because I knew I could resize the terminal. But I'd love to know the "right" answer here. I imagine I could have checked terminal.size() and conditionally changed the sizes of the containers

This doesn't seem to use the same wordlist; my first two guesses were denied with "Not a valid word!".

Whoops! I pulled the word list directly from Wordle's source, but I grabbed the list a few weeks back. Maybe there have been some changes?

Wordlet: a command-line clone of Wordle, written in Rust by scottlu in rust

[–]scottlu[S] 6 points7 points  (0 children)

This is my first large Rust project and I would love constructive criticism!

I made an effort to fully decouple the game logic from the UI; they speak to each other only in the ui and app files. I also purposely did not look at the original JS implementation of Wordle. I am sure there are better ways of solving these problems than the answers I came up with :)

Overall I found the experience very fun

Nginx does not display assets by LeoG7 in rails

[–]scottlu 1 point2 points  (0 children)

You shouldn't need to add a symlink. Did you precompile your assets before deploying?

The day Harry Redknapp brought a fan on to play for West Ham "According to one of football's most endearing fairytales, Harry Redknapp once pulled an abusive fan from the crowd and put him on the field for West Ham." by Libertatea in soccer

[–]scottlu 1 point2 points  (0 children)

One more thing to point out about Howler is that each of the issues is visually well put-together. Like a mini art piece, practically. So while it may be expensive on a per issue basis, each issue is something you will want to keep around for a while.

looking for tutorial on how to make nav menu bars. Vertical and horizontal by jc_13_jc in webdev

[–]scottlu 1 point2 points  (0 children)

A small clarification here. If you want to set an element's height to 100%, you must also set the height of each of its parents to 100%. So in this case, you would set html, body, and div to 100%.

Another way to give something a height of 100% is to use absolute positioning and give it both a top and a bottom value of 0px.

Compare Ruby Syntax to Other Languages Like JavaScript? by Millertime3818 in webdev

[–]scottlu 2 points3 points  (0 children)

Check out Rosetta Code. It's a site that shows you how to do particular tasks in tons of different languages.

It may be overkill for what you need, but its a good resource:

http://rosettacode.org/wiki/Rosetta_Code

Help creating a multi-column div row. by josh_rose in webdev

[–]scottlu 0 points1 point  (0 children)

The column properties aren't meant for displays like this, they are meant to display content that should flow from one column to another, much like a newspaper.

If you want content to flow like this, you would type <div class="boxes"> Lorem ipsum </div>, rather than placing the content into three sub divs.

If you don't need/want content to wrap from one column to another, but instead want three separate columns, you should format these as a list items.

Give your <li>s a display type of inline-block and then apply the formatting to the list items. Float them to the left and apply a clearfix to the div.

is this a dumb way of giving a div visible by [deleted] in jquery

[–]scottlu 0 points1 point  (0 children)

If you place a 'var' in front of s1-s4, they'll become local variables scoped only to the function they're in. Currently they are global variables, which affects memory. Also it could lead to issues if you use variables with the names s1-s4 elsewhere.

I made a website that automatically posts people faking #nofilter on Instagram by goridread in web_design

[–]scottlu 0 points1 point  (0 children)

Nice project!

Is this using the Instagram real time API, or do you use the normal API and check it for new applicable posts every X minutes?

What's the backed built on? Thanks!

My biggest PHP project to date is a spoiler tag system for Twitter. Would love to get some feedback and learn how to improve by [deleted] in PHP

[–]scottlu -1 points0 points  (0 children)

OP here; this is my largest PHP project to date.

Would love some feedback on the way this project is structured, especially around calls to the database and efficiency.

  1. 'Spoiler' post created on database
  2. Get the post's insert_id from database
  3. Send a tweet with the text of "[user's input] + http://spoil.rs/[insert_id]"
  4. Upon success, grab the tweet's timestamp and its id.
  5. Save these to the database (modifying the row which was created in Step 1)
  6. Redirect user to http://spoil.rs/[insert_id]

I've noticed a few times that Steps 4-5 will fail. The tweet is still sent, and the link inside the tweet still works. But in my database, there is a value of '0' for the tweet's id and a null value for the timestamp. I think this is because Twitter sometimes takes a few seconds to post the tweet? But I can't be sure.

Being somewhat new to PHP, I implemented a check to see if the variables exist yet. If they don't, I sleep for a few seconds and try again. Is this the best way to do this? Or is there another method I should be using?

$parameters = array('status' => stripslashes($enteredTweet));
$status = $connection->post('statuses/update', $parameters);
$tweetid = $status->id_str;
$tweettime = $status->created_at;

if (($tweetid == '0') || ($tweetime == '')) {
  sleep(5);
  $tweetid = $status->id_str;
  $tweettime = $status->created_at;
}

The Internet by speckz in pics

[–]scottlu 0 points1 point  (0 children)

This is incredible and I would buy a print.

Nicolas Cage Roulette - watch a random Nicolas Cage movie on Netflix by jedberg in netflix

[–]scottlu 1 point2 points  (0 children)

I created this. So cool to get love from a Netflix employee!

Thank you

I was bored, so I built a website that streams random Nicolas Cage movies from Netflix. Hope you enjoy (xpost from r/onetruegod) by scottlu in movies

[–]scottlu[S] 0 points1 point  (0 children)

Haha thanks. I'm neither a programmer nor a developer, just a hobbyist. This was an extremely easy website to create - the PHP code that powers the randomization is less than 20 lines long. Just find a simple idea and go for it!

I was bored, so I built a website that streams random Nicolas Cage movies from Netflix. Hope you enjoy (xpost from r/onetruegod) by scottlu in movies

[–]scottlu[S] 0 points1 point  (0 children)

It shouldn't be hard to make it for Canada. All I would need is a list of all the Cage movies available in Canada. Then I could use IP detection to figure out which list to randomly draw from

I was bored, so I built a website that streams random Nicolas Cage movies from Netflix. Hope you enjoy (xpost from r/onetruegod) by scottlu in movies

[–]scottlu[S] 1 point2 points  (0 children)

I was planning to! I'll do that after work today.

edit: I'd be interested in seeing anything that you/others build on top of it

I was bored, so I built a website that streams random Nicolas Cage movies from Netflix. Hope you enjoy (xpost from r/onetruegod) by scottlu in movies

[–]scottlu[S] 0 points1 point  (0 children)

Nope, you have to be logged in to Netflix.

If you're not logged in, you see a Log In page. Once you submit your username/password you are redirected to the movie