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
use strict; | |
use warnings; | |
require JSON::XS; | |
require JSON::WebToken; | |
require LWP::UserAgent; | |
my $google_ua = signin_with_google( | |
service_account_id => $SERVICE_AC_ID, | |
private_key => $PRIVATE_KEY, |
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
loginWithGoogle( | |
process.env.PROJ_TEST1_GMAIL_USER, | |
process.env.PROJ_TEST1_GMAIL_PASS | |
) | |
/** | |
* Uses the dreaded `sleep` method because finding the password | |
* by any css selector tried fails. | |
* @param {string} username - A Google username. | |
* @param {string} passphrase - A Google passpharse. |
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 Wizard = function (state) { | |
this.state = {}; | |
// pageName: null, | |
// lastPageName: null | |
// window.history.popstate();? | |
Object.keys(state).forEach((key) => { | |
this.state[key] = state[key]; | |
}); | |
this.pageEl = null; | |
this.el = { |
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
el.main.innerHTML = Handlebars.compile( | |
el.innerHTML.toString() | |
)( | |
{ myContext: this } | |
); | |
// {{#includeDomTemplate "publish-tables-and-skus"}}{{/includeDomTemplate}} | |
Handlebars.registerHelper('includeDomTemplate', function(templateId) { | |
var html = Handlebars.compile( | |
document.getElementById(templateId).innerHTML.toString() |
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 Wizard = function (access_token) { | |
this.access_token = access_token; | |
this.page = 0; | |
this.el = { | |
main: document.getElementById('main'), | |
pageNumber: document.getElementById('pageNumber') | |
}; | |
this.el.pageNumber.setAttribute('style', 'display:block"'); | |
} |
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 dns = require('dns'), cache = {}; | |
dns._lookup = dns.lookup; | |
dns.lookup = function(domain) { | |
return new Promise( (resolve, reject) => { | |
var key = domain; | |
if (key in cache) { | |
var ip = cache[key], | |
ipv = ip.indexOf('.') !== -1 ? 4 : 6; |
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
// base.js | |
function Base(options) { | |
var category; | |
// https://github.com/v8/v8/wiki/Stack-Trace-API | |
try { | |
category = ((new Error).stack.split('\n'))[2].match(/^\s+at\sBase\.(\w+)/)[1]; | |
} | |
catch (e) { | |
try { |
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
Base.prototype.ERROR = []; | |
Base.errorNames = [ | |
'PageContext', 'NotYetSupported', 'NaN', 'ColDefPropertyNotFound', | |
'ColDefValueNotFound', 'InvalidArgument', 'MissingArgument', | |
'UnknownError', 'InvalidCssSelector' | |
]; | |
Base.errorNames.forEach(function(errName) { | |
Base.prototype.ERROR[errName] = function (message) { | |
Error.captureStackTrace(this, this.constructor); |
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
/* eslint-env node, es6 */ | |
'use strict'; | |
/* @param {object|string} _logger - an instance of Log4js/object with a `log` method. If a string, should be a category (see Log4js.getLogger(category)). | |
@example | |
logger = require('logger').getLogger( gutil ); | |
*/ |
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
module.exports = Base; | |
function Base(category) { | |
try { | |
category = category || new Error().stack.match(/Base\.(\w+)/)[1]; | |
} | |
finally { | |
if (!category) { | |
throw new Error('Base requires its sub-class to supply a logging-category argument! '); | |
} | |
} |