Skip to content

Instantly share code, notes, and snippets.

View rudiedirkx's full-sized avatar

Rudie Dirkx rudiedirkx

View GitHub Profile
////////////////////////////////////////////////////////
// Moved to https://github.com/rudiedirkx/Auto-indent //
////////////////////////////////////////////////////////
/**
* To do:
* - tab/shift tab: (un)indent a line on command
* - 'mass tab': select several lines and (un)indent them all (requires TAB)
* - support for undo/redo, by using `execCommand('insertText')`
window.requestAnimationFrame || (window.requestAnimationFrame = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(cb) {
return setTimeout(cb, 1000 / 60);
});
<?php
$files = glob('*');
$sizes = array_map('filesize', $files);
$count_sizes = array_count_values($sizes);
$doubles = count($sizes) - count($count_sizes);
// var_dump($doubles);
javascript:
([].forEach.call(document.scripts, function(el, p) {
var code = el.innerHTML.trim();
if ( (p = code.indexOf('q("talkPage.init",')) > -1 ) {
var json = code.slice(p + 18, -1).trim();
var talk = JSON.parse(json).talks[0];
var url = talk.nativeDownloads.high || talk.nativeDownloads.medium;
var a = document.createElement('a');
a.href = url;
a.download = url.match(/([^\/\?]+)(\?.+?)?$/)[1];
<?php
writeln();
writeln('starting...');
write('Progress: [ 0 % ]');
for ( $i=1; $i<=100; $i++ ) {
usleep(rand(100, 100000));
@rudiedirkx
rudiedirkx / site.css
Last active December 20, 2015 14:59
rweb://twitter.com
html, body {
background: white !important;
line-height: 1.4;
}
.wrapper, .wrapper-narrow, .wrapper-permalink {
width: 1100px;
}
.content-main {
width: 787px;
@rudiedirkx
rudiedirkx / test.css
Last active December 20, 2015 15:59
Saving a custom attribute into a link_field value.
.form-type-link-field {
display: -webkit-flex;
}
.form-item.form-type-link-field > :last-child {
-webkit-order: -1;
}
javascript:
jQuery('select').each(function(i, el) {
el.selectedIndex = 1 + parseInt(Math.random() * (el.options.length-1));
});
jQuery('input:not([type]), input[type="text"], textarea').val(function() {
return ['Lorem', 'Ipsum', 'Dolor'][ parseInt(Math.random() * 3) ];
});
void(0);
// Mine mine mine
(function() {
// Create iframe
var iframe = document.createElement('iframe');
document.currentScript.parentNode.appendChild(iframe);
})();
javascript:
location = '/user/login?destination=' +
encodeURIComponent(location.pathname.substr(1) || '<front>');
void(0);