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
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 |
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
def is_prime(int) | |
i = 2 | |
while i < int | |
if int % i == 0 | |
return false | |
i = int | |
end | |
i += 1 | |
end | |
end |
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
/* 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. | |
*/ |
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
<!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> |
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
//------------------------------------------------------------------------------------------------------------------ | |
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here. | |
//------------------------------------------------------------------------------------------------------------------ | |
var Zoo = { | |
init: function(animals){ | |
this.animals = animals; | |
}, | |
bipeds : function(){ |
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 livingThing(options){ | |
this.name = options.name; | |
this.sex = options.sex; | |
this.alive = true; | |
} | |
function Person(options){ | |
livingThing.call(this, options); | |
this.children = []; | |
this.wife; |
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 Mammal(options){ | |
this.name = options.name; | |
this.sex = options.sex; | |
this.alive = true; | |
} | |
function Person(options){ | |
Mammal.call(this, options); | |
this.children = []; | |
this.wife; |
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
# components/split-date-selector.js.coffee | |
Teleborder.SplitDateSelectorComponent = Ember.Component.extend | |
change: -> | |
selects = @$().find('select') | |
month = selects.filter('[name="month"]').val() | |
day = selects.filter('[name="day"]').val() | |
year = selects.filter('[name="year"]').val() | |
currentDate = moment(new Date(year, month, day)) | |
@set('date', new Date(currentDate.toISOString())) if currentDate |
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
class ProjectsController < ApplicationController | |
def create | |
Project.create(project_params) | |
end | |
def project_params | |
params.require(:project).permit( | |
:name, | |
:tags [ | |
:id, |
OlderNewer