Skip to content

Instantly share code, notes, and snippets.

View rudiedirkx's full-sized avatar

Rudie Dirkx rudiedirkx

View GitHub Profile
@rudiedirkx
rudiedirkx / BOOK.md
Created May 4, 2014 23:28
Ten days in a mad-house

INTRODUCTION.

SINCE my experiences in Blackwell's Island Insane Asylum were published in the World I have received hundreds of letters in regard to it. The edition containing my story long since ran out, and I have been prevailed upon to allow it to be published in book form, to satisfy the hundreds who are yet asking for copies.

I am happy to be able to state as a result of my visit to the asylum and the exposures consequent thereon, that the City of New York has appropriated $1,000,000 more per annum than ever before for the care of the insane. So I have at least the satisfaction of knowing that the poor unfortunates will be the better cared for because of my work.

TEN DAYS IN A MAD-HOUSE.

function isPrime(n) {
var b = Math.sqrt(n);
if (Math.floor(b) == b) return false;
b = Math.floor(b);
while (b-- > 2) {
var a = n/b;
if (Math.floor(a) == a) return false;
}
return true;
}
@rudiedirkx
rudiedirkx / read-selection.js
Last active August 29, 2015 13:57
Create a new popup to read the current selection
(function() {
function parents(node) {
var el = node,
els = [];
while ( el && (el = el.parentNode) ) {
els.push(el);
}
return els;
}
<?php
class Oele {
function __construct() {
echo __METHOD__ . "\n";
}
function __wakeup() {
echo __METHOD__ . "\n";
}
}
@rudiedirkx
rudiedirkx / getTextNodes.js
Created February 14, 2014 12:35
Return child text nodes of a given Dom Element
Element.prototype.getTextNodes = function(trim) {
return [].slice.call(this.childNodes).filter(function(node) {
return node.nodeType == 3 && ( !trim || node.textContent.trim() != '' );
});
};
javascript:
(function() {
var kb = Object.values(BrowseFile._file_index).reduce(function(kb, file) {
return kb + file.bytes/1000;
}, 0);
var units = ['kb', 'mb', 'gb', 'tb'], unit = units.shift(), size = kb;
for (var i=0; i<3; i++) {
if (size < 1000) {
break;
}
{"error": 0, "users": [{"name": "foo", "hobbies": ["drinking", "eating", "fighting"]}, {"name": "bar", "hobbies": [], "admin": true}]}
@rudiedirkx
rudiedirkx / google.js
Created November 22, 2013 13:17
Google Search TAB
ready(function() {
if ( location.pathname == '/search' ) {
var s = document.getElementById('gbqfq');
if ( s ) {
s.focus();
s.addEventListener('keydown', function(e) {
if ( e.keyCode == 9 ) {
e.preventDefault();
javascript:
location = '/user/login?destination=' +
encodeURIComponent(location.pathname.substr(1) || '<front>');
void(0);
// Mine mine mine
(function() {
// Create iframe
var iframe = document.createElement('iframe');
document.currentScript.parentNode.appendChild(iframe);
})();