Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am souldjinn on github.
  • I am ziadabdo (https://keybase.io/ziadabdo) on keybase.
  • I have a public key whose fingerprint is 120A 2E8C 80F5 A878 49D1 23EF E900 7CD8 A445 78C8

To claim this, I am signing this object:

@ziad-abdo
ziad-abdo / can_can_ruby_gem.md
Last active August 29, 2015 14:02
Review of Cancan rubygem

#CanCan: Authorization Library *The cancan gem helps with restriction of user resources.

#CanCan: Steps

  1. Generate a class called Ability, that inherits from cancan. * There is a rails generate command for this(which im assuming is implemented when you install the gem) rails g cancan:ability
  2. The ability class is the location where all the permissions are defined.
  3. By passing the user model through the ability initialization, a developer can use the can method to generate permissions. The github page for cancan has a list of different permissions, custom and
# def parse_text(file_location)
# File.open(file_location).each do |line|
# puts line
# end
# end
# parse_text('word_list.txt')
#parsed_array = parse_text('word_list.txt')
#########################################################################################
@ziad-abdo
ziad-abdo / find_prime.rb
Last active August 29, 2015 14:00
first 1001 primes
def all_primes
prime_array= []
counter = 1
until prime_array.length == 10001
if is_prime?(counter)
prime_array << counter
end
counter +=1
end
return prime_array
@ziad-abdo
ziad-abdo / 0.2.1-boggle_class_from_methods.rb
Last active August 29, 2015 13:56 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1boggle class challenge
#####I've tried several times to edit this gist so that the indentation is correct, but everytime I get it right
#####after hitting update gist it simply returns the indentation to this exaggerated form. I dont know what to do about it.
class BoggleBoard
def initialize(user_grid)
user_grid.each do |array|
raise ArgumentError.new("User grid is not a 4x4 grid") if array.length != 4
end
@game_grid = user_grid
end