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 Vault(object): | |
#here's our private variable | |
__secret = "subtle and insubstantial, the expert leaves no trace" | |
#getter method to return the secret variable | |
def get_secret(self): | |
return self.__secret | |
fort_knox = Vault() |
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
for (d in document.write) { | |
document.write(d); | |
} |
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
/* | |
* Make the element scroll on both x and y axes - CSS2 | |
*/ | |
.scroll-both { | |
overflow:scroll; | |
} | |
/* | |
* Make the element scroll on x axis only - CSS3 | |
*/ |
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 square = document.getElementById("square"); | |
var content = document.getElementById("content"); | |
/* | |
* Vertical y-axis properties | |
*/ | |
square.offsetHeight; //the height in pixels of the scrollable element (e.g. 150px) | |
square.scrollTop; //the number of pixels from the top that the element is scrolled (e.g. 350px) | |
content.scrollHeight; //the total height in pixels of the scrollable content (e.g. 500px) |
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 is for my outer square box | |
*/ | |
#square{ | |
width:150px; | |
height:150px; | |
background:#AFAFAF; | |
} | |
/* | |
* This is the content inside the square box |
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="square"> | |
<div id="content"></div> | |
</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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Scrolling content and getting properties - Example HTML using a dash of CSS3 and JavaScript</title> | |
<style> | |
.square{ | |
width:150px; | |
height:150px; | |
background:#AFAFAF; | |
} |
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
function sleep (duration, fn) { | |
setTimeout(fn, duration); | |
} |
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
console.time('for_loop_timer'); | |
for (var i=0; i<1000; i++){ | |
//nothing to see here, move along | |
} | |
console.timeEnd('for_loop_timer'); |
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
$('#box").css('padding-top', parseInt($('#box').css('padding-top'), 10) + 10); |
OlderNewer