This file contains hidden or 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
| analytics.load('<?php echo $segmentWriteKey ?>'); | |
| function waitUntil(condition, cb, attempt, interval, failure_cb) { | |
| attempt = attempt || 0; | |
| interval = interval || 250; | |
| if (attempt >= 2) { | |
| if (failure_cb) { | |
| failure_cb(); | |
| } | |
| return false; | |
| } |
This file contains hidden or 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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or 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
| # Validates attributes | |
| # also has methods that will return a student's full name and age in years | |
| https://github.com/ldrbrandon/ar-student-schema.git |
This file contains hidden or 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
| class RPNCalculator | |
| def initialize | |
| # new calculator open | |
| end | |
| def evaluate(expression) | |
| # this first part makes the string into an array with everything converted accordingly | |
| tokens = expression.split(' ') | |
| for i in 0..order.length-1 |
This file contains hidden or 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
| def mode(array) | |
| hash = {} | |
| array.each do |x| | |
| hash[x] += 1 # create a hash with the element as the key and the value increments every time it finds that | |
| # same element again | |
| end | |
| # go through the hash's keys and values and whichever value is highest will be the most frequent | |
| most_freq = [] | |
| hash.each do |key,value| | |
| max = 0 |