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
/*eloquent javascript solution*/ | |
var differences = ancestry.filter(function(person) { | |
return byName[person.mother] != null; | |
}).map(function(person) { | |
return person.born - byName[person.mother].born; | |
}); | |
console.log(average(differences)) |
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> | |
<body> | |
<form action=""> | |
bill amount:<br> | |
<input type="text" id="bill" value="0.00"><br> | |
tip amount:<br> | |
<input type="text" id="tip" value="0.15"><br><br> | |
</form> | |
<button onclick="calculateTip()" id="calculate">Calculate Tip</button><br> |
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 convertUnit() { | |
//check to see if the input is a number | |
var input = document.getElementById("userInput").value | |
var startUnit = document.getElementsByName("startUnit"); | |
var endUnit = document.getElementsByName("endUnit"); | |
var output = "" | |
//check to see if input is a number | |
if (isNaN(input) == true) { |
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 registerFaceRec(){ | |
misty.AddPropertyTest("FaceRec", "PersonName", "exists", "", "string"); | |
misty.RegisterEvent("FaceRec", "FaceRecognition", 1000, true); | |
} | |
registerFaceRec(); |
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 _FaceRec(data) { | |
// Check if the FaceRec event was triggered by a stranger | |
if (data.PropertyTestResults[0].PropertyValue == "unknown person"){ | |
// Misty doesn't recognize this person. Sound the alarm! | |
} | |
else { | |
// Misty knows this person. Do something else. | |
} | |
} |
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 _FaceRec(data) { | |
// Check if the FaceRec event was triggered by a stranger | |
if (data.PropertyTestResults[0].PropertyValue == "unknown person"){ | |
// Misty doesn't recognize this person. Sound the alarm! | |
} | |
else { | |
// Misty knows this person. Do something else. | |
} | |
} |
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
misty.SendExternalRequest("GET", "http://api.apixu.com/v1/current.json?key=<key>&q=Paris", null, null, "application/json", "{}") |
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 _SendExternalRequest(data) { | |
_data = JSON.parse(data.Result.ResponseObject.Data) | |
_condition = _data.current.condition.text | |
misty.Debug(_condition); | |
} |
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
misty.SendExternalRequest("POST", "https://maker.ifttt.com/trigger/blink_intruder/with/key/<key>",null,null,"","{}"); | |
misty.SendExternalRequest("POST", "https://maker.ifttt.com/trigger/text_intruder/with/key/<key>",null,null,"","{}"); |
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 _SendExternalRequest(data_response) { | |
misty.Debug(JSON.stringify(data_response)); | |
} |
OlderNewer