Skip to content

Instantly share code, notes, and snippets.

@jpiccari
Last active April 26, 2024 23:11
Show Gist options
  • Save jpiccari/335cd95159e52e81e40d to your computer and use it in GitHub Desktop.
Save jpiccari/335cd95159e52e81e40d to your computer and use it in GitHub Desktop.
Chrome Snippets
function formatString() {
var args = Array.apply(0, arguments);
return args.shift().replace(/\{(\d+)\}/g, function(match, index) {
return args[index] || match;
});
}
(function($) {
var version = '2.1.1',
jqueryUrl = '//ajax.googleapis.com/ajax/libs/jquery/' + version + '/jquery.min.js',
script;
if (typeof $ === 'undefined') {
script = document.createElement('script');
script.src = jqueryUrl;
script.onload = function() {
console.log('jQuery %s loaded.', version);
};
document.body.appendChild(script);
} else {
console.log('jQuery %s already loaded.', $.fn.jquery);
}
}(jQuery));
(function() {
var moduleList = []
module,
key;
if (typeof requirejs !== 'undefined') {
console.groupCollapsed('%cRequire.js v%s module list', 'color: #0080ff; font: 1.4em Menlo, monospace', requirejs.version);
for (key in requirejs.s.contexts._.defined) {
module = requirejs.s.contexts._.defined[key];
moduleList.push({
Name: key,
Module: module
});
}
console.table(moduleList);
console.groupEnd();
} else {
console.log('Require.js not loaded.');
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment