Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added About Me #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added About Me #15

wants to merge 2 commits into from

Conversation

pdai1y
Copy link

@pdai1y pdai1y commented Apr 26, 2014

I kinda gutted the core of the app to stick within what you wanted us to do.. Will probably come back to this once I get to Choose Your Own Adventure and try that out.

http://fast-beyond-3125.herokuapp.com/

@@ -5,14 +5,9 @@
enable :sessions

get '/' do
@title = "Patrick Irwin"
likes = ["Turtles", "Cake", "Puppies", "Ruby", "Archer (The Cartoon)", "PC Games", "Stuff", "Apples", "Programming"]
@random_likes = likes[rand(likes.length)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some ruby coolness. Try

@random_likes = likes.sample

That'll return 1 random item, which is generally what you want. It won't be an array, so you may need to update that in the view.

And, to randomly sort an array, use .shuffle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants