Skip to content

Instantly share code, notes, and snippets.

@chathurawidanage
Last active June 18, 2019 13:23
Show Gist options
  • Save chathurawidanage/cd0e6314090675bf42dc1fc775c52e49 to your computer and use it in GitHub Desktop.
Save chathurawidanage/cd0e6314090675bf42dc1fc775c52e49 to your computer and use it in GitHub Desktop.
const { execSync } = require('child_process');
let oldRequire = require;
require = function(module) {
try{
oldRequire.resolve(`/tmp/node_modules/${module}`);
}catch(e){
execSync(`npm install --prefix /tmp --save ${module}`);
}
return oldRequire(`/tmp/node_modules/${module}`);
}
/* JUST FORGET EVERYTHING AND START YOUR CODE FROM THIS POINT ONWARDS*/
let reverseString = require('reverse-string');
let mathjs = require('mathjs');
exports.handler = (event, context, callback) => {
callback(null, reverseString(' = evitavired')+mathjs.derivative('x^2 + x', 'x'));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment