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 isPrime(n) { | |
var fact = (function(x) { | |
for (i=x-1; i>=1; i--) { | |
x*=i; | |
} | |
return x; | |
})(n-1); | |
return (fact + 1) % n === 0; | |
} |
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
@font-face { | |
font-family: "My Cool Font"; | |
font-weight: 400; | |
font-style: normal; | |
src: local("My Cool Font"), url("my-cool-font.ttf") format("truetype"); /* tries to use installed version, if that doesn't work uses the ttf */ | |
} | |
/* then just use it as usual */ | |
something { |
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
<!doctype html> | |
<html> | |
<head> | |
<title>WDMNM?</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<header> | |
<h1>WDMNM?</h1> | |
</header> |
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 loadScriptAsync = function(urls, callback) { | |
var loadedList = []; | |
for (i=0; i<urls.length; i++) { | |
var scriptElem = document.createElement("script"); | |
scriptElem.src = urls[i]; | |
scriptElem.onload = function(){ | |
loadedList.push(true); | |
if (loadedList.length == urls.length) { | |
callback(); | |
} |
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
// ==UserScript== | |
// @name ARR Grade Changer | |
// @namespace http://zacharyguard.co.nf/ | |
// @version 0.1 | |
// @description Changes all of your grades below B to a B | |
// @include https://*.tg.esf.edu.hk/src/module/arr_parent/* | |
// @copyright 2014+, Zachary Guard | |
// ==/UserScript== | |
var tds = document.querySelectorAll("td:not(.arr_indi_borderR)"); | |
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 express = require("express"); | |
var app = express(); | |
var http = require("http").Server(app); | |
app.get("/", function(req, res) { | |
res.sendfile(__dirname + "/index.html"); | |
}); | |
app.get(/^(.+)$/, function(req, res) { | |
res.sendfile(__dirname + "/" + req.params[0]); |
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 fontFamily = getComputedStyle(document.body).getPropertyValue("font-family"); | |
if (fontFamily.indexOf("Arial") < fontFamily.indexOf("Helvetica") || fontFamily.indexOf("Helvetica") == -1) { | |
document.body.style.fontFamily = "'Helvetica Neue', Helvetica, Arial, sans-serif"; | |
} |
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 avgRGB() { | |
var args = arguments; | |
var total = [0,0,0]; | |
for (i=0; i<args.length; i++) { | |
total[0] += args[i][0]; | |
total[1] += args[i][1]; | |
total[2] += args[i][2]; | |
} | |
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
very Eddy is 'faget' | |
rly Eddy is 'faget' | |
plz console.loge with 'Eddy is a faget' | |
but | |
plz console.loge with 'Eddy is still a faget' | |
wow |
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 readableStyle = document.createElement("style"); | |
readableStyle.innerHTML = "*,*:before,*:after {font-family:'Lucida Grande',Verdana,sans-serif !important}"; | |
document.head.appendChild(readableStyle); |