Quotes help make search much faster. Example: "Practice Makes Perfect"

Monday, December 31, 2012

Codecademy Sample Solution: Projects Adding Text


var my_canvas=document.getElementById('canvas');
var context=my_canvas.getContext('2d');
context.beginPath();
context.fillStyle = 'blue';
context.fillRect(50, 80, 100, 20);
context.font = "25px Calibri";
context.fillText("Kumbaya",53,50);
context.fillText("Sharky!",65,150);

context.fillStyle = "blue";
context.beginPath();
context.arc(50, 100, 20, Math.PI, (1.5)*Math.PI);
context.lineTo(50, 100);
context.closePath();
context.fill();
context.lineWidth = 1;
context.stroke();
context.fillStyle = "black";

context.fillStyle = "blue";
context.beginPath();
context.arc(100, 80, 20, Math.PI, (1.5)*Math.PI);
context.lineTo(100, 80);
context.closePath();
context.fill();
context.lineWidth = 1;
context.stroke();
context.fillStyle = "black";

context.fillStyle = "blue";
context.beginPath();
context.arc(170, 90, 20, 0.5*Math.PI, 1.5*Math.PI);
context.lineTo(170, 90);
context.closePath();
context.fill();
context.lineWidth = 1;
context.stroke();
context.fillStyle = "black";

Sunday, December 30, 2012

Codecademy Sample Solution: Projects Using .fillStyle


var my_canvas=document.getElementById('canvas');
var context=my_canvas.getContext('2d');
context.beginPath();
context.fillStyle = 'red';
context.fillRect(50, 80, 100, 20);

Codecademy Sample Solution: Projects Drawing a Rectangle


var my_canvas=document.getElementById('canvas');
var context=my_canvas.getContext('2d');
context.beginPath();
context.strokeRect(50, 80, 100, 20);

Codecademy Sample Solution: Projects Drawing a Circle


var my_canvas=document.getElementById('canvas');
var context=my_canvas.getContext('2d');
context.beginPath();
//.arc(x, y, radius, startAngle, endAngle)
context.arc(100,100,50,0,2*Math.PI);
context.stroke();

Codecademy Sample Solution: Projects Lines and Arcs


var my_canvas=document.getElementById('canvas');
var context=my_canvas.getContext('2d');
context.beginPath();
context.arc(100,100,50,0,Math.PI);
context.stroke();

Codecademy Sample Solution: Projects The Nakedness Beneath jQuery


var my_canvas=document.getElementById('canvas');
var context=my_canvas.getContext('2d');

Saturday, December 29, 2012

Codecademy Sample Solution: Projects Finishing the If / Else If...


// Write your code below!
var userAge = parseInt(prompt("Enter you age:"));
if(isNaN(userAge)){
console.log("Your input is not a number.");
} else if(userAge>18) {
console.log("You are of legal age!");
} else {
console.log("You're underaged!");
}

Codecademy Sample Solution: Projects isNaN()


// Write your code below!
var userAge = parseInt(prompt("Enter you age:"));
if(isNaN(userAge)){
console.log("Your input is not a number.");
}

Codecademy Sample Solution: Projects Prompting the User


// Write your code below!
var userAge = parseInt(prompt("Enter you age:"));

Codecademy Sample Solution: Projects Declare Your Variable


// Write your code below!
var userAge;

Thursday, December 27, 2012

Codecademy Sample Solution: Projects Style It!


/* sample solution to stylesheet.css */

* {
    font-family: Calibri;
    font-size: 16px;
}  

#returning {
    margin-left: 22px;
}

#returning, #departing {
    background-color: tan;
    color: white;
    font-size: 14px;
    text-align: center;
    width: 80px;
}

Codecademy Sample Solution: Projects Pick a Date with .datepicker()


// sample solution to script.js

$(document).ready(function(){
    $('#departing').datepicker();
    $('#returning').datepicker();
});

Codecademy Sample Solution: Projects Add Your Input Fields


<!DOCTYPE html>
<html>
    <head>
<title>Pick a Date</title>
        <link rel='stylesheet' type='text/css' href='stylesheet.css'/>
        <link rel='stylesheet' type='text/css' href='http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css'/>
        <script type='text/javascript' src='script.js'></script>
        <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
</head>
<body>
        <!--Add your HTML below!-->
        <label for="departing">Departure Date:</label>
        <input type='text' id='departing' />
        <br/>
        <label for="returning">Return Date:</label>
        <input type='text' id='returning' />
    </body>
</html>

Sunday, December 23, 2012

Codecademy Sample Solution: Projects Radio Buttons


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
        <form>
            <input type="text" name="input1" value="Basic"/>
            <input type="text" name="input2" value="Form"/>
            <br />
            <input type="radio">Administrator</input>
            <br />
            <input type="radio">Guest</input>
        </form>
        <textarea></textarea>
</body>
</html>

Saturday, December 22, 2012

Codecademy Sample Solution: Projects Adding a "textarea"


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
        <form>
            <input type="text" name="input1" value="Basic"/>
            <input type="text" name="input2" value="Form"/>
        </form>
        <textarea></textarea>
</body>
</html>

Codecademy Sample Solution: Projects The Basic Form


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
        <form>
            <input type="text" name="input1" value="Basic"/>
            <input type="text" name="input2" value="Form"/>
        </form>  
</body>
</html>

Friday, December 21, 2012

Find the solution to a system of linear equations with n unknowns

This script will try to solve for x in a system of linear equations of the form Ax=y. x is the unknown column vector and y is the known column vector. A solution is possible if the inverse of the matrix of coefficients exists.

Type in the size of the square matrix:
Create



Credit belongs to James Coglan for his masterful work on Sylvester.

Find the inverse of an n x n square matrix

Type in the size of the square matrix:
Create



Credit belongs to James Coglan for his masterful work on Sylvester.

This is an example of scrolling text using Javascript.

Popular Posts