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
import React from 'react'; | |
class OrientationDetection extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
orientation: 0 | |
} | |
} |
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
{ | |
"events": [ | |
{ | |
"id": 0, | |
"title": "Pausha S", | |
"allDay": true, | |
"start": "2017-12-31T18:30:00.000Z", | |
"end": "2017-12-31T18:30:00.000Z" | |
}, | |
{ |
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 inputJson = require('./list.json'), | |
ffmpeg = require('fluent-ffmpeg'); | |
const fileList = inputJson.paths; | |
const runFfmpeg = function(){ | |
new Promise((resolve, reject) => { | |
console.log('Starting task of combining ', fileList.length, 'files'); | |
console.log('Added file ', fileList[0], ' to the list'); | |
const ffmpegJob = ffmpeg(fileList[0]); |
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 mongodb = require('mongodb'); | |
const MongoClient = mongodb.MongoClient; | |
const config = require('../config/config'); | |
const mongoUrl = config.MONGO_URL | |
exports.connectToDb = function () { | |
return new Promise((resolve, reject) => { | |
MongoClient.connect(mongoUrl, { | |
useNewUrlParser: true | |
}, function (err, db) { |
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 winston = require('winston'); | |
const logger = new(winston.Logger)({ | |
transports: [ | |
new(winston.transports.Console)({ | |
json: false, | |
timestamp: true, | |
colorize: true, | |
}), | |
new winston.transports.File({ |
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 fs = require('fs'); | |
const deleteFileIfExists = (path) => { | |
return new Promise((resolve, reject) => { | |
try { | |
fs.stat(path, (error, file) => { | |
if (!error && file.isFile()) { | |
fs.unlinkSync(path); | |
resolve(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
const isReachable = require('is-reachable'), | |
nodemailer = require('nodemailer'); | |
function checkStats() { | |
isReachable('api.example.com').then(reachable => { | |
if (reachable === true) { | |
console.log('Server is up'); | |
} else { | |
console.log('Server is down'); | |
const transporter = nodemailer.createTransport({ |
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
/*Strored Procedure*/ | |
/* | |
CREATE PROCEDURE 'GetAllData' () | |
BEGIN | |
SELECT * FROM Employee; | |
END$$ | |
*/ | |
/* | |
* Nodejs Code |
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 express = require('express'), | |
app = express(), | |
cors = require('cors'), | |
helmet = require('helmet'), | |
mysql = require('mysql'), | |
bodyParser = require('body-parser'), | |
crypto = require('crypto'), | |
algorithm = 'aes-256-ctr', | |
password = 'zyxcba', | |
port = 3000; |