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
# Whenever a new commit is added to 'master', this build will trigger. | |
trigger: | |
- master | |
# Use an Azure VM with Ubuntu to build this poroject. | |
pool: | |
vmImage: 'ubuntu-latest' | |
# Our first step preps the VM to build our project. | |
steps: |
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
# Stored in "~/Documents/Windows PowerShell". Any commands in this file will be executed when a session is launched. | |
function prompt { | |
"PS ($(Split-Path -leaf -path (Get-Location)))> " | |
} |
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
if((Get-IISSite -Name "IisSiteName") -eq $true) { | |
# The site exists, do something | |
} else { | |
# The site doesnt exist. | |
} |
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 | |
docker-compose down -v # Takes down the docker containers including named volumes | |
docker-compose build # Build the image | |
docker-compose up -d # Start the container |
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 Discord = require('discord.js'); | |
const client = new Discord.Client(); | |
// When the bot is ready, log out a message. | |
client.on('ready', () => { | |
console.log(`Logged in as ${client.user.tag}!`); | |
}); | |
// When a message is received that starts with 'hello', respond with 'world!' | |
// This is where you would handle various commands that your bot responds to. |
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
using System; | |
using NSubstitute; | |
using Stage.Data; | |
using System.IO; | |
using System.Linq; | |
using System.Security.Principal; | |
using System.Web; | |
namespace FakerTools | |
{ |
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 CognitoExpress = require('cognito-express') | |
exports.validateToken = (req, res, next) => { | |
if (req.headers && req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') { | |
let cognitoConfig = { | |
region: process.env.COGNITO_REGION, | |
cognitoUserPoolId: process.env.COGNITO_USERPOOL_ID, | |
tokenUse: 'id', | |
tokenExpiration: 3600000 | |
} |
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
async function asyncForEach(array, callback) { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array); | |
} | |
} | |
// Usage: | |
// await asyncForEach(myArray, async (element) => { | |
// await someLongRunningOperation(element); | |
// await someOtherLongRunningOp(element); |
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 rng (min, max) { | |
var num = Math.random() * (max - min) + min; | |
return Math.floor(num) | |
} |
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
async function sleep (ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} |