Call a “local” function within module.exports from another function in module.exports?

Source: https://stackoverflow.com/questions/10462223/call-a-local-function-within-module-exports-from-another-function-in-module-ex

I think I got it. I just changed this.foo() to module.exports.foo() and it seems to be working.
If someone has a better or more proper method, please feel free to correct me.

Another option, and closer to the original style of the OP, is to put the object you want to export into a variable and reference that variable to make calls to other methods in the object. You can then export that variable and you're good to go.
var self = {
  foo: function (req, res, next) {
    return ('foo');
  },
  bar: function (req, res, next) {
    return self.foo();
  }
};
module.exports = self;

crontab standard format

Source: https://stackoverflow.com/questions/14710257/running-a-cron-job-at-230-am-everyday
Following the crontab standard format:
 +---------------- minute (0 - 59)
 |  +------------- hour (0 - 23)
 |  |  +---------- day of month (1 - 31)
 |  |  |  +------- month (1 - 12)
 |  |  |  |  +---- day of week (0 - 6) (Sunday=0 or 7)
 |  |  |  |  |
 *  *  *  *  *  command to be executed
It is also useful to use crontab.guru to check crontab expressions.

You can use the cron format:
var event = schedule.scheduleJob("*/5 * * * *", function() {
        console.log('This runs every 5 minutes');
    });
The cron format consists of:
*    *    *    *    *    *
                    
                    |
                     day of week (0 - 7) (0 or 7 is Sun)
                └───── month (1 - 12)
            └────────── day of month (1 - 31)
        └─────────────── hour (0 - 23)
    └──────────────────── minute (0 - 59)
└───────────────────────── second (0 - 59, OPTIONAL)

Exporting and Importing An Individual MySQL Table

Source: https://steveswanson.wordpress.com/2009/04/21/exporting-and-importing-an-individual-mysql-table/

In moving databases from development to production it is sometimes necessary to export individual tables so that they can be imported into another database.
Exporting the Table
To export the table run the following command from the command line:
“mysqldump -p – –user=username dbname tableName > tableName.sql
This will export the tableName to the file tableName.sql.
[NOTE: there should be no space between the two dashes, but I have to write it that way so that it display properly].
Importing the TableTo import the table run the following command from the command line:
mysql -u username -p -D dbname < tableName.sql
The path to the tableName.sql needs to be prepended with the absolute path to that file. At this point the table will be imported into the DB and you are ready to go!
I ran into this issue when attempting to add new tables to my database. I am unable to run the “LOAD DATA INFILE” command, that I had previously used to populate tables, because Webfaction does not give the permission to run the command. Therefore the simplest solution was to export a table from the MySQL database on my personal machine and then import it to the database on the Webfaction server, using the export/import commands seen above.
Hope this helps someone out with exporting individual tables and as always if any clarification is needed or I missed something feel free to let me know.
–Steve

How to Open the Command Prompt as Administrator in Windows 8 or 10

Source: https://www.howtogeek.com/194041/how-to-open-the-command-prompt-as-administrator-in-windows-8.1/

Press Windows+R to open the “Run” box. Type “cmd” into the box and then press Ctrl+Shift+Enter to run the command as an administrator.

OR


JavaScript: Creating timestamps with time zone offsets

Source: https://dzone.com/articles/javascript-creating-timestamps

Date.getTime() returns UTC

When you call getTime method on Date object you get the number of milliseconds from Unix epoch. Although your current Date object keeps time with some offset getTime gives seconds in UTC. Keep this in mind when creating timestamps if you are not living on zero-meridian.
var currentDate = selectedDate;          // current date with offset

var currentTime = currentDate.getTime(); // offset is ignored
This is pretty awkward, unexpected and unintuitive behavior but you have to keep in mind that all date and time calculations must use same time system to give appropriate results.

How to check a not-defined variable in JavaScript

Source: https://stackoverflow.com/questions/858181/how-to-check-a-not-defined-variable-in-javascript


In JavaScript, null is an object. There's another value for things that don't exist, undefined. The DOM returns null for almost all cases where it fails to find some structure in the document, but in JavaScript itself undefined is the value used.
Second, no, there is not a direct equivalent. If you really want to check for specifically for null, do:
if (yourvar === null) // Does not execute if yourvar is `undefined`
If you want to check if a variable exists, that can only be done with try/catch, since typeof will treat an undeclared variable and a variable declared with the value of undefined as equivalent.
But, to check if a variable is declared and is not undefined:
if (typeof yourvar !== 'undefined') // Any scope
If you know the variable exists, and want to check whether there's any value stored in it:
if (yourvar !== undefined)
If you want to know if a member exists independent but don't care what its value is:
if ('membername' in object) // With inheritance
if (object.hasOwnProperty('membername')) // Without inheritance
If you want to to know whether a variable is truthy:
if (yourvar)

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...