Quotes help make search much faster. Example: "Practice Makes Perfect"
Showing posts with label APIs. Show all posts
Showing posts with label APIs. Show all posts
Sunday, January 13, 2013
Codecademy Sample Solution: Parsing XML
#sample solution for Code tab
require "rexml/document"
file = File.open("pets.txt")
doc = REXML::Document.new file
file.close
doc.elements.each("pets/pet/name") do |element|
puts element
end
puts ''
doc.elements.each("pets/pet/species") do |element|
puts element
end
Codecademy Sample Solution: HTTP Status Codes
require 'open-uri'
placekitten = open('http://placekitten.com/')
# Add your code below!
puts(placekitten.status())
Codecademy Sample Solution: Making a Request
require 'open-uri'
# Open http://placekitten.com/ for reading on line 4!
kittens = open('http://placekitten.com')
body = kittens.read[559, 441]
# Add your puts statement below!
puts(body)
Codecademy Sample Solution: Adding data to your Parse Object
//sample solution to my_parse_app.js
$(window).on("html_loaded", function(e) {
$(".submit_button").click(function(e) {
// This creates our new Post object
var Post = Parse.Object.extend("Post");
var myPost = new Post();
// 1. Let's add some data for the key 'text'
myPost.set("text", "any string");
});
});
$(window).on("html_loaded", function(e) {
$(".submit_button").click(function(e) {
// This creates our new Post object
var Post = Parse.Object.extend("Post");
var myPost = new Post();
// 1. Let's add some data for the key 'text'
myPost.set("text", "any string");
});
});
Codecademy Sample Solution: XML & JSON
// What data format is shown below? Set answer
// equal to 'XML' for XML and 'JSON' for JSON.
// {
// "Cartoon Foxes": {
// {
// "Name": "Fox Tall",
// "Job": "Bein' tall"
// },
// {
// "Name": "Fox Small",
// "Job": "Bein' small"
// }
// }
// }
var answer = "JSON";
Codecademy Sample Solution: Authentication and API Keys
// What's an API key?
// A: An alphanumeric string used to identify you to an API
// B: An OAuth token
// C: An All-Purpose Internet key
// D: The tool used to unlock an API gate
var answer = "A";
Codecademy Sample Solution: Requests
// Add your code below this line!
var xhr = new XMLHttpRequest();
xhr.open("GET","http://www.codecademy.com/",false);
xhr.send();
// Add your code above this line!
console.log(xhr.status);
console.log(xhr.statusText);
Codecademy Sample Solution: REST Constraints and Requirements
// 1. HTTP is a protocol that connects clients and ______.
var answer1 = "servers";
// 2. The four HTTP methods are GET, POST, ___, and DELETE.
var answer2 = "PUT";
// 3. A ___ error means the server goofed up. (200, 300, 400, or 500)
var answer3 = "500";
Saturday, January 12, 2013
Codecademy Sample Solution: HTTP Status Codes
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.codecademy.com/doesnt_exist", false);
xhr.send();
// Add your code below!
console.log(xhr.status);
Codecademy Sample Solution: Endpoints
// What are the four commonly used HTTP methods ("verbs")?
// A: FIND, SEND, UPDATE, REMOVE
// B: CREATE, READ, UPDATE, DELETE
// C: GET, SEND, PUT, DELETE
// D: GET, POST, PUT, DELETE
var answer = "D";
Codecademy Sample Solution: Making a Request
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.codecademy.com/", false);
// Add your code below!
xhr.send();
console.log(xhr.status);
console.log(xhr.statusText);
Codecademy Sample Solution: No REST for the Wicked
// You (the client) make an HTTP request. What sends the response?
// A: The Internet
// B: The World Wide Web
// C: The server
// D: The waiter
var answer = "C";
Subscribe to:
Posts (Atom)
This is an example of scrolling text using Javascript.
Popular Posts
-
# Codecademy sample solution # What are the four commonly used HTTP methods ("verbs")? # A: FIND, SEND, UPDATE, REMOVE # B: ...
-
$("#tours > li")
-
<!--sample solution--> <html> <head> <title>Week 13 Project</title> </head> ...
-
<!-- Sample solution to index.html --> <!DOCTYPE html> <html> <body> <div class="nav"> ...
-
#sample solution hungry = false unless hungry puts "I'm writing Ruby programs!" else puts "Time to eat!...
-
favorite_animal ||= "dog" favorite_animal ||= "cat"
-
//sample solution def isEven(x): if(x % 2 == 0): return "yep" else: return "nope"
-
Answer: Alt - p p stands for previous. If you keep pressing Alt - p, you will continue cycling back through commands you typed before. I...
-
<html> <head> <!-- Add the Parse SDK here! --> <script src="http://www.parsecdn.com/js/par...
-
# your code here def check_palindrome(str) rev = str.reverse rev.eql?(str) end check_palindrome("civic")