Skip to content

Instantly share code, notes, and snippets.

Avatar

Rodolphe Stoclin srod

View GitHub Profile
View list-global-vars.js
(function(){
var iframe = document.createElement('iframe');
iframe.src = 'about:blank';
document.body.appendChild(iframe);
var windowVars = Object.keys(iframe.contentWindow);
var globalVars = Object.keys(window).filter(key => !windowVars.includes(key));
console.log('global Vars:', globalVars);
document.body.removeChild(iframe);
View list-cookies.js
document.cookie.split(';').reduce((cookies, cookie) => {
let [key, value] = cookie.split('=')
cookies[key.trim()] = value
return cookies
}, {})
@srod
srod / pad.js
Created Apr 30, 2013
/** * Add extra zeros in front of a number * @param str {String} * @param max {Number} * @returns {*} */
View pad.js
/**
* Add extra zeros in front of a number
* @param str {String}
* @param max {Number}
* @returns {*}
*/
var pad = function(str, max) {
return str.toString().length < max ? pm.utils.pad('0' + str, max) : str;
};
You can’t perform that action at this time.