Skip to content

Instantly share code, notes, and snippets.

View rhyseda's full-sized avatar

Rhys Portegys rhyseda

  • Wellington, New Zealand
View GitHub Profile
@rhyseda
rhyseda / argv_test.rb
Last active August 29, 2015 14:22
ARGV clear
class MyTest
attr_reader :cl_arguments
def initialize
@cl_arguments = ARGV.clone
end
def display
puts "Displaying the ARGV array"

Ruby Array, Hash, and Enumerable methods

What is this?

This is a list of methods from Ruby's Array, Hash, and Enumerable that I find useful and have used a lot. It is by no means an complete list so just think of it as a starting point. (BTW, Enumerable is a mixin and not a class but both Array and Hash include it they both have Enumerable methods avaliable to them.)

In preperation for this week and the upcoming week make sure you are understand how to sort and filter each of these data structures. Read the documentation on these methods and play with them in IRB.

@rhyseda
rhyseda / credit_card.rb
Last active August 29, 2015 14:20
Week 7
# Refactoring for Code Readability
# Original Solution
# Validate a Credit Card Number
# Your Solution
# Don't forget to check on initialization for a card length
@rhyseda
rhyseda / accountability_group_creator
Last active August 29, 2015 14:19
Second solution for Accountability Group Creator!
students = %w(one two three four five six seven eight nine ten eleven twelve)
students = %w(abe betty charlie dani ethan francis george helen ian
jenna ken lisa mike nicki oscar paula)
loopy = 0
counter = 1
accountablity_groups = Hash.new{|hash,key| hash[key] = [] }
loopy = students.length/4
@rhyseda
rhyseda / 0_reuse_code.js
Last active August 29, 2015 14:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console