Skip to content

Instantly share code, notes, and snippets.

@dblencowe
Created January 21, 2016 15:56
Show Gist options
  • Select an option

  • Save dblencowe/40edcd2d3ddd0a74fdeb to your computer and use it in GitHub Desktop.

Select an option

Save dblencowe/40edcd2d3ddd0a74fdeb to your computer and use it in GitHub Desktop.
// The following is pseudo code
response = ['lounge', 'main', 'on'];
device = "";
response.each(function (word){
device += word; // pop it here so the word is actually removed
response.splice(response.indexOf(word));
rst = database.select("SELECT FROM devices WHERE name = " + command);
if (rst.length == 1) {
jsonCommand = interpretCommand(response);
server.call(device, jsonCommand);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment