Skip to content

Instantly share code, notes, and snippets.

View Prinzhorn's full-sized avatar
🌚
Existing

Alexander Prinzhorn Prinzhorn

🌚
Existing
View GitHub Profile
@Prinzhorn
Prinzhorn / README.md
Created February 25, 2014 09:19
Code quality.

This is an excerpt from a 465 lines js file. This is not satirical. This is actual code from a large codebase (>100k js) of an application that is used in production at multiple customers.

If you're giving a talk or lecture about code quality, feel free to use this as the first slide to make your audience giggle for a second. And then look at their faces when you tell them it's actual code.

@Prinzhorn
Prinzhorn / index.js
Created August 13, 2014 06:48
Functions for checking if an int is equal to another int. So intuitive!
for(var i = 0; i < 4294967296; i++) {
global['is' + i] = (function(i) {
return function(n) {
return !(i - n);
};
}(i));
}
console.log(is5(5));//true
console.log(is5(9));//false
@Prinzhorn
Prinzhorn / README.md
Last active August 29, 2015 14:06 — forked from weiglemc/.block
@Prinzhorn
Prinzhorn / README.md
Last active August 29, 2015 14:18
Open the GitHub repository for the current GitHub page

There are so many projects hosted on GitHub pages which do not have a prominent link to the repo on the page. I always (╯°□°)╯︵ ┻━┻ when this happens because I have to manually enter the stupid URL.

Here's a Bookmarklet

javascript:!function(){var o=location.href.match(/(\w+).github.io\/(\w+)/);o&&(window.location="https://github.com/"+o[1]+"/"+o[2])}()
@Prinzhorn
Prinzhorn / rethinkdb-express.js
Last active August 29, 2015 14:20
RethinkDB with Express
var express = require('express');
var r = require('rethinkdb');
var app = express();
r.connect(config.rethinkdb, function(err, conn) {
if(err) {
return handleError(res, err);
}
@Prinzhorn
Prinzhorn / LICENSE.txt
Created October 3, 2011 08:50 — forked from 140bytes/LICENSE.txt
American Soundex
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Prinzhorn
Prinzhorn / LICENSE.txt
Created October 3, 2011 07:30 — forked from 140bytes/LICENSE.txt
Fibonacci with dynamic programming
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Prinzhorn
Prinzhorn / LICENSE.txt
Created October 3, 2011 15:13 — forked from 140bytes/LICENSE.txt
Square root
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Prinzhorn
Prinzhorn / LICENSE.txt
Created October 4, 2011 17:28 — forked from 140bytes/LICENSE.txt
Tag cloud
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Alexander Prinzhorn
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Prinzhorn
Prinzhorn / dabblet.css
Created December 20, 2011 21:43
Untitled
#box {
width:985px;
height:140px;
background:url(http://style.tutorials.de/v10/small-liveworkshops.jpg) repeat-y 0px 0px;
-moz-animation-duration: 5s;
-moz-animation-name: ticker;
-moz-animation-iteration-count:infinite;
-moz-animation-timing-function:linear;
}
@-moz-keyframes ticker {