Skip to content

Instantly share code, notes, and snippets.

View rudiedirkx's full-sized avatar

Rudie Dirkx rudiedirkx

View GitHub Profile
@rudiedirkx
rudiedirkx / detect-history-state.js
Last active May 14, 2024 04:12
Detect pushState and replaceState
var _wr = function(type) {
var orig = history[type];
return function() {
var rv = orig.apply(this, arguments);
var e = new Event(type);
e.arguments = arguments;
window.dispatchEvent(e);
return rv;
};
};
{
"scope": "source.php - variable.other.php",
"completions":
[
"php",
{ "trigger": "__METHOD__", "contents": "__METHOD__" },
{ "trigger": "__FUNCTION__", "contents": "__FUNCTION__" },
{ "trigger": "__CLASS__", "contents": "__CLASS__" },
{
"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" },
@rudiedirkx
rudiedirkx / yt-share-blur.js
Created September 22, 2014 22:26
Blur YouTube share input
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);
<!doctype html>
<html lang="en">
<head>
<title>Multiplayer</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=300, height=500, initial-scale=1" />
<style>
* { box-sizing: border-box; font-size: 20px; font-family: arial; margin: 0; padding: 0; }
html { height: 100%; border: solid 20px black; }
@rudiedirkx
rudiedirkx / dabblet.css
Created October 12, 2014 23:12
Untitled
html, body, .container {
margin: 0;
height: 100%;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
width: 33%;
@rudiedirkx
rudiedirkx / livelong.php
Created October 15, 2014 20:32
End request, but keep going (Apache)
<?php
_liveLongStart();
echo "Processing the hell outta everything....\n";
echo "\n";
echo "We'll email you as soon as this is done.\n";
_liveLongEnd();
@rudiedirkx
rudiedirkx / drupal.placeholder.js
Created October 24, 2014 10:59
Drupal placeholder polyfill
(function ($) {
Drupal.behaviors.placeholderScripts = {
attach: function(context, settings) {
/**
* Placeholder support
*/
if ( !('placeholder' in document.createElement('input')) ) {
function onFocus(e) {
@rudiedirkx
rudiedirkx / Lemmings.txt
Created October 24, 2014 22:13
Lemmings
http://www.elizium.nu/scripts/lemmings/
Fun
1. BAJHLDHBCL
2.
////////////////////////////////////////////////////////
// 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')`