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
'use strict'; | |
const Hapi = require('hapi'); | |
const server = new Hapi.Server(); | |
server.connection({ port: 8000 }); | |
// test by using this on command line: | |
// http GET localhost:8000 | |
server.ext('onRequest', (request, response) => { | |
console.log('onRequest'); |
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
'use strict'; | |
const Hapi = require('hapi'); | |
const server = new Hapi.Server(); | |
server.connection({ port: 8000 }); | |
// test by using this on command line: | |
// http -v --form POST localhost:8000 fname=Kevin lname=Boutin | |
server.route({ | |
method: ['POST', 'PUT'], |
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
'use strict'; | |
const Hapi = require('hapi'); | |
const server = new Hapi.Server(); | |
server.connection({ port: 8000 }); | |
// test by using this on browser: | |
// http://localhost:8000/kevin | |
server.register(require('vision'), () => { | |
server.views({ |
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
'use strict'; | |
const Hapi = require('hapi'); | |
const Path = require('path'); | |
const server = new Hapi.Server(); | |
server.connection({ port: 8000 }); | |
// test by using this on browser: | |
// http://localhost:8000/hapi.png | |
server.register(require('inert'), () => { |
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
/** | |
* VIN decoder. | |
* | |
* kevinboutin on 3/11/18. | |
* | |
* My VIN for testing is WBA3A5G59DNP26082 so use the following command to invoke: | |
* node vindecoder WBA3A5G59DNP26082 | |
* | |
* Examples: | |
* KM8JM12D56U303366 |
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
{ | |
"extends": "google", | |
"plugins": [], | |
"parserOptions": { | |
"ecmaVersion": 6, | |
"sourceType": "module" | |
}, | |
"settings": { | |
"import/core-modules": [ | |
"aws-sdk" |
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
// Designed for Azure functions | |
module.exports = function (context, req) { | |
context.log('JavaScript HTTP trigger function processed a request.'); | |
const scheduledEvents = []; | |
//Add all scheduled events into an array | |
req.body.forEach(function (calendar) { | |
calendar.items.forEach(function (items) { | |
scheduledEvents.push({ | |
start: new Date(items['start']).toLocaleTimeString('en-US', { hour12: false }), |
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 { ServiceBusClient } = require('@azure/service-bus'); | |
const moment = require('moment'); | |
const connectionString = process.env.SB_CONNECTION; | |
const queueName = process.env.SB_QUEUE_NAME; | |
const listOfScientists = [ | |
{ | |
id: 1, | |
name: "Einstein", |
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 { ServiceBusClient } = require('@azure/service-bus'); | |
const moment = require('moment'); | |
const connectionString = process.env.SB_CONNECTION; | |
const queueName = process.env.SB_QUEUE_NAME; | |
/** | |
* Processing messages from service bus queue. | |
* | |
* @param {object} context The context. |
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
#!/bin/bash | |
mycommand & | |
child_pid=$! | |
while kill -0 $child_pid >/dev/null 2>&1; do | |
echo "Child process is still running" | |
sleep 1 | |
done |