Skip to content

Instantly share code, notes, and snippets.

@LennyPenny
Created May 13, 2015 19:40
Show Gist options
  • Save LennyPenny/67516e02b626458b48b3 to your computer and use it in GitHub Desktop.
Save LennyPenny/67516e02b626458b48b3 to your computer and use it in GitHub Desktop.
fcpn.ch 2.0
<!doctype html>
<html>
<head>
<title>fcpn.ch redirecting...</title>
<script type="text/javascript">
var hash = window.location.hash.slice(1);
if (hash == "") {
window.location = "shortn"
} else {
var lookUp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
function b62to10(str) {
var res = 0;
for (var idx = 0; idx < str.length; idx++) {
var character = str.charAt(idx);
var pos = lookUp.indexOf(character);
res = res + pos * Math.pow(62, idx);
}
return res;
}
var postID = b62to10(hash);
window.location = "http://facepunch.com/showthread.php?p=" + postID + "#post" + postID;
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment