Skip to content

Instantly share code, notes, and snippets.

View shaunjacobsen's full-sized avatar
🙄

Shaun Jacobsen shaunjacobsen

🙄
View GitHub Profile
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);
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
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
@shaunjacobsen
shaunjacobsen / getTimes.rb
Last active January 10, 2016 16:04
Gets the walking distance between two points and logs to file
# 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