Skip to content

Instantly share code, notes, and snippets.

Avatar

Puneeth Shetty shettypuneeth

View GitHub Profile
View befunctional.js
const withLogs = (fn) => (a, b) => {
console.log(a, b);
return fn(a, b);
}
const add = withLogs((a, b) => a + b);
@shettypuneeth
shettypuneeth / async-asset-loader.js
Last active Oct 27, 2017
Lazy load JS and CSS assets
View async-asset-loader.js
var ASSET_TYPE = {
css: 'css',
js: 'js'
};
function loadCss(source) {
return new Promise(function(resolve, reject) {
var link = document.createElement('link');
link.type = "text/css";
link.rel = "stylesheet";