Skip to content

Instantly share code, notes, and snippets.

@nathanallen
nathanallen / form-validator.js
Last active December 22, 2015 09:39 — forked from ksolo/form-validator.js
Form Validation
$(function(){
$('form').on('submit', function(e){
e.preventDefault();
$('#errors').empty();
//EMAIL VALIDATION
var email = $('input[name="email"]').val();
if (!(/.+/.test(email))){
$('#errors').append('<li>Insert an Email</li>');
}
<div id="die">
<% if @roll %>
<img src="/<%= @roll.value %>.png" title="<%= @roll.value %>" alt="the roll">
<% end %>
</div>
/* 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.
*/
/*1. Use basic selectors (id, class, element) to choose an element on the page.
Use the .css() method to alter at least two CSS properties of this element. */
@nathanallen
nathanallen / 20130827074204_create_words.rb
Last active December 21, 2015 18:48
Refactored Anagram Server
class CreateWords < ActiveRecord::Migration
def change
create_table :words do |t|
t.string :word
t.string :sorted_letters
t.integer :length
end
end
end