/rubyfunctions

Like Rubygems.org but for Ruby functions

Primary LanguageRuby

RUBY FUNCTIONS

View performance data on Skylight View performance data on Skylight View performance data on Skylight View performance data on Skylight codecov DeepSource

Here is the challenge:

  1. Write a useful Ruby function
  2. Depends only on Ruby core and standard lib

This is a web application to have a community around this idea, We participate and share these functions to learn from each other and use it if we need to.

Why?

  1. It would be nice if you're looking for a function that validate URL/Email for example and you get to a website just to get this function, no external libraries needed, just the function use it.
  2. Show your creativity using just ruby to deliver something useful, how far can you get with just that?
  3. We can learn a lot from each other just by sharing useful functions we write.
  4. You get fast feedback on a small snippet of code.

Prerequisite

  1. Ruby 2.6.3
  2. Yarn
  3. Postgres server

Documentation you'll needed

  1. Ruby docs https://devdocs.io/ruby~2.5/
  2. Rails docs https://devdocs.io/rails~6.0/
  3. Bulma documentation https://bulma.io/documentation/
  4. Font awesome icons list https://fontawesome.com/icons
  5. Undraw illustrations (brand color: #3273dc) https://undraw.co/

Setting up the project

  1. cd to src
  2. Create a github application for github login feature from here and set the callback URL to http://localhost:3000/github/new
  3. Copy .env.sample to .env and fill in the non-production variables and remove the rest.
  4. Make sure the variables in .env file is loaded to your shell, you can use autoenv for that
  5. Run rails db:setup
  6. Make sure rspec passes
  7. Run the server with rails s
  8. Have fun developing your feature

Using Docker

  1. Create a github application for github login feature from here and set the callback URL to http://localhost:3000/github/new
  2. Copy src/.env.sample to src/.env and fill in the non-production variables and remove the rest.
  3. Get a shell inside the web service container using docker-compose docker-compose -f docker-compose-dev.yml run -p 3000:3000 web bash
  4. Run rails db:setup
  5. Make sure rspec passes
  6. Run the server with rails s -b 0.0.0.0
  7. Have run developing your feature

Things the project is trying to avoid

  1. Having unncessary dependencies
  2. Javascript
  3. Saving user emails or access tokens
  4. Uploading files

How to contibute

  1. Fork this repo
  2. Clone the fork to your machine
  3. Open an issue with the your idea and how you're gonna solve it
  4. Agree on a final solution to your idea and start implementing it
  5. Create a new branch and commit your changes
  6. Open a pull request linking to the issue

Quality guidelines

  1. Write good and readable tests
  2. Make sure existing specs passes with rspec command
  3. Make sure rubocop passes with rubocop command
  4. Try to be as minimal as possible