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 'csv' | |
class Dinosaur | |
attr_reader :name, :period, :continent, :diet, :weight, :locomotion, | |
:description | |
def initialize(name, period, continent, diet, weight, locomotion, description) | |
@name = name | |
@period = period | |
@continent = continent |
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
[#<Dinosaur:0x00000000d86120 @name="Albertosaurus", @period="Late Cretaceous", @continent="North America", @diet="Carnivore", @weight=2000, @locomotion="Biped", @description="Like a T-Rex but smaller.">, #<Dinosaur:0x00000000d848e8 @name="Albertonykus", @period="Early Cretaceous", @continent="North America", @diet="Insectivore", @weight=nil, @locomotion="Biped", @description="Earliest known Alvarezsaurid.">, #<Dinosaur:0x00000000d7eb00 @name="Baryonyx", @period="Early Cretaceous", @continent="Europe", @diet="Piscivore", @weight=6000, @locomotion="Biped", @description="One of the only known dinosaurs with a fish-only diet.">, #<Dinosaur:0x00000000d7d250 @name="Deinonychus", @period="Early Cretaceous", @continent="North America", @diet="Carnivore", @weight=150, @locomotion="Biped", @description=nil>, #<Dinosaur:0x00000000d7a0f0 @name="Megalosaurus", @period="Jurassic", @continent="Europe", @diet="Carnivore", @weight=2200, @locomotion="Biped", @description="Originally thought to be a Quadruped. First dinosaur to |
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 'csv' | |
class Dinosaur | |
attr_reader :name, :period, :continent, :diet, :weight, :locomotion, | |
:description | |
def initialize(name, period, continent, diet, weight, locomotion, description) | |
@name = name | |
@period = period | |
@continent = continent |
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 'csv' | |
class Dinosaur | |
attr_reader :name, :period, :continent, :diet, :weight, :locomotion, | |
:description | |
def initialize(name, period, continent, diet, weight, locomotion, description) | |
@name = name | |
@period = period | |
@continent = continent |
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 'csv' | |
class Dinosaur | |
attr_reader :name, :period, :continent, :diet, :weight, :locomotion, | |
:description | |
def initialize(name, period, continent, diet, weight, locomotion, description) | |
@name = name | |
@period = period | |
@continent = continent |
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 'csv' | |
class Dinosaur | |
attr_reader :name, :period, :continent, :diet, :weight, :locomotion, | |
:description | |
def initialize(name, period, continent, diet, weight, locomotion, description) | |
@name = name | |
@period = period | |
@continent = continent |
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
// compare all values of two objects | |
function deepEqual(first, second) { | |
if (typeof first === "object" && typeof second === "object") { | |
// iterate over properties of both objects | |
for (var property in first) { | |
var firstProperty = first[property]; | |
var secondProperty = second[property]; | |
return deepEqual(firstProperty, secondProperty); |
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 replace(str, before, after) { | |
// make sure before and after are the same case | |
after = duplicateCase(before, after); | |
// use RegExp object with global setting on | |
var searchFor = new RegExp(before, 'g'); | |
return str.replace(searchFor, after); | |
} |
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 pairwise(arr, arg) { | |
// hold the indexes that add up to arg | |
var indexes = []; | |
// iterate over each element in the original array | |
arr.forEach(function (curVal, index, array) { | |
var outerIndex = index; | |
// compare to each element in the original array | |
array.forEach(function (val, indx, ar) { |
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
$(document).ready(function() { | |
// on document ready | |
var baseEndpoint = "https://api.twitch.tv/kraken/streams/" | |
var users = ["medrybw", "freecodecamp", "storbeck", "terakilobyte", "habathcx","RobotCaleb","comster404","brunofin","thomasballinger","noobs2ninjas","beohoff"] | |
var JSONP = "?callback=?" | |
// user arrays | |
var allUsers = []; | |
var onlineUsers = []; | |
var offlineUsers = []; |
OlderNewer