Skip to content

Instantly share code, notes, and snippets.

Cameron Manavian camsjams

Block or report user

Report or block camsjams

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@camsjams
camsjams / guide.md
Last active Aug 2, 2019
How to upgrade a Node JS Express project using Swagger-Express
View guide.md

How to upgrade a Node JS Express project using Swagger

Migrate [swagger-express-mw] / and underlying [swagger-node-runner] to [express-openapi]

Intro

Why do this?

There have been a number of high and critical vulnerabilities caused by the npm package.

I myself have been hunting through ways to figure out how to solve these problems, as the package maintainers seem to have abandonded this library (there was even an NPM fork which still seems to have issues with bagpipes - see [swagger-node-runner year old PR]). I have created a basic guide to help others out, so that I am not just another DenverCoder9 (https://xkcd.com/979/)

[npm audit] and [snyk] scans find issues like:

@camsjams
camsjams / circleci-slack-merge-message.sh
Last active Apr 24, 2018
CircleCI merge develop message to slack [MIT]
View circleci-slack-merge-message.sh
#! /bin/bash
# Description: Call this from your CircleCi config after your deploys have been completed
#
# Set the following variables:
# ENVIRONMENT - the name of the environment the deploy went to, ex: "dev", "staging", "production"
# CHANNEL - the slack channel you want to post to
# WEBHOOK - the slack webhook url you created
# PROJECT_NAME - this defaults to looking in a package.json for the "name", customize to your liking and language
ENVIRONMENT="test"
@camsjams
camsjams / circleci-slack-deploy-message.sh
Last active Apr 20, 2018
CircleCI deploy message to slack [MIT]
View circleci-slack-deploy-message.sh
#! /bin/bash
# Description: Call this from your CircleCi config after your deploys have been completed
#
# Set the following variables:
# ENVIRONMENT - the name of the environment the deploy went to, ex: "dev", "staging", "production"
# CHANNEL - the slack channel you want to post to
# WEBHOOK - the slack webhook url you created
# PACKAGE_VERSION - this defaults to looking in a package.json for the "version", customize to your liking and language
# PROJECT_NAME - this defaults to looking in a package.json for the "name", customize to your liking and language
@camsjams
camsjams / jscpdReporter.js
Last active Feb 18, 2016
sample reporter that exits process with non-zero exit code, useful for continuous integration tests
View jscpdReporter.js
const DUPLICATION_LIMIT = 100;
const FILE_SPAN_LIMIT = 2;
module.exports = function() {
/**
* @see node_modules/jscpd/src/report.coffee
*/
if (this.map.numberOfDuplication > DUPLICATION_LIMIT || this.map.numberOfFiles > FILE_SPAN_LIMIT) {
console.error('Copy Paste detection found too many files over threshold.\n');
console.error(this.stdReporter());
View node-profiler-lite.js
var startTime;
function start() {
startTime = new Date().getTime();
}
function stop() {
var endTime = new Date().getTime(),
diff = (endTime - startTime);
console.log('\nTime taken: ' + format(diff) + '\n');
You can’t perform that action at this time.