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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>device detection</title> | |
</head> | |
<body> | |
<div id="log_motion"></div> | |
<div id="log_orientation"></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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Palindrome Detector</title> | |
</head> | |
<body> | |
<p>This soution splits the value of a text input into an array, reverses it, and then compares the result to the original value. If the two values are identical we have a palindrome. It uses no 3rd party libs and passes JSLint.</p> | |
<hr> | |
<form> |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Name Counts</title> | |
</head> | |
<body> | |
<p>This solution to the keys problem converts the contents of a textarea into an array by line break, then passes that array to a "convertCommaKeysToObject" method which is where the bulk of the oeration takes place. This method iterates through an array of strings which it expects to contain a single comma. It splits each string at the comma, adding the value left of the comma as a new key and the value right of the comma as a value. If a key already exists in the new object it's value is added to the existing key. It then prints the results to the DOM. It uses no 3rd party libs and (almost) passes JSLint.</p> | |
<hr> | |
<form> |
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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
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 hasjQuery = false; | |
jQueryCheck = function() { | |
if (! window.jQuery) { | |
if (! hasjQuery) { | |
hasjQuery = true; | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; | |
document.getElementsByTagName('body')[0].appendChild(script); | |
} |