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
// This #include statement was automatically added by the Particle IDE. | |
#include <Adafruit_DHT_Particle.h> | |
#define DHTTYPE DHT22 | |
#define DHTPIN D4 | |
DHT dht(DHTPIN, DHTTYPE); | |
double serverTempMax = 85; | |
double serverHumidityMax = 60; |
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 <PietteTech_DHT.h> | |
#define DHTTYPE DHT22 | |
#define DHTPIN D4 | |
PietteTech_DHT DHT(DHTPIN, DHTTYPE); | |
double serverTempMax = 81; | |
double serverHumidityMax = 60; |
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
int result = DHT.acquireAndWait(2000); | |
serverTemp = DHT.getFahrenheit(); | |
serverHumidity = DHT.getHumidity(); | |
if(serverTemp>=serverTempMax && !overheatDetected){ | |
Particle.publish("server_temp", "overheat"); | |
overheatDetected = true; | |
} | |
else if(serverTemp<serverTempMax && overheatDetected){ |
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
Particle.variable("serverTemp", &serverTemp, DOUBLE); | |
Particle.variable("serverHumidity", &serverHumidity, DOUBLE); |
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
#define DHTTYPE DHT22 | |
#define DHTPIN D4 | |
PietteTech_DHT DHT(DHTPIN, DHTTYPE); | |
double serverTempMax = 81; | |
double serverHumidityMax = 60; | |
double serverTemp; | |
double serverHumidity; | |
bool overheatDetected = false; |
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 express = require('express'); | |
const router = express.Router(); | |
const rp = require('request-promise'); | |
/* GET home page. */ | |
router.get('/', function (req, res, next) { | |
res.render('index'); | |
}); | |
// Forward request directly to arduino on local network |
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
get(/databases/$(database)/documents/users/$(request.auth.uid)).data.locked == false |
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 blurImage(object, userDocRef) { | |
const filePath = object.name; | |
const bucket = gcs.bucket(object.bucket); | |
const fileName = filePath.split('/').pop(); | |
const tempLocalFile = `/tmp/${fileName}`; | |
// Download file from bucket. | |
return bucket.file(filePath) | |
.download({ | |
destination: tempLocalFile |
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
module.exports.moderateUserProfileImage = function(object) { | |
const userId = object.name.split('/')[1]; | |
const userDocRef = admin.firestore().collection('users').doc(userId); | |
return userDocRef.get() | |
.then(doc => { | |
const user = doc.data(); | |
// The image has already been moderated. | |
if (user.locked === true) { | |
console.log('already moderated!'); |
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
saveReview(review) { | |
this.reviewsRef.doc(review.id.update({ | |
...review | |
})); | |
} | |
deleteReview(id) { | |
this.reviewsRef.doc(id).delete(); | |
} |
NewerOlder