Skip to content

Instantly share code, notes, and snippets.

Rudie Dirkx rudiedirkx

Block or report user

Report or block rudiedirkx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rudiedirkx
rudiedirkx / getTextNodes.js
Created Feb 14, 2014
Return child text nodes of a given Dom Element
View getTextNodes.js
Element.prototype.getTextNodes = function(trim) {
return [].slice.call(this.childNodes).filter(function(node) {
return node.nodeType == 3 && ( !trim || node.textContent.trim() != '' );
});
};
View unserialize.php
<?php
class Oele {
function __construct() {
echo __METHOD__ . "\n";
}
function __wakeup() {
echo __METHOD__ . "\n";
}
}
@rudiedirkx
rudiedirkx / read-selection.js
Last active Aug 29, 2015
Create a new popup to read the current selection
View read-selection.js
(function() {
function parents(node) {
var el = node,
els = [];
while ( el && (el = el.parentNode) ) {
els.push(el);
}
return els;
}
View isPrime.js
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 / BOOK.md
Created May 4, 2014
Ten days in a mad-house
View BOOK.md

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.

View months-options.php
<?php
$years = array_reverse(range(date('Y')-5, date('Y')));
$years = array_reduce(range(0, 60), function($months, $offset) {
$utc = strtotime('-' . $offset . ' months');
$offset % date('n') == 0 and $months += array(date('Y', $utc) => date('Y', $utc));
$months += array(date('Y-m', $utc) => strtolower(date('Y - M', $utc)));
return $months;
}, array());
@rudiedirkx
rudiedirkx / wtframework.js
Created Aug 20, 2014
Old WTFramework bookmarklet
View wtframework.js
javascript:
(function(){
var m,n=[],j,c,t=document.getElementById("_wtframework"),q=0;c=function(){document.body.removeChild(m);};if(t){document.body.removeChild(t);return;}var b=["MooTools.version","MooTools.More.version","base2.version","dojo.version","Ext.version","jQuery.fn.jquery","$.ui.version","MochiKit.MochiKit.VERSION","Prototype.Version","Scriptaculous.Version","YAHOO.VERSION","S2.Version"];var r=["MooTools Core","MooTools More","Base2","Dojo","Ext JS","jQuery","jQuery UI","MochiKit","Prototype","Script.aculo.us","Yahoo UI","Scripty2"];var k={cursor:"pointer",textAlign:"left",padding:"8px 10px",margin:"0 0 5px",listStyle:"none",font:"bold 11px Lucida Grande",backgroundColor:"rgba(0, 0, 0, 0.7)",color:"#fff",BorderRadius:"5px",MozBorderRadius:"5px",WebkitBorderRadius:"5px",borderTop:"solid%201px%20rgba(255,%20255,%20255,%200.4)",borderLeft:"solid%201px%20rgba(0,%200,%200,%200.8)",borderRight:"solid%201px%20rgba(0,%200,%200,%200.8)",borderBottom:"solid%201px%20#000",textShadow:"0%201px%200
View BR.sublime-completions
{
"scope": "source.php - variable.other.php",
"completions":
[
"php",
/* db_* */
{ "trigger": "db_select", "contents": "db_select('${1:table}', '${2:sql}');$0" },
{ "trigger": "db_select_one", "contents": "db_select('${1:table}', '${2:column}', '${3:sql}');$0" },
View PHP.sublime-completions
{
"scope": "source.php - variable.other.php",
"completions":
[
"php",
{ "trigger": "__METHOD__", "contents": "__METHOD__" },
{ "trigger": "__FUNCTION__", "contents": "__FUNCTION__" },
{ "trigger": "__CLASS__", "contents": "__CLASS__" },
@rudiedirkx
rudiedirkx / yt-share-blur.js
Created Sep 22, 2014
Blur YouTube share input
View yt-share-blur.js
var el = document.querySelector('#watch7-content');
var mo = new MutationObserver(function(muts) {
muts.forEach(function(mut) {
[].forEach.call(mut.addedNodes, function(node) {
var el = node.querySelector && node.querySelector('input[name="share_url"]');
if ( el ) {
setTimeout(function() {
el.blur();
}, 1);
You can’t perform that action at this time.