Last active
April 26, 2024 23:11
-
-
Save jpiccari/335cd95159e52e81e40d to your computer and use it in GitHub Desktop.
Chrome Snippets
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 formatString() { | |
var args = Array.apply(0, arguments); | |
return args.shift().replace(/\{(\d+)\}/g, function(match, index) { | |
return args[index] || match; | |
}); | |
} |
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($) { | |
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)); |
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() { | |
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