Skip to content

Instantly share code, notes, and snippets.

View zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
function Animal(name, num_of_legs) {
this.name = name
this.legs = num_of_legs
}
Animal.prototype.identify = function() {
View jquery_quiz.js
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/
View jquery_quiz.js
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/
View jquery_quiz.js
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/
View lucky_ajax.md
View lucky_ajax.md

Instructions:

  1. Download this application skeleton.
  2. Convert the app to use AJAX.
  3. Add any files you changed to your gist and submit your code.
@kenrett
kenrett / gist:5130538
Last active Dec 14, 2015
class GuessingGame
View gist:5130538
class GuessingGame
def initialize(answer)
@answer = answer
end
def guess(g)
@guess = g
if @answer < @guess
return :high
end
View gist:5051882
def mode(array)
a = array.inject(Hash.new(0)) { |key, value| key[value] += 1; key }
array.sort_by { |value| a[value] }.last
end
View gist:5043466
def factorial(n)
if n == 0
return 1
end
counter = 0
array = []
while n >= counter
n.times do |i|
array << i *= (n-counter)
end
View gist:5018695
def times_table(rows)
if rows == 0
return false
end
array = []
counter = 1
while counter <= rows
1.upto(rows) do |i|
array << i*counter
end