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
| var font = "Comic Sans MS"; // set what font you want | |
| // the easy way | |
| document.body.style.fontFamily = font; | |
| // the more robust but slightly more complicated way | |
| var allElements = document.querySelectorAll("*"); | |
| for (i=0;i<allElements.length;i++) { | |
| allElements[i].style.fontFamily = font; |
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
| var scs = { | |
| set: function(key,value,type) { | |
| var kvo = {}; | |
| kvo[key] = value; | |
| var cs; | |
| if (type == "local") { | |
| cs = chrome.storage.local; | |
| } else { | |
| cs = chrome.storage.sync; | |
| } |
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 getPixelColor(x,y,canvas){ // where canvas is an HTMLCanvasElement | |
| var ctx = canvas.getContext("2d"); | |
| var idata = ctx.getImageData(0,0,canvas.width,canvas.height); | |
| var p = ((y*(idata.width*4)) + (x*4)); | |
| var d = idata.data; | |
| return [d[p],d[p+1],d[p+2]]; // returns an array of that pixel's red, green and blue values | |
| } |
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 avgColor(canvas){ // where canvas is an HTMLCanvasElement | |
| var tr = 0, tg = 0, tb = 0; | |
| var idata = canvas.getContext("2d").getImageData(0,0,canvas.width,canvas.height).data; | |
| for (i=0;i<idata.length;i+=4) { // red | |
| tr += idata[i]; | |
| } | |
| for (i=1;i<idata.length;i+=4) { // green | |
| tg += idata[i]; | |
| } | |
| for (i=2;i<idata.length;i+=4) { // blue |
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(word){ | |
| var hStyle = document.createElement("style"); | |
| hStyle.innerHTML = "*{font-family:'Segoe UI',Segoe,sans-serif !important;font-weight:100 !important}"; | |
| document.querySelectorAll("head")[0].appendChild(hStyle); | |
| var targets = document.querySelectorAll("h1,h2,h3,h4,h5,h6,p,a"); | |
| for (i in targets) { | |
| targets[i].innerHTML = word + ", " + targets[i].innerHTML; | |
| } | |
| })("Honestly"); |
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
| import java.util.*; | |
| public class Androo { | |
| public static void main(String []args){ | |
| String[] phrases = {"WERE U BORN IN A BARN???", "GET SUM WERK DUN", "Useless scrub...", "Stop jacking off", "I'LL BUST YOUR CHOPS", "R U BORN IN A WATER PARK??", "Stop fapping around", "R U BORN IN A BARN???", "LATER, SHIZLORD", "OI!!"}; | |
| String chosenPhrase = phrases[new Random().nextInt(phrases.length)]; | |
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
| on quit | |
| display dialog "Really shut down?" buttons {"No", "Yes"} default button "No" | |
| if the button returned of the result is "Yes" then | |
| display dialog "Are you sure?" default answer "No" | |
| if text returned of the result is "Yes" then | |
| display dialog "Are you really sure?" default answer "Really no" | |
| if text returned of the result is "Really yes" then | |
| continue quit | |
| end if | |
| end if |
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
| String.prototype.containsArrayElement = function(array) { | |
| var returnVal = false; | |
| for(i=0;i<array.length;i++){ | |
| if (this.indexOf(array[i]) != -1){ | |
| returnVal = true; | |
| } | |
| } | |
| return returnVal; | |
| } |
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
| var mouse = {}; | |
| mouse.coords = {x:-1,y:-1}; | |
| window.addEventListener("mousemove",function(e){ | |
| mouse.coords.x = e.clientX; | |
| mouse.coords.y = e.clientY; | |
| }); | |
| /* example: | |
| if (mouse.coords.x > window.innerWidth / 2) { |
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
| // recursive | |
| var factorial = function(n) { | |
| if (n == 1) { | |
| return 1; | |
| } else { | |
| return n * factorial(n-1); | |
| } | |
| } | |
| // iterative |