Skip to content

Instantly share code, notes, and snippets.

@cprater
cprater / carousel.js
Created February 27, 2014 21:55 — forked from ksolo/carousel.js
Image Carousel
@cprater
cprater / form-validator.js
Last active August 29, 2015 13:56 — forked from ksolo/form-validator.js
Form Validation
var validateEmail = function(email){
if (email.match(/\w+\.\w{3,6}/))
return true;
else
return false;
};
var validatePasswordLength = function(password){
if (password.length >= 8)
return true;
@cprater
cprater / zoo.js
Last active August 29, 2015 13:56 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
var Animal = function(type, legs){
this.typeOfAnimal = type;
this.numLegs = legs;
};
var Zoo = {
// this
@cprater
cprater / index.html
Last active August 29, 2015 13:56 — 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.
*/
@cprater
cprater / sdfa.md
Last active August 29, 2015 13:56
@cprater
cprater / 0.2.1-boggle_class_from_methods.rb
Created December 3, 2013 18:50 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
def initialize(board)
@board = board
end
def create_word(*coords)
coords.map { |coord| @board[coord.first][coord.last]}.join("")
end
def get_row(row)
@cprater
cprater / gist:7365212
Created November 8, 2013 02:14
Calculating the mode of an array
# Create a hash to put the Key: integer, value: times it appears in
# Create a loop ti fill the Hash with values
# sort the hash by the highest value
# Return the key of the highest value(s)
#
#
def mode(array)
num = Hash.new(0)
array.each do |i|
num[i] += 1