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
/** | |
Say you have some methods in an object, and they rely on the context (this). | |
If you want to use them providing context, you typically would use Function.prototype.bind, apply or call | |
(maybe storing the bound methods in a new object, going through all the methods). | |
ES6 Proxies (only available on Node as I write this) provide an alternative to building a second object, | |
while still not having to pass the context on every call. | |
Is it better ? | |
Memory-wise, I'd say yes (though a hash of bound methods should seldom be a memory issue). |
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 node | |
"use strict"; | |
const https = require('https'); | |
const linesToJsonArray = data => console.log(JSON.stringify(data.split('\n'), null, 2)); | |
const firstArg = process.argv[2]; | |
const url = firstArg ? firstArg.trim() : null; | |
if (!url || !url.startsWith('https://')) { | |
console.error('Please pass an HTTPS URL, with the protocol, as the 1st argument'); |
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
Parse.Cloud.job("saveCurrentDayItems", function(request, response) { | |
var utcDate = new Date(); | |
var utcHour = utcDate.getHours(); | |
utcDate.setHours(utcHour-4); | |
var currentDate = utcDate; | |
var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; | |
//var months = ['January','February','March','April','May','June','July','August','September','October','November','December']; | |