This file contains hidden or 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
| exports.handler = (event, context, callback) => { | |
| let request = event.Records[0].cf.request; | |
| const uri = request.uri; | |
| const host = request.headers.host[0].value; | |
| // Check whether the URI is missing a file name. | |
| if (uri !== '/' && !uri.match(/\./gi) && !uri.endsWith('/')) { | |
| request.uri += '/index.html'; | |
| } |
This file contains hidden or 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
| (function initDataLayerWithUserId(key, newVal) { | |
| /** | |
| * This function is used to establish the GTM dataLayer with | |
| * a predefined key/value pair. The end use case is to push | |
| * an object like {userId: "abc123"} into the dataLayer. The | |
| * extra logic to get here checks to see if there is already | |
| * a cookie with the value saved. | |
| * | |
| * Parameters: | |
| * key: <string> the key you want to set |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
| { | |
| "00601": [18.180555, -66.749961], | |
| "00602": [18.361945, -67.175597], | |
| "00603": [18.455183, -67.119887], | |
| "00606": [18.158345, -66.932911], | |
| "00610": [18.295366, -67.125135], | |
| "00612": [18.402253, -66.711397], | |
| "00616": [18.420412, -66.671979], | |
| "00617": [18.445147, -66.559696], | |
| "00622": [17.991245, -67.153993], |
This file contains hidden or 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
| var https = require('https'); | |
| exports.handler = function(event, context) { | |
| var post_options = { | |
| host: 'api.barkly.us', | |
| path: '/parse/jobs/morning_job', | |
| method: 'POST', | |
| headers: { | |
| 'X-Parse-Application-Id': 'XXXXXXXXXXXXXXXXX', |
This file contains hidden or 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
| function compressImg(source_img_obj, quality, maxWidth, output_format){ | |
| var mime_type = "image/jpeg"; | |
| if(typeof output_format !== "undefined" && output_format=="png"){ | |
| mime_type = "image/png"; | |
| } | |
| maxWidth = maxWidth || 1000; | |
| var natW = source_img_obj.naturalWidth; | |
| var natH = source_img_obj.naturalHeight; | |
| var ratio = natH / natW; |