We're waiting to show off your Ruby creativity.

programming
Write one function that is useful for you and others

How many times you have been looking for a function that does one thing and you end up using a gem just for one function?
Here we'll fix that, consider rubyfunctions.com is your repository for useful functions, you can get back to it any time

bibliophile
Depend on Ruby standard library and core library only

We all have seen the problem with too many dependencies, here we'll try to be as minimal as we can, we'll build off of ruby core and standard library only, making our functions as independent as possible, this means you'll be able to use it any project regardless of its framework

public discussion
Show it to others and get feedback

Now that you have a useful repository of functions you have wrote, show it to other developers, your function maybe useful for other people, Also you will get feedback from other developers to improve your knowledge, And you'll have the chance to also give feedback to others and learn something new from their functions

thread_pool

Ahmed Khaled · @nemoload · about 1 year

Creates a thread pool that takes a block and run it in parallel with different jobs and returns a list of the results

0 · 0 · 0 Show code

swag

Ahmed Khaled · @nemoload · over 2 years

Takes a text and returnstExT

1 · 1 · 0 Show code

reduce

taman9333 · @taman9333 · over 2 years

Functional way for implementing reduce.

it invokes function for each element in the enumerable with the accumulator.

1 · 0 · 0 Show code

compress_str

ahmadabdelhalim · @ahmadabdelhalim · over 2 years

a function that accepts a string as an argument, and returns a new string where streaks of consecutive characters are compressed. For example “aaabbc” is compressed to “3a2bc”.

2 · 1 · 0 Show code

floyd_warshall

Ali Hamdi Ali Fadel · @AliOsm · over 2 years

Floyd-Warshall (all pairs shortest path) algorithm implementation.

0 · 3 · 1 Show code

fib_with_memoizing

Ahmed Khaled · @nemoload · over 2 years

Calculating the n-th number in Fibonacci sequence with dynamic programming.

4 · 1 · 1 Show code

coprime?

Ali Hamdi Ali Fadel · @AliOsm · over 2 years

Return true if two number are relatively prime (co-prime), false otherwise.

1 · 0 · 0 Show code

crawl_and_extract_urls

Ali Hamdi Ali Fadel · @AliOsm · over 2 years

Crawl a web page and extract URLs from its HTML using naive loop implementation. Its running time is comparable or less than using URI.extract().

2 · 0 · 1 Show code

n_choose_k

Ali Hamdi Ali Fadel · @AliOsm · over 2 years

Calculates N choose K, N! / (K! * (N - K)!), in a mathematical operations efficient way.

1 · 0 · 1 Show code

nth_catalan

Ali Hamdi Ali Fadel · @AliOsm · over 2 years

Calculates the n-th Catalan number, (2N)! / (N! * (N + 1)!), in a mathematical operations efficient way.

0 · 0 · 2 Show code

recursive_nth_fibonacci

Ahmed Magdy · @a7madM · over 2 years

calculates nth fibonacci recursively

1 · 0 · 1 Show code

nth_fibonacci

Ali Hamdi Ali Fadel · @AliOsm · over 2 years

Calculates the n-th Fibonacci number iteratively.

0 · 0 · 0 Show code

recursive_factorial

Ahmed Magdy · @a7madM · over 2 years

calculates factorial of a number recursively

1 · 2 · 0 Show code

Iterative_factorial

Abd Elrahman Telb · @abdoutelb · over 2 years

Take a number and return the its factorial in Iterative way.

3 · 0 · 0 Show code

palindrome?

Ali Hamdi Ali Fadel · @AliOsm · over 2 years

Takes a string and return true if it is a palindrome, false otherwise.

0 · 3 · 0 Show code

thread_pool

Emad Elsaid · @emad-elsaid · over 2 years

This function takes an array of objects and executes a method in each object in parallel in multiple threads

4 · 0 · 3 Show code
Your next adventures
project completed Lets start our journey in ruby functions. The following steps should help your get started.
  • Login with your Github account
  • Publish your first function
  • Like at least 5 functions
  • Write at least 5 comments
  • Save at least 5 functions
  • Publish 10 functions