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
const knex = require('knex'); | |
module.exports = class Cloud { | |
constructor(enviroment) { | |
// Object | |
this.knex = knex; | |
// Variables | |
this.enviroment = enviroment; | |
} |
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
const Routes = require('./Routes'); | |
const App = require('./App.js'); | |
const routes = new Routes(); | |
const app = new App(routes).server; | |
app.listen(3000); | |
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
const express = require('express'); | |
const cors = require('cors'); | |
const { errors } = require('celebrate'); | |
module.exports = class App { | |
constructor(routes) { | |
this.routes = routes; | |
this.server = express(); | |
this.middleware(); | |
this.router(); |
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
const { celebrate } = require('celebrate'); | |
const express = require('express'); | |
const SensorDTO = require('../model/SensorDTO'); | |
const SensorRule = require('../rule/SensorRule'); | |
const SensorController = require('../controller/SensorController'); | |
module.exports = class Routes { | |
constructor() { | |
this.routes = express.Router(); |
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
const moment = require('moment-timezone'); | |
module.exports = class SensorRule { | |
static date(req, res, next) { | |
try { | |
const { timestamp } = req.body; | |
const dateFull = new Date(timestamp).getTime(); | |
const date = moment(dateFull).tz('UTC').format('YYYY/MM/DD HH:mm:ss.SSSSSSSSS'); |
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
const { Segments, Joi } = require('celebrate'); | |
module.exports = class SensorDTO { | |
static getSensorTimestamps() { | |
return { | |
[Segments.QUERY]: Joi.object().keys({ | |
name: Joi.string().required(), | |
}), | |
}; | |
} |
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 <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main () { | |
char str[80] = "step(145621900,54544660)"; | |
char duty[10]; | |
char time[20]; | |
int firstP = strcspn(str, "("); | |
int secondP = strcspn(str, ","); |
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
function cell2csv(fileName, cellArray, append, separator, excelYear, decimal) | |
% Writes cell array content into a *.csv file. | |
% | |
% CELL2CSV(fileName, cellArray, append, separator, excelYear, decimal) | |
% | |
% fileName = Name of the file to save. [ i.e. 'text.csv' ] | |
% cellArray = Name of the Cell Array where the data is in | |
% append = false to open a new file, or true to go on with the existent. | |
% separator = sign separating the values (default = ';') | |
% excelYear = depending on the Excel version, the cells are put into |
NewerOlder