Skip to content

Instantly share code, notes, and snippets.

View nemrow's full-sized avatar

Jordan Nemrow nemrow

  • Woflow
  • San Francisco
View GitHub Profile
@nemrow
nemrow / zoo.js
Last active December 18, 2015 11:19 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
var Zoo = {
init: function(animals){
this.animals = animals;
},
bipeds : function(){
@nemrow
nemrow / index.html
Last active December 18, 2015 11:18 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
/* 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.
*/
@nemrow
nemrow / gist:5215581
Last active December 15, 2015 06:19
I am working on this challenge: "The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ?" and my solution is clearly terrible! It takes about 10 seconds to produce this answer (which is correct), and when I tried to plug in the number 600851475143 (which is what they want), it actually crashe…
def is_prime(int)
i = 2
while i < int
if int % i == 0
return false
i = int
end
i += 1
end
end
def valid_triangle?(a, b, c)
all_sides = [a,b,c]
all_sides_sorted = all_sides.sort
max_num = all_sides_sorted[2]
if (all_sides_sorted[0] == 0 or all_sides_sorted[1] == 0 or all_sides_sorted[2] == 0)
elsif (all_sides_sorted[0] == max_num and all_sides_sorted[1] == max_num and all_sides_sorted[2] == max_num)
return true
elsif ((all_sides_sorted[0] * all_sides_sorted[0]) + (all_sides_sorted[1] * all_sides_sorted[1]) == (all_sides_sorted[2] * all_sides_sorted[2]))
return true
else