Instantly share code, notes, and snippets.

# Awokoya EmmanuelEmmaAkin

• Sort options
Created Sep 28, 2016
View SquareRoot_fast.rb
 puts "Enter a number to find the square" number = gets.chomp.to_i puts "Enter the accepted error" error = gets.chomp.to_i def abs(firstNum,secNum) if firstNum>secNum firstNum-secNum
Last active Sep 29, 2016
This is a ruby code that check if the number you typed is a prime using the fastest method ever. Hint! Use square root algorithm
View isPrime.rb
 puts "Enter a number to to check" number = gets.chomp.to_i def abs(firstNum,secNum) if firstNum > secNum firstNum - secNum else secNum - firstNum
Last active Sep 29, 2016
Find the product of the elements in an Array without the element itself. [1,2,3], newArray = [6,3,2]
View product_of_array.rb
 def product_of_elements_array(a) i = 0 prod = 1 while i <= (a.length-1) prod = prod * a[i] i+=1 end prod end
Last active Oct 1, 2016
This contains a function that finds the intersecting vertices of two rectangles given the rectangles vertices as two arrays. The arrays are given such that the two first elements are the coordinate of the base point of the rectangle, while the third element is the breath and the last element is the height of the rectangle. Example a=[1,1,2,3] x=…
View intersecting_rec..rb
 #The function find the intersection point of two lines def intersect_rec(a, b) #Function takes the coordinate of horizontal and vertical line #Return the coordinate of the intersection intersect = [] if a.length !=4 and b.length !=4 return "You did not enter a rectangle vertices" end x1 = a[0] x2 = a[0]+a[2] y1 = a[1]
Last active Nov 29, 2017
How to add a new user on your Ubuntu Digital Ocean Droplet from a Git Bash Windows System

# Adding a user to the System to allow control over the www.data (Web directory of your new droplet)

#############################################################

⋅⋅1. Log in to your server as the `root` user

```````local\$ ssh root@server_ip address e.g ssh root@204.55.34.84`
``````
Last active Nov 28, 2017
Setup and Test SSH Authentication from Scratch Git Bash on Windows 7
View git_bash_ssh_auth_win_setup.md

# Setup SSH Authentication using GIT BASH on Windows

######################################################

This set is broken down into