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
{ | |
"uno": { | |
"displayName": "Arduino Uno", | |
"pins": [ | |
{"pinNumber": 1, "supportedTypes": ["flow", "onewire-temp", "onewire-presence", "relay", "id-12-rfid", "buzzer" ]}, | |
{"pinNumber": 2, "supportedTypes": ["flow", "onewire-temp", "onewire-presence", "relay", "id-12-rfid", "buzzer" ]}, | |
{"pinNumber": 3, "supportedTypes": ["onewire-temp", "onewire-presence", "relay", "id-12-rfid", "buzzer" ]}, | |
{"pinNumber": 4, "supportedTypes": ["onewire-temp", "onewire-presence", "relay", "id-12-rfid", "buzzer" ]} | |
], | |
"image": "http://kegbot.org/arduino/images/uno.jpg" |
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
<?php | |
$ss = isset($_GET['ss']) ? $_GET['ss'] : "peace"; //use a default search term for testing | |
$client = new SoapClient("http://tctvsbs.tctv.net/CablecastWS/CablecastWS.asmx?wsdl", array('cache_wsdl' => 0)); | |
$channels = array( | |
array("name" => "Channel 3", "id" => 1), | |
array("name" => "Channel 22", "id" => 4), | |
array("name" => "Channel 26", "id" => 5), |
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
<?php | |
date_default_timezone_set('America/New_York'); | |
$client = new SoapClient('http://frontdoor.ctn5.org/CablecastWS/CablecastWS.asmx?WSDL', array('cache_wsdl' => 0)); | |
$searchLength = strtotime(date("Y-m-d")."T".date("H:i:s")) + (60*60*24*35); | |
$channelID = 1; | |
$showID = 1; | |
$schedule = $client->GetScheduleInformation(array( | |
'ChannelID' => $channelID, | |
'FromDate' => date("Y-m-d")."T00:00:00", |
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 module = function(){ | |
var privateVar = “I’m out of scope since function executes and returns”; | |
//getPrivateVar is a property of the returned function. | |
this.getPrivateVar = function() { | |
return privateVar; | |
} | |
}(); // () causes anonymous function to automatically execute | |
module.getPrivateVar === “I’m out of scope since function executes and returns”; //true |
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
//Include required modules and setup some variables | |
var reportsRepo = require('ReportsRepository'), | |
routingServ = require('RoutingService'), | |
TIMEOUT = 1000 * 60 * 5; // 5 minutes | |
setTimeout(function(){ | |
//Lookup all unresolved reports that should be resolved due to current time | |
reportsRepo.getUnresolvedTimeReports(function(err, data){ | |
//Itterate through each report | |
for(report in data) { |
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
exports.getRoute = function(startLat, startLon, endLat, endLon, routeType, costTable, callback(err, data)) { | |
//Return GeoJson route from pgRouting | |
//Execute callback | |
} | |
exports.updateCost = function(lat, lon, costTable, costDelta) { | |
//Update the cost of closest edge in costTable by costDelta | |
//Execute callback | |
} |
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
exports.createReport = function(report, callback(err, data)) { | |
//Persist the report object to database | |
//Update cost tables if needed | |
//Execute callback | |
} | |
exports.updateReport = function(report, callback(err, data)) { | |
//Update report object in database | |
//Update cost tables if needed | |
//Execute callback |
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
//Anything not exported would be private and not accessible from the loaded module. | |
var privateVariable = 'I would be hidden'; | |
//Public Method | |
//Async geocodes array of search strings and calls callback with array of response when finished | |
exports.geocode = function(searchArray, callback(responseArray)) { | |
// Asynchronously geocode search array then execute callback | |
} |
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
//Anything not exported would be private and not accessible from the loaded module. | |
var privateVariable = 'I would be hidden'; | |
//Public Method | |
//Returns JSON object of invalid properties and error descriptions | |
exports.validateReport = function(report) { | |
var errors = undefined; | |
//Return an object of propertyName : errorMessages for all invalid fields |
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
// api/routes?start=300 main st boston&end=550 elm st boston&cost_table=popularity&route_type=cycle | |
app.get('api/routes', function(req,res){ | |
//Parse Request for parameters | |
var start = req.params.start, | |
end = req.params.end, | |
costTable = req.params.cost_table, | |
routeType = req.params.route_type; | |
//Geocode Start and End | |
geoCoder.geocode([start,end], function(geoCodedResponse){ | |