This file contains 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
const arrOfMaps = new Array(40000).fill(0).map((k,i) => { | |
return { [i]:`testdsfsdfdsfsdfsdfsdf${i}`}; | |
}) | |
console.time('functional') | |
const finalMap = arrOfMaps.reduce((acc, current) => ({ ...acc, ...current }), {}); | |
console.log('finalMap keys', Object.keys(finalMap).length); | |
console.timeEnd('functional') | |
console.time('object assign') |
This file contains 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
var linkifyExtension = (function(){ | |
var LINKIFY_EXTENSION_CLASS = 'linkify-phone-match'; | |
var EXCLUDE_NODES = ['script', 'style', 'input', 'select', 'textarea', 'button', 'a', 'code', 'head', 'noscript']; | |
var PHONE_MATCHERS = { | |
US : { | |
reg : /(^|\s)((\+1\d{10})|((\+1[ \.])?\(?\d{3}\)?[ \-\.\/]{1,3}\d{3}[ \-\.]{1,2}\d{4}))(\s|$)|(^|\s)\+(?:[0-9] ?){6,14}[0-9](\s|$)/gm, | |
match : 2 | |
} , | |
PERMISSIVE : { | |
reg : /(^|\s)(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)(\s|$)/gm, |
This file contains 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
#!/usr/bin/env node | |
const Flatted=function(n){"use strict"; | |
/*! (c) 2020 Andrea Giammarchi */var t=JSON.parse,r=JSON.stringify,e=Object.keys,a=String,u="string",f={},i="object",c=function(n,t){return t},l=function(n){return n instanceof a?a(n):n},o=function(n,t){return typeof t===u?new a(t):t},s=function(n,t,r){var e=a(t.push(r)-1);return n.set(r,e),e};return n.parse=function(n,r){var u=t(n,o).map(l),s=u[0],p=r||c,v=typeof s===i&&s?function n(t,r,u,c){for(var l=[],o=e(u),s=o.length,p=0;p<s;p++){var v=o[p],y=u[v];if(y instanceof a){var g=t[y];typeof g!==i||r.has(g)?u[v]=c.call(u,v,g):(r.add(g),u[v]=f,l.push({k:v,a:[t,r,g,c]}))}else u[v]!==f&&(u[v]=c.call(u,v,y))}for(var h=l.length,d=0;d<h;d++){var w=l[d],O=w.k,S=w.a;u[O]=c.call(u,O,n.apply(null,S))}return u}(u,new Set,s,p):s;return p.call({"":v},"",v)},n.stringify=function(n,t,e){for(var a=t&&typeof t===i?function(n,r){return""===n||-1<t.indexOf(n)?r:void 0}:t||c,f=new Map,l=[],o=[],p=+s(f,l,a.call({"":n},"",n)),v=!p;p<l.length;)v=!0,o[p]=r(l[p++],y,e);return" |
This file contains 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
const middy = (middList) => { | |
return (event) => { | |
let middStack = [...middList]; | |
let lastRetValue; | |
const next = () => { | |
const curr = middStack.shift(); | |
if (curr) { | |
const retVal = curr(event, next); | |
lastRetValue = retVal; | |
if (retVal instanceof Promise && middStack.length){ |
This file contains 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
https://codepen.io/anon/pen/yqQOxv?editors=0010 |
This file contains 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
// Place your settings in this file to overwrite the default settings | |
{ | |
"editor.fontSize": 13, | |
"editor.roundedSelection": false, | |
"typescript.check.npmIsInstalled": false, | |
"window.restoreWindows": "all", | |
"workbench.colorTheme": "Nord", | |
"editor.tabSize": 2, | |
"window.zoomLevel": 0.75, | |
"javascript.updateImportsOnFileMove.enabled": "always", |
This file contains 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
Show hidden characters
{ | |
"env": { | |
"es6": true, | |
"node": true | |
}, | |
"extends": "eslint:recommended", | |
"parserOptions": { | |
"sourceType": "module", | |
"ecmaVersion": 8 | |
}, |
This file contains 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 getWatchers(root) { | |
root = angular.element(root || document.documentElement); | |
var watcherCount = 0; | |
var scopeArr = []; | |
function getElemWatchers(element) { | |
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope); | |
var scopeWatchers = getWatchersFromScope(element.data().$scope); | |
var watchers = scopeWatchers.concat(isolateWatchers); | |
angular.forEach(element.children(), function (childElement) { | |
watchers = watchers.concat(getElemWatchers(angular.element(childElement))); |
This file contains 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
/* | |
* Your Stylesheet | |
* | |
* This stylesheet is loaded when Atom starts up and is reloaded automatically | |
* when it is changed. | |
* | |
* If you are unfamiliar with LESS, you can read more about it here: | |
* http://www.lesscss.org | |
*/ |
This file contains 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(a,b){var c,d={},e=function(){},f=function(){d.history=d.history||[],d.history.push(arguments),this.console&&original.log(Array.prototype.slice.call(arguments))},g=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],h=g.length,i=window.console=window.console||{};try{for(;h--;)c=g[h],i[c]="log"==c?f:e}catch(j){}b._unlockConsole=function(){i.log=a,d.history.map(function(a){i.log.apply(i,Array.prototype.slice.call(a))})}}(null!=console&&"object"==typeof console&&"log"in console?console.log:function(){},this); |
NewerOlder