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
var parent = { | |
get: function fn(){ | |
return this.val; | |
}, | |
val:42 | |
} | |
var child = Object.create(parent); | |
child.val = 3.14; |
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
var obj = {opacity:0}; | |
TweenLite.to(obj, 2, {opacity:0.5, onUpdate:report}); | |
function report() { | |
console.log(obj.opacity); | |
} |
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
// object constructor: | |
function Person(job, married) { | |
this.job = job; | |
this.married = married; | |
} | |
//function that logs info to console | |
function logger(x){ | |
console.log(x) | |
} |
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
var nyc = { | |
fullName: "New York City", | |
mayor: "Michael Bloomberg", | |
population: 8000000, | |
boroughs: 5 | |
}; | |
//This loop will output ALL the properties of this object | |
for(var i in nyc){ |
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
<div id="output"></div> |
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
//create an object | |
var friends = {}; | |
//add people to it | |
friends.bill = { //observe this declaration as bill is an object of friends | |
firstName: "Bill", | |
lastName: "Gates", | |
number: "(206) 555-5555", | |
address: ['One Microsoft Way','Redmond','WA','98052'] | |
}; |
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
<button>update</button> | |
<input type="text" value="10" /> <br /> | |
<label></label> |
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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
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
// creates a function that will add a 2px blue border around each div with the class "blue" | |
$.fn.blueBorder = function(){ | |
this.each(function(){ | |
$(this).css("border","solid blue 2px"); | |
}); | |
return this; | |
}; | |
//creates a function that will turn the text color blue of each div | |
$.fn.blueText = function(){ |
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
// this targets Google Chrome and Opera 18+ | |
var isChromium = window.chrome; | |
if(isChrome === true) { | |
// is chromium based browser | |
} else { | |
// not chromium based browser | |
} | |
//To target if the browser is Google Chrome, use this: | |
var isChromium = window.chrome, |