Skip to content

Instantly share code, notes, and snippets.

RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus
config.order = 'random'
end
var promise = new Promise(function(resolve, reject) {
resolve("Everlane");
});
promise.then(function(result) {
console.log(result)
}).catch(function(error){
console.log(error.message);
});
/* 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.
*/
@cemmanuel1
cemmanuel1 / index.html
Last active December 19, 2015 03:58 — 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>
class Vehicle
@@INFLATED_WHEELS = 4
def initialize(args)
@color = args[:color]
@wheels_needed = 4
end
def drive
@status = :driving
end
class Vehicle
@@WHEELS= 4
def initialize(args)
@color = args[:color]
@num_wheels = 4
end
def drive
@status = :driving
end
class Car
@@WHEELS = 4
def initialize(args)
@color = args[:color]
@wheels = @@WHEELS
end
def drive
@status = :driving
end
def brake
Create a method leap_year? that accepts an integer representing a year as input.
It should return true if the year input is a leap year and false otherwise.
For example,
leap_year?(2000) # => true
leap_year?(2001) # => false
def leap_year?(year)
@cemmanuel1
cemmanuel1 / Grading
Last active December 18, 2015 00:19
Create a method get_grade that accepts an average in the class and returns the letter grade as a String.
It should only return one of 'A', 'B', 'C', etc. Don't worry about + and - grades.
For example,
get_grade(89) # => returns "B", *not* "B+"
get_grade(70) # => returns "C"
def get_grade(average)
Exercise: Triangle side lengths
Write a method valid_triangle? which takes as its input three non-negative numbers. It should return true if the three numbers could form the side lengths of a triangle and false otherwise.
The arguments don't correspond to specific sides. Don't worry about handling negative inputs — garbage in, garbage out.
For example,
valid_triangle?(0,0,0) # => false, because a triangle can't have 0-length sides
valid_triangle?(1,1,1) # => true, an equilateral triangle