This file contains hidden or 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 charsInBody = (function counter(elm) { | |
| if (elm.nodeType == 3) { // TEXT_NODE | |
| return elm.nodeValue.length; | |
| } | |
| var count = 0; | |
| for (var i = 0, child; child = elm.childNodes[i]; i++) { | |
| count += counter(child); | |
| } | |
| return count; | |
| })(document.body); |
This file contains hidden or 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
| <html> | |
| <head> | |
| <style> | |
| .item {width:300px; display: inline-block; } | |
| .item .itemtitle {font-weight:bold; font-size:2em;} | |
| .hidden {display:none;} | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Amalgam Comics Characters</h1> |
This file contains hidden or 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
| // super cool shortcut | |
| this.top.location !== this.location && (this.top.location = this.location); |
This file contains hidden or 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 someArray=['blah',5,'stuff',7]; | |
| for(var i=0;i<someArray.length;i++){ | |
| if(typeof someArray[i]!=='number'){ | |
| continue; | |
| } | |
| for(var j=0;j<someArray[i];j++){ | |
| console.log(j); | |
| } | |
| } |
This file contains hidden or 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
| // http://jsfiddle.net/crzyman/nshX6/1/ | |
| <canvas id="graph"></canvas> | |
| <script> // add the load event listener | |
| var graph; | |
| var xPadding = 30; | |
| var yPadding = 30; | |
| // Notice I changed The X values | |
| var data = { values:[ |
This file contains hidden or 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 myArray = ["Ivan","Juan","John","Joseph"] | |
| var rand = parseInt(Math.random() * myArray.length); | |
| console.log("My name is " + myArray[rand]); | |
This file contains hidden or 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(){ | |
| var speed = 10, | |
| movebox = function() { | |
| var el = documentGetElementById("box"), | |
| left = el.leftOffset, | |
| moveBy = 3; | |
| el.style.left = left + moveBy + 'px'; | |
| if(left > 399) { |
This file contains hidden or 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
| /***** Selector though hack ******/ | |
| /* Only for IE6 and below */ | |
| * html div { color: gray } | |
| /* Only for IE7 */ | |
| *:first-child+html div { color: gray } | |
This file contains hidden or 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 lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <h1>Say a colour</h1> | |
| <p>Easy</p> | |
This file contains hidden or 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
| @keyframes yellowfade { | |
| from { background: yellow; } | |
| to { background: transparent; } | |
| } | |
| .new-item { | |
| animation-name: yellowfade; | |
| animation-duration: 1.5s; | |
| } |