Skip to content

Instantly share code, notes, and snippets.

View Fusselwurm's full-sized avatar
🥸

Moritz Schmidt Fusselwurm

🥸
View GitHub Profile
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/psr-0-final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
@Fusselwurm
Fusselwurm / gist:3801717
Created September 28, 2012 19:36
Lyrics: Ina Martell - Ich war allein
Ich war allein und die Welt schien leer,
so sehr allein unterm Wolkenmeer.
Ich war allein mit meinem Traum von dir,
denn du warst fern entfernt von mir. (?)
Ich war allein schon so lange Zeit
und jeder Tag war voll Einsamkeit.
Ich war allein wie ein gelassener Stern. (?)
So sehr allein, und du warst fern.
@Fusselwurm
Fusselwurm / querySelector.js
Created January 30, 2013 14:39
document.querySelector, document.querySelectorAll for IE7
/*global document */
/**
* define document.querySelector & document.querySelectorAll for IE7
*
* A not very fast but small hack. The approach is taken from
* http://weblogs.asp.net/bleroy/archive/2009/08/31/queryselectorall-on-old-ie-versions-something-that-doesn-t-work.aspx
*
*/
(function () {
var
@Fusselwurm
Fusselwurm / gherkin.xml
Created May 16, 2013 08:32
gherkin syntax highlighting for kde/katepart. not of my making, but copied from http://paste.kde.org/184712/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
Gherkin (English) syntax highlighting definition for Kate.
Copyright (C) 2011 by Torbjörn Klatt (opensource@torbjoern-klatt.de)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@Fusselwurm
Fusselwurm / fritzbox-delete-hosts.js
Last active December 21, 2015 03:08
Deleting known hosts in my Fritz!Box 7170 is a PITA. One click per host plus the wait for page reload. This is a script to take the P from ITA :p (untested in this form. todo: wait for DOM structure instead of fixed timeout)
var
pattern = /^PC-192/,
deleteText = 'Löschen',
timeout = 3000;
(function moo() {
var found = Array.prototype.some.call(document.getElementsByTagName('frame')[0].contentDocument.querySelectorAll('button[value="' + deleteText + '"]'), function (e) {
var hostname = e.parentNode.parentNode.firstChild.nextSibling.textContent.trim();
if (hostname.match(pattern)) {
console.log('deleting ' + hostname + '...');
@Fusselwurm
Fusselwurm / get_started_gruntjs.md
Created October 6, 2013 17:44
gruntJS quickstart w/ jshint execution on code change

install node, npm globally

FILE="~/Downloads/node-v0.10.20-linux-x64.tar.gz"

sudo tar -xzf $FILE -C /opt/ sudo su cd /usr/local/bin ln -s /opt/node-v0.10.20-linux-x64/bin/node node # possibly add js, nodejs as aliases ln -s /opt/node-v0.10.20-linux-x64/bin/npm npm

// Array methods as variations of forEach
({
forEach: function (fn) {
var i;
for (i = 0; i < this.length; i++) {
fn(this[i], i, this);
}
},
map: function (fn) {
@Fusselwurm
Fusselwurm / marker.sqf
Last active December 17, 2015 00:09
In ArmA, set a fuzzy marker on a player's position
private ["_markerPos", "_inner_marker", "_helper_marker"];
trackingPrecision = 50; //marker precision (radius)
gpsSleepTimeMin = 120;
gpsSleepTimeMax = 300;
_markerPos = (getPos _this);
_inner_marker = createMarker ["agentmarker", _markerPos];
@Fusselwurm
Fusselwurm / gist:11003578
Created April 17, 2014 18:35
sqf script
SHK_DeadCivilianCount = 0;
SHK_DeadCivilianLimit = 3;
civsDead = false;
waituntil {!(isnil "bis_fnc_init")};
civ_groups=[];
civ_group_count = 0;
{if (count units _x>0 and side _x==east) then
(function () {
var
g = 'radial-gradient(farthest-corner at %spx %spx , transparent 0%, #f00 100%)',
t = 30000,
b = $(document.body),
d = $('<div></div>'),
f = function () {
var ww = $(window).width(), wh = $(window).height(),
x = g.replace('%s', ww / 2).replace('%s', wh / 2);
d.css('background', x).css('background','-webkit-' + x);