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
'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 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 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 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 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 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 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 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 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 |
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 is a custom theme template for gitprompt.sh and is used here: https://github.com/magicmonty/bash-git-prompt | |
# Install this package using: brew install bash-git-prompt | |
# Copy this file to $(brew --prefix)/opt/bash-git-prompt/share/themes/ | |
# Add the following code to your ~/.bash_profile | |
# if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then | |
# __GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share | |
# GIT_PROMPT_ONLY_IN_REPO=1 | |
# GIT_PROMPT_THEME=Solarin | |
# source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" | |
# fi |