Skip to content

Instantly share code, notes, and snippets.

View srod's full-sized avatar

Rodolphe Stoclin srod

View GitHub Profile
@srod
srod / pad.js
Created April 30, 2013 08:04
/** * Add extra zeros in front of a number * @param str {String} * @param max {Number} * @returns {*} */
/**
* 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;
};
@srod
srod / list-cookies.js
Created October 24, 2018 10:59
List Cookies
document.cookie.split(';').reduce((cookies, cookie) => {
let [key, value] = cookie.split('=')
cookies[key.trim()] = value
return cookies
}, {})
@srod
srod / list-global-vars.js
Created October 24, 2018 11:06
List Globals Vars
(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);