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
export function chunkData(array: unknown[], chunk = 10) { | |
let i, j; | |
const newArray = []; | |
for (i = 0, j = array.length; i < j; i += chunk) { | |
newArray.push(array.slice(i, i + chunk)); | |
} | |
return newArray; | |
} |
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
#!/usr/bin/env bash | |
# run: bash ngxdisable.sh <your site at sites-available> | |
if [ $EUID -ne 0 ]; then | |
echo "You must be root: \"sudo ngxdis\"" | |
exit 1 | |
fi | |
# -z str: Returns True if the length of str is equal to zero. | |
if [ -z "$1" ]; then | |
echo "Please choose a site." |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Debug Alexa Skill (Node.js)", | |
"type": "node", | |
"request": "launch", | |
"program": "${workspaceFolder}/node_modules/ask-sdk-local-debug/dist/LocalDebuggerInvoker.js", | |
"preLaunchTask": "tsc: watch - tsconfig.json", | |
"args": [ |
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
node_modules | |
dist/ | |
yarn.lock | |
wwwroot |
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 alert() { | |
local notification_command="display notification \"$2\" with title \"$1\" subtitle \"$3\" sound name \"$4\"" | |
osascript -e "$notification_command" | |
} |
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 dotenv = require('dotenv'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const envSampleFilename = ".env.example"; //Create your own .env.example at root with dummy data and commit this file. | |
const envSample = fs.readFileSync(path.join(process.cwd(), envSampleFilename)).toString(); | |
const buf = Buffer.from(envSample) | |
const sampleConfig = dotenv.parse(buf); // will return an object | |
const envsToValidade = Object.keys(sampleConfig); | |
module.exports = { |
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
#MONGOD REPLICASET: https://docs.mongodb.com/manual/tutorial/deploy-replica-set-for-testing/ | |
export MONGO_DIR=~/mongodb | |
mongod --replSet rs0 --port 27017 --bind_ip localhost --dbpath ${MONGO_DIR}/rs0-1 --logpath "${MONGO_DIR}/rs0-1.log" --smallfiles --oplogSize 128 --fork & | |
mongod --replSet rs0 --port 27018 --bind_ip localhost --dbpath ${MONGO_DIR}/rs0-2 --logpath "${MONGO_DIR}/rs0-2.log" --smallfiles --oplogSize 128 --fork & | |
mongod --replSet rs0 --port 27019 --bind_ip localhost --dbpath ${MONGO_DIR}/rs0-3 --logpath "${MONGO_DIR}/rs0-3.log" --smallfiles --oplogSize 128 --fork | |
# Login via mongo shell: | |
# rsconf = { | |
# _id: "rs0", |
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
{"contents":{"launch":{"version":"0.2.0","configurations":[{"type":"node","request":"launch","name":"Launch Program","program":"${workspaceFolder}/start"}]}},"overrides":[],"keys":["launch.version","launch.configurations"]} |