Skip to content

Instantly share code, notes, and snippets.

View igmarin's full-sized avatar
🏠
Working from home

Ismael Marin igmarin

🏠
Working from home
View GitHub Profile
require 'minitest/autorun'
require 'minitest/pride'
# Will return a single code and code set if one exists in the code sets that are
# passed in. Returns a hash with a key of code and code_set if found, nil otherwise
def preferred_code(preferred_code_sets, codes_attribute=:codes, value_set_map=nil)
codes_value = send(codes_attribute)
preferred_code_sets = value_set_map ? (preferred_code_sets & value_set_map.collect{|cs| cs["set"]}) : preferred_code_sets
matching_code_sets = preferred_code_sets & codes_value.keys
#if matching_code_sets.present? <= present is only used in rails empty? is the ruby version of present?
@igmarin
igmarin / first_exercise.js
Last active August 29, 2015 13:56
first_exercise.js
//my variables to test
var preferred_code_sets = ['set', 'first', 'code', 'a'];
var codes_attribute = {'set': 1, 'dos': 3, 'a': 4};
function codes_attribute(){
{'set': 1, 'dos': 3, 'a': 4};
}
function preferred_code(preferred_code_sets, codes_attribute, value_set_map=null){
var code_value = function(code_attributes){try {