- Download this application skeleton.
- Convert the app to use AJAX.
- Add any files you changed to your gist and submit your code.
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 User < ActiveRecord::Base | |
def self.from_omniauth(auth) | |
where(auth.slice("provider", "uid")).first || create_from_omniauth(auth) | |
end | |
def self.create_from_omniauth(auth) | |
create! do |user| | |
user.provider = auth['provider'] | |
user.uid = auth['uid'] |
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
// Shorthand for $(document).ready(); | |
$(function(){ | |
$("#next_frame").click(function() { | |
var right_val = parseInt($(".frames > li").css("right").replace(/px/,'')); | |
if (right_val > 700) { | |
$(".frames > li").animate({"right": "0px"}, "fast"); | |
} else { | |
$(".frames > li").animate({"right": "+=360px"}, "fast"); |
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
// shorthand for $(document).ready(); | |
$(document).ready(function(){ | |
$("form").submit(function(e) { | |
e.preventDefault(); | |
var emailInput = $("input").first().val(); | |
var passwordInput = $("input").last().val(); | |
if (!validateEmail(emailInput)) { | |
$("#errors").append("<li>Invalid Email</li>"); |
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. | |
//------------------------------------------------------------------------------------------------------------------ | |
// Animal Constructor | |
function Animal(name, legs){ | |
this.name = name; | |
this.legs = legs; | |
} |
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
# Solution for Challenge: Pig-latin. Started 2013-08-06T15:39:01+00:00 | |
def is_vowel?(word) #add is_vowel? helper method to make code in | |
/[aeiou]/i === word[0] #to_pig_latin more expressive | |
end | |
def to_pig_latin(word) | |
if is_vowel?(word) | |
word | |
else |