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> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"> | |
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script> | |
<body> | |
<div style="max-width:900px; -webkit-transform:rotate(0deg)"> | |
<scene id="scene1"> | |
<drawing t="translate(0,31)"> | |
<line stroke="green"> |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
exports.sensorHubEvent = (sensorHubEvent, eventResolved) -> | |
alertText = switch sensorHubEvent | |
when 1 then 'Water detect' | |
when 2 then 'Motion detect' | |
when 3 then 'Low temperature' | |
when 4 then 'High temperature' | |
when 5 then 'Low humidity' | |
when 6 then 'High humidity' | |
when 7 then 'Low light' | |
when 8 then 'High light' |
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
formatted = { | |
prefix: 'HC2', | |
sequenceNumber: '0100', | |
networkHubMAC: '533F15800700', | |
action: '01', | |
sensorHubMAC: '103E15800700', | |
nbrOfBytes: '10', | |
temperatureMax: '2000', | |
temperatureMin: '0000', | |
lightMax: 'ffff', |
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
{ | |
sequenceNumber: '0100', | |
networkHubMAC: '533F15800700', | |
action: '01', | |
sensorHubMAC: '103E15800700', | |
nbrOfBytes: '10', | |
temperatureMax: '2000', | |
temperatureMin: '0000', | |
lightMax: '8403', | |
lightMin: '0100', |
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
# A program to print a receipt after gas is pumped | |
# Import statements | |
import datetime | |
# Global variable declaration | |
numberOfGallons = 13.000 | |
costPerGallon = 2.05 | |
totalCost = numberOfGallons * costPerGallon | |
stationName = "Chevron" |
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
fields = switch req.query.msgType | |
when '0' then ['timestamp', 'macAddress', 'gatewayBattery', 'rssi'] | |
when '2' then ['timestamp', 'macAddress', 'gatewayBattery', 'gatewayEventCode', 'rssi'] | |
when '4' then ['timestamp', 'macAddress', 'sensorEventStart', 'sensorEventEnd', 'rssi', 'sensorHubBattery', 'sensorHubMacAddress', 'sensorHubRssi'] | |
when '5' then ['timestamp', 'macAddress', 'rssi', 'numberOfSensors', 'sensorHubBattery', 'sensorHubData1', 'sensorHubData2', 'sensorHubData3', 'sensorHubMacAddress', 'sensorHubRssi', 'sensorHubType'] |
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> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script> | |
<script> | |
$(document).ready(function(){ | |
function debug(str){ $("#debug").append("<p>"+str+"</p>"); }; | |
if(typeof WebSocket === 'undefined') { | |
alert("Your browser does not support websockets.") | |
} |
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
/** | |
* Render templates. | |
* | |
* @param {String} The template to use `<p>Hello {{name}}</p>` | |
* @param {String} The data `{ name: 'Alex' }` | |
* @return {String} The rendered template | |
**/ | |
function template(t, d) { | |
return t.replace(/{{([^}]*)}}/g, function(m, f, p, a) { | |
return d[f] || ''; |
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
Foo = {}; | |
Foo.bar = function(){ | |
alert("test"); | |
} | |
setTimeout(Foo.bar, 1000); // 1 second later, alert's "test" |
OlderNewer