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
const { spawn } = require('child_process'); | |
const python = spawn('python', ['/path/to/myscript.py']); | |
python.stdout.on('data', (data) => { | |
// This is the output from the Python Script: | |
console.log(`stdout: ${data}`); | |
}); | |
python.stderr.on('data', (data) => { |
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 location = {"bounds": [{"lat":42.34398047870971,"lng":-71.10525637865067},{"lat":42.34413114540996,"lng":-71.10488891601562},{"lat":42.34408554894667,"lng":-71.10476285219193},{"lat":42.34398444362749,"lng":-71.10463410615921},{"lat":42.34367716175749,"lng":-71.10504180192947},{"lat":42.343764390311954,"lng":-71.10523492097855},{"lat":42.343895232916715,"lng":-71.10531806945801}]}]; | |
map = new google.maps.Map(document.getElementById('map'), { | |
center: {lat: 42.34398047870971, lng: -71.10525637865067}, | |
zoom: 18 | |
}); | |
var polygon = new google.maps.Polygon({ | |
paths: location.bounds, | |
strokeColor: '#FF0000', |
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
//https://github.com/expressjs/session | |
//https://github.com/broofa/node-uuid | |
//https://github.com/JamesMGreene/nedb-session-store | |
var express = require('express'); | |
var app = express(); | |
var session = require('express-session'); | |
var nedbstore = require('nedb-session-store')(session); | |
const uuidV1 = require('uuid/v1'); |
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 dateFormatter(date) { | |
//YYYY-MM-DD | |
var year = date.getUTCFullYear(); | |
var month = date.getUTCMonth(); | |
month++; // months begin at 0 for some reason | |
if (month < 10) { | |
month = "0" + month; // add a leading 0 | |
} | |
var day = date.getUTCDate() | |
if (day < 10) { |
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
//https://developer.mozilla.org/en-US/docs/Web/Events/deviceorientation | |
var alpha = 0; // Orientation around Z axis | |
var beta = 0; // Orientation around X axis | |
var gamma = 0; // Orientation around Y axis | |
function setup() { | |
createCanvas(200,200); | |
if (window.DeviceOrientationEvent) { | |
window.addEventListener('deviceorientation', onOrientationChange); |
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
#include <Bridge.h> | |
#include <Process.h> | |
// make a new Process for calling Node | |
Process p; | |
String message = ""; | |
char sensorStr[3]; | |
void setup() { |
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
<html> | |
<head> | |
</head> | |
<body> | |
<div style="width: 1000px; height: 1000px"> | |
<div id="dragme" style="position: absolute; left: 10px; top: 10px;">hi</div> | |
</div> | |
<script type="text/javascript"> |
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
<html><head> | |
<script type="text/javascript"> | |
var createImage = function(source) { | |
var img=document.createElement("IMG"); | |
img.src = source; | |
// don't forget to add it to the document | |
}; | |