Webpack and external libraries

According to the Webpack documentation, you can use the externals property on the config object “to specify dependencies for your library that are not resolved by webpack, but become dependencies of the output. This means they are imported from the enviroment while runtime [sic].” The example on that page illustrates it really well, using jQuery. … Read more

Load Lua-files by relative path

There is a way of deducing the “local path” of a file (more concretely, the string that was used to load the file). If you are requiring a file inside lib.foo.bar, you might be doing something like this: require ‘lib.foo.bar’ Then you can get the path to the file as the first element (and only) … Read more

Node.js – check if module is installed without actually requiring it [duplicate]

You should use require.resolve() instead of require(). require will load the library if found, but require.resolve() will not, it will return the file name of the module. See the documentation for require.resolve try { console.log(require.resolve(“mocha”)); } catch(e) { console.error(“Mocha is not found”); process.exit(e.code); } require.resolve() does throw error if module is not found so you … Read more

How can I require an optional Perl module if installed?

Here’s a bare-bones solution that does not require another module: my $rc = eval { require Term::ReadKey; Term::ReadKey->import(); 1; }; if($rc) { # Term::ReadKey loaded and imported successfully … } Note that all the answers below (I hope they’re below this one! 🙂 that use eval { use SomeModule } are wrong because use statements … Read more

Is there a pluralize function in Ruby NOT Rails?

Actually all you need to do is require ‘active_support/inflector’ and that will extend the String type. you can then do “MyString”.pluralize which will return “MyStrings” for 2.3.5 try: require ‘rubygems’ require ‘active_support/inflector’ should get it, if not try sudo gem install activesupport and then the requires.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)