This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flatten(arr) { | |
var flattenedArr = []; | |
arr.forEach(function(nestedArr) { | |
// if the array has nested elements, proceed | |
if (nestedArr.length > 0) { | |
nestedArr.forEach(function(elem) { | |
// check if elem is already present in flattenedArr | |
if (!testNumberAndNumberAsString(elem, flattenedArr)) { | |
// if not, push it to the flattened array | |
flattenedArr.push(elem); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
class Card | |
attr_accessor :suit, :face | |
SUITS = %w(Hearts Clubs Spades Diamonds).freeze | |
FACES = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace'].freeze | |
def initialize(suit, face) | |
@suit = suit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
class Card | |
attr_accessor :suit, :face | |
SUITS = %w(Hearts Clubs Spades Diamonds).freeze | |
FACES = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace'].freeze | |
def initialize(suit, face) | |
@suit = suit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this script gets the addresses pairs from a csv file and queries the google maps api for walking directions | |
# | |
# require csv | |
require 'uri' | |
require 'csv' | |
require 'nokogiri' | |
require 'net/https' | |
require 'open-uri' | |
# initialize arrays |