Skip to content

Instantly share code, notes, and snippets.

View danillawafer's full-sized avatar

Seth Grotelueschen danillawafer

View GitHub Profile
@danillawafer
danillawafer / form-validator.js
Last active December 21, 2015 03:29 — forked from ksolo/form-validator.js
Form Validation
var errors = [];
validateEmail = function(email) {
var format = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/;
if (!email.match(format)) {
errors.push('Must be a valid email address');
}
};
validatePassword = function(password) {
/* 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.
*/
/* 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.
*/
@danillawafer
danillawafer / index.html
Last active December 20, 2015 21:09 — 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>
https://github.com/danillawafer/ar-sunlight-legislators
@danillawafer
danillawafer / hospital.rb
Created July 24, 2013 05:45
Hospital incomplete
class Hospital
attr_reader :name, :location, :employees, :patients
def initialize(attributes)
@name = attributes[:name]
@location = attributes[:location]
@employees = []
@patients = []
add_administrator(attributes[:administrator])
end
class Vehical
def initialize(args)
@color = args[:color]
@oil_slicks = args[:oil_slicks]
@mood = args[:mood] || :calm
end
def brake
@status = :stopped
end
@danillawafer
danillawafer / flatten.rb
Last active December 19, 2015 02:19
Here is my attempt at creating a flatten method. It works, so I guess in that sense it is successful!
def flatten(array)
array.each do |check|
if check.kind_of?(Array) #Checks to see if the item is a nested array, if it is...
check.each do |into| #Each item in that nested array is appended to the array
array << into
end
array.delete(check) #The original nested array is deleted
flatten(array) #The method calls itself, avoids endless loop because it is only
end #called when the method finds a nested array
end