# Fcc Random Quote Machine

**URL:** <https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485>\
**Category:** I Built This\
**Created:** [August 29, 2017, 6:27am UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485 "2017-08-29T06:27:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrphemi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mrphemi/32/44392_2.png) [@mrphemi](https://forum.freecodecamp.org/u/mrphemi)\
**Post date:** [August 29, 2017, 6:27am UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485/1 "2017-08-29T06:27:41Z")

</div>

> **[Fcc Random Quote Machine](https://codepen.io/Mrphemi/pen/oeEPGB)**
>
> ...

Hey guys, here is my random quote machine. Feedback will be appreciated thanks. Cheers!!

---

<div class="post-metadata">

**Author:** ![vicbergquist](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/vicbergquist/32/39570_2.png) [@vicbergquist](https://forum.freecodecamp.org/u/vicbergquist)\
**Post date:** [August 29, 2017, 7:56am UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485/2 "2017-08-29T07:56:44Z")

</div>

Congratulations on finishing your quote machine, great work!  
I find it hard to read your text with a font like that, but maybe that’s just me.  
I see you have a tweet button in your code, but it’s not showing up… Maybe look into that!

Good luck with your next project!

Cheers,  
Victoria

---

<div class="post-metadata">

**Author:** ![mrphemi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mrphemi/32/44392_2.png) [@mrphemi](https://forum.freecodecamp.org/u/mrphemi)\
**Post date:** [August 30, 2017, 9:29pm UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485/3 "2017-08-30T21:29:02Z")

</div>

Thanks for the feedback, will work on the tweet button. Cheers!!!

---

<div class="post-metadata">

**Author:** ![drregg6](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/drregg6/32/17093_2.png) [@drregg6](https://forum.freecodecamp.org/u/drregg6)\
**Post date:** [August 30, 2017, 11:54pm UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485/4 "2017-08-30T23:54:58Z")

</div>

For some reason I thought that one of the user stories was if the tweet is longer than 140 characters, reduce the length and add “…” at the end. In any case, I think that that would be a nice touch for user interaction. Or if it fits in the tweet, add the author’s name.

Honestly I’m just nitpicking to give you something to practice with because your Random Quote design and execution is great. It’s responsive and well done!

---

<div class="post-metadata">

**Author:** ![mrphemi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/mrphemi/32/44392_2.png) [@mrphemi](https://forum.freecodecamp.org/u/mrphemi)\
**Post date:** [August 31, 2017, 3:56am UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485/5 "2017-08-31T03:56:51Z")

</div>

Thanks for the feedback, will definitely work on the tweet issue. cheers!!

---

<div class="post-metadata">

**Author:** ![lionel-rowe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lionel-rowe/32/41877_2.png) [@lionel-rowe](https://forum.freecodecamp.org/u/lionel-rowe)\
**Post date:** [August 31, 2017, 12:16pm UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485/6 "2017-08-31T12:16:46Z")

</div>

> [@drregg6](#):
>
> In any case, I think that that would be a nice touch for user interaction. Or if it fits in the tweet, add the author’s name.

Good for practicing writing algorithms, but thinking about UX, it’s unlikely the user would want the quotes truncated in a “dumb” way. That way you’d often lose the main point of the quote. It’d be better to let the user trim the quote as they see fit (e.g. removing non-content words like “the”).

Even better, you could have a more elegant solution that:

- Generates a permalink to that quote displayed on your page using a query string (going to the URL with that query string would display that specific quote rather than a random one)
- Shortens the URL+query string with a URL shortening API. I’m not sure what’s available in this regard; it’s possible you can do it with Twitter’s own URL shortener
- Gets the length of the author’s name
- Adds some syntactical padding before the author’s name (e.g. ellipsis … for truncation plus an em dash —)
- Subtracts the length of authors name + padding + shortened URL from 140 and truncates the quote to that length
- Puts all of that info in the Twitter URL string, ready to post

I _think_ all of this should be doable without a back end. Might try making a proof of concept later.

---

<div class="post-metadata">

**Author:** ![drregg6](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/drregg6/32/17093_2.png) [@drregg6](https://forum.freecodecamp.org/u/drregg6)\
**Post date:** [August 31, 2017, 1:09pm UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485/7 "2017-08-31T13:09:23Z")

</div>

Ah-haaaa! That sounds even better and something I’d like to try myself, thanks! 🙂

---

<div class="post-metadata">

**Author:** ![lionel-rowe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lionel-rowe/32/41877_2.png) [@lionel-rowe](https://forum.freecodecamp.org/u/lionel-rowe)\
**Post date:** [September 1, 2017, 5:03pm UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485/8 "2017-09-01T17:03:10Z")

</div>

OK, added the functionality to my random quote generator. It works! With one caveat: I wasn’t able to find a URL shortener API that doesn’t require an API key (which you’d need a back end to keep hidden).

It turned out it wasn’t a problem, though: Twitter automatically treats all URLs as 23 characters when calculating tweet lengths, then converts them to `https://t.co/` links when you send the tweet.

I was originally gonna write up my findings on here, but in the end it turned into a whole [blog post](https://medium.com/@lionel.rowe/things-i-learned-from-truncating-tweets-f068a1239a51).

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 2:28pm UTC](https://forum.freecodecamp.org/t/fcc-random-quote-machine/144485/9 "2021-06-01T14:28:55Z")

</div>

Closed on June 1, 2021, 2:28pm UTC


