Quotes help make search much faster. Example: "Practice Makes Perfect"
Tuesday, June 18, 2013
Codecademy Sample Solution: Logging In The User
// The callback URL to redirect to after authentication
redirectUri = "http://external.codecademy.com/skydrive.html";
//sample solution to helper.js
//note: you have to have a Microsoft account in order to log-in and finish the exercise
// Initialize the JavaScript SDK
WL.init({
client_id: '000000004C0E2C11',
redirect_uri: redirectUri
});
$(document).ready(function() {
// Start the login process when the login button is clicked
$('#login').click(function() {
WL.login({
scope: ["wl.skydrive wl.signin"]
}).then(
// Handle a successful login
function(response) {
$('#status').html("<strong>Success! Logged in.</strong>");
},
// Handle a failed login
function(responseFailed) {
// The user might have clicked cancel, etc.
$('#status').html(responseFailed.error.message);
}
);
});
});
Codecademy Sample Solution: Initializing the Javascript SDK
//sample solution to the helper.js file
WL.init({
client_id: ('000000004C0E2C11')
redirect_uri: ('http://external.codecademy.com/skydrive.html')
});
Codecademy Sample Solution: Setting Up
<!DOCTYPE html>
<html>
<head>
<title>My SkyDrive Web App</title>
<!-- Add wl.js here -->
<script src="http://js.live.net/v5.0/wl.js"></script>
<script src="helper.js"></script>
</head>
<body>
<p>Hello there! We'll fill this part out soon.</p>
</body>
</html>
Friday, June 7, 2013
Codeschool Sample Solution Keyup Event Handler II
$(document).ready(function() {
$("#nights").on("keyup", function() {
//var days = $(this).val();
//var pricePerDay = $(".tour").data('daily-price');
//var totalPrice = days * pricePerDay;
//$("#nights-count").text(days);
//$("#total").text(totalPrice);
$("#nights-count").text($(this).val());
$("#total").text($(this).val() * $(this).closest(".tour").data('daily-price'));
});
});
Codeschool Sample Solution Keyup Event Handler I
$(document).ready(function() {
$("#nights").on("keyup", function() {
$("#nights-count").text($(this).val());
});
});
Codeschool Sample Solution Keyup Event
$(document).ready(function() {
$("#nights").on('keyup', function(){
});
});
Codeschool Sample Solution Mouseleave
$(document).ready(function() {
$("#tour").on("click", "button", function() {
$(".photos").slideToggle();
});
$(".photos").on("mouseenter", "li", function() {
$(this).find("span").slideToggle();
});
$(".photos").on("mouseleave", "li", function() {
$(this).find("span").slideToggle();
});
});
Thursday, June 6, 2013
Codeschool Sample Solution Mouseover II
$(document).ready(function() {
$("#tour").on("click", "button", function() {
$(".photos").slideToggle();
});
$(".photos").on("mouseenter", "li", function() {
$(this).find("span").slideToggle();
});
});
Codeschool Sample Solution Mouseover I
$(document).ready(function() {
$("#tour").on('click', 'button', function() {
$(".photos").slideToggle();
});
$(".photos").on('mouseenter', 'li', function(){
});
});
Codeschool Sample Solution Slide Effect II
$(document).ready(function() {
$("#tour").on("click", "button", function() {
$(".photos").slideToggle();
});
});
Codeschool Sample Solution Slide Effect I
$(document).ready(function() {
$("#tour").on("click", "button", function() {
$('.photos').slideDown();
});
});
Codeschool Sample Solution On Load II
$(document).ready(function() {
$('#tour').on('click', 'button', function(){
alert('I was clicked!');
});
});
Codeschool Sample Solution On Load I
$(document).ready(function(){
var numPhotos = $('img').length;
alert(numPhotos);
});
Codeschool Sample Solution New Filter III
$(document).ready(function(){
$("#filters").on("click", ".on-sale", function(){
$(".highlight").removeClass();
$(".tour").filter(".on-sale").addClass("highlight");
});
$("#filters").on("click", ".featured", function(){
$(".highlight").removeClass();
$(".tour").filter(".featured").addClass("highlight");
});
});
Codeschool Sample Solution New Filter II
$(document).ready(function(){
$("#filters").on("click", ".on-sale", function(){
$(".tour").filter(".on-sale").addClass("highlight");
});
});
Codeschool Sample Solution New Filter I
$(document).ready(function(){
//Create the click handler here
$("#filters").on("click", ".on-sale", function(){
});
});
Codeschool Sample Solution Better On Handlers
$(document).ready(function(){
$(".tour").on("click","button", function(){
var tour = $(this).closest(".tour");
var discount = tour.data("discount");
var message = $("<span>Call 1-555-jquery-air for a $" + discount + "</span>");
tour.append(message);
$(this).remove();
});
});
Codeschool Sample Solution Refactoring
$(document).ready(function(){
$("button").on("click", function(){
var tour = $(this).closest(".tour");
var discount = tour.data("discount");
var message = $("<span>Call 1-555-jquery-air for a $" + discount + "</span>");
tour.append(message);
$(this).remove();
});
});
Codeschool Sample Solution Fetching Data from the DOM II
$(document).ready(function(){
$("button").on("click", function(){
var discount = $(this).closest(".tour").data("discount");
//alert(discount); //for checking
var message = $("<span>Call 1-555-jquery-air for a $"+discount+" discount</span>");
$(this).closest(".tour").append(message);
$(this).remove();
});
});
Codeschool Sample Solution Fetching Data from DOM I
$(document).ready(function(){
$('button').on('click', function(){
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
var discount = $(this).closest(".tour").data("discount");
$(this).closest(".tour").append(message);
$(this).remove();
//alert(discount); //prove that value of data is stored in var discount
});
});
Codeschool Sample Solution Relative Traversing III
$(document).ready(function(){
$(".tour").on("click", function(){
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(this).closest(".tour").append(message);
$(this).find(".book").remove();
});
});
Codeschool Sample Solution Traversing II
$(document).ready(function(){
$('button').on('click', function(){
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(this).closest("li").append(message);
$(this).remove();
});
});
Codeschool Sample Solution Relative Traversing I
$(document).ready(function(){
$("button").on("click", function(){
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(this).parent().append(message);
$(this).remove();
});
});
Codeschool Sample Solution Removing the clicked button
$(document).ready(function(){
$("button").on("click", function(){
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(".usa").append(message);
$(this).remove();
});
});
Codeschool Sample Solution On Page Load
$(document).ready(function(){
$("button").on("click", function(){
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(".usa").append(message);
$("button").remove();
});
});
Codeschool Sample Solution Acting On Click
$(".tour").on("click", function(){
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(".usa").append(message);
$("button").remove();
});
Codeschool Sample Solution Click Interaction
$(".book").on("click", function(event){
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(".usa").append(message);
$(".book").remove();
});
Codeschool Sample Solution Removing from the DOM
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(".usa").append(message);
$(".book").remove();
Codeschool Sample Solution Adding to the DOM II
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(".usa").append(message);
Codeschool Sample Solution Adding to the DOM I
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
$(".book").before(message);
Codeschool Sample Solution Creating a DOM Node
var message = $("<span>Call 1-555-jquery-air to book this tour</span>");
Codeschool Sample Solution The :even selector
$("#tours > li:even")
Codeschool Sample Solution Traversing Down
$("#tours").children("li")
Codeschool Sample Solution Traversing Up
$(".featured").parent()
Codeschool Sample Solution Using prev()
$("#vacations li").last().prev()
Codeschool Sample Solution Using last()
$("#vacations li").last()
Codeschool Sample Solution Using first()
$("#vacations li").first()
Codeschool Sample Solution Using find()
$("#vacations").find(".america")
Codeschool Sample Solution First Pseudo Selector
$("#tours :first")
Codeschool Sample Solution Selecting Multiple Elements
$(".asia, .sale")
Codeschool Sample Solution Selecting Direct Children
$("#tours > li")
Codeschool Sample Solution Descendant Selector
$("#tours li")
Codeschool Sample Solution Modifying Multiple Elements
$("h2").text("Vacation Packages")
Codeschool Sample Solution Class Selector
$(".america")
Codeschool Sample Solution ID Selector
$("#vacations")
Codeschool Sample Solution Include A Custom Javascript File
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
</head>
<body>
<div class="homepage-wrapper">
<h2>Welcome to jQuery Travels - Traversing the DOM since 2006</h2>
<p>Fly to New York today for as little as <span>$299.99</span></p>
</div>
<script src="jquery.min.js"></script>
<script src="application.js"></script>
</body>
</html>
Codeschool Sample Solution Include the jQuery Library
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
</head>
<body>
<div class="homepage-wrapper">
<h2>Welcome to jQuery Travels - Traversing the DOM since 2006</h2>
<p>Fly to New York today for as little as <span>$299.99</span></p>
</div>
<script src="jquery.min.js"></script>
</body>
</html>
Codeschool Sample Solution DOM Ready
$(document).ready(function() {
$("span").text("$100");
});
Codeschool Sample Solution Changing Text
$("span").text("$100")
Codeschool Sample Solution Text Method
$("span").text()
Codeschool Sample Solution Element Selector II
$("span")
Codeschool Sample Solution Element Selector
$("h2")
Sample Git Command 15
git branch -d someBranchName
note: used to delete someBranchName
note: used to delete someBranchName
Sample Git Command 14
git branch
note: used to determine which branch you are working with
note: used to determine which branch you are working with
Sample Git Command 13
git checkout -- sampleFileName.txt
Sample Git Command 12
git reset someFolderName/someFileName.txt
note: used to unstage a file
note: used to unstage a file
Sample Git Command 7
git remote add origin https://someSite.com/someFile.git
note: for adding files from a remote location
note: for adding files from a remote location
Sample Git Command 6
git log
note: shows stuff done on git in the past
note: shows stuff done on git in the past
Sample Git Command 5
git add '*.txt'
note: this command add's multiple text files to the staging area
note: this command add's multiple text files to the staging area
Sample Git Command 4
git commit -m "some comment about newly added file to repository"
Sample Git Command 1
git init
initialized existing Git repository in /.git/
initialized existing Git repository in /.git/
Subscribe to:
Comments (Atom)
This is an example of scrolling text using Javascript.
Popular Posts
-
// Sample solution // Write a string rotation method. // It should pass all the tests given below. String.prototype.rotate = function(n...
-
<style> span { background-image: url('http://hosturl.co.uk/cc/lady2.png'); width: 105px; heig...
-
A typical compounding problem would be something like: How much is the equivalent Present Value (P) if an investment pays an amount (A...
-
A typical compounding problem would be something like: What is the present value (P) of a future value (F) if (P) was deposited/lent a...
-
The spleen
-
A typical compounding problem would be something like: How much will I get annually (A) starting next year if I invest a present value...
-
Script solution for finding a product problem: Answer: 30 console.log("----------------------------------"); function som...
-
#sample solution pyg = 'ay' original = raw_input('Enter a word:') if len(original) > 0 and original.isalpha(): p...
-
Say you had an election, and you needed to tally the votes for each candidate. All you need to do is enter the name of each candidate o...
-
A typical compounding problem would be something like: What is the future value (F) of a present value (P) deposited/lent at an intere...