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 getAvColor (img) { | |
| var canvas = document.createElement('canvas'), | |
| context = canvas.getContext && canvas.getContext('2d'), | |
| rgb, | |
| pixelInterval = 5, // Rather than inspect every single pixel in the image inspect every 5th pixel | |
| count = 0, | |
| data, length, | |
| i = -4; | |
| // return the base colour for non-compliant browsers |
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 binarySearch(l,v){ | |
| var m=0,M=l.length,g; | |
| while(m<=M){ | |
| //bitwisecmd.com/#0xffffffff%3E%3E%3E1 | |
| if(M<=0xF0000000){ | |
| while(m<=M){ | |
| g=(M+m)>>>1; | |
| if(l[g]===v)return g; | |
| if (l[g]<v)m=g+1; | |
| else M=g-1; |
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 isPrime1K(v){ | |
| v=Math.abs(v); | |
| if(v==1 || v/2==Math.floor(v/2))return false; | |
| if(v>997)return undefined; | |
| return binaryExists( | |
| [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], | |
| v); | |
| } | |
| function binaryExists(l,v){ |
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 binarySort(l){ | |
| for(var i in l){ | |
| var m=0,M=i-1,g; | |
| main: | |
| while(m<=M){ | |
| if(M<=0xF0000000){ | |
| while(m<=M){ | |
| g=(M+m)>>>1; | |
| if(l[g]===l[i])break main; | |
| if(l[g]<l[i])m=g+1; |
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
| [ | |
| [{ | |
| "op":"test", | |
| "path":"/speciesOrdering/0", | |
| "value":"penguin" | |
| },{ | |
| "op":"remove", | |
| "path":"/speciesOrdering/0" | |
| }], | |
| [{ |
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 getDeepKeys(obj,key,d="/"){ | |
| if(typeof(obj)!=="object")return null; | |
| var arr=[]; | |
| for(let i in obj){ | |
| if(typeof(obj[i])==="object")arr=arr.concat(getDeepKeys(obj[i],key?key+d+i:i)); | |
| else arr.push(key?key+d+i:i); | |
| } | |
| return arr; | |
| } |
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
| c{text-align:center} | |
| div,pre{font-size:18px} | |
| *{font-family:Arial,Helvetica,sans-serif} | |
| button{background:cyan;border-color:#9ff;border-radius:5px;cursor:pointer;margin:0 2px} | |
| button:hover{background:#9ff;border-color:cyan;border-radius:5px} | |
| nav a{font-size:26px;text-decoration:none}h1,h2{margin:0 2px} | |
| #p1,#p2{fill:cyan;stroke:#9ff;stroke-width:5}p{margin-top:0} | |
| .s1{width:1000;height:50}.s2{width:500;height:25} | |
| .s1 text{font-size:36px} | |
| .s2 text{font-size:28px} |
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
| Windows Registry Editor Version 5.00 | |
| [HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\PowerPoint\Security] | |
| "RunPrograms"=dword:00000001 |
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* F(){ | |
| yield 1; | |
| yield 1; | |
| var N=[1,1]; | |
| while(true){ | |
| let sum=N[0]+N[1]; | |
| N=[N[1], sum]; | |
| yield sum; | |
| } | |
| } |
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
| console.time("test"); | |
| Promise.all([ | |
| new Promise(r=>chrome.storage.sync.get(null, s=>r(s))), | |
| new Promise(r=>chrome.storage.local.get(null, l=>r(l))) | |
| ]).then(x=>console.timeEnd("test")); | |
| console.time("test2"); | |
| chrome.storage.sync.get(s=>{ | |
| chrome.storage.local.get(l=>console.timeEnd("test2")); | |
| }); |
OlderNewer