Skip to content

Instantly share code, notes, and snippets.

View Fusselwurm's full-sized avatar
🥸

Moritz Schmidt Fusselwurm

🥸
View GitHub Profile
// 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 / 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);
@Fusselwurm
Fusselwurm / keybase.md
Created July 7, 2014 21:44
keybase.md

Keybase proof

I hereby claim:

  • I am fusselwurm on github.
  • I am fusselwurm (https://keybase.io/fusselwurm) on keybase.
  • I have a public key whose fingerprint is 073B 0986 5D82 AAE7 50E7 13C5 21EC C84F 2817 7D70

To claim this, I am signing this object:

@Fusselwurm
Fusselwurm / do_ffmpeg.bat
Last active August 29, 2015 14:04
Batch file: dxtory out -> h264
@set infile=%1
@set outfile=%infile%.out.mkv
@set startAt=%2
if not defined startAt set startAt=00:00:00
@set duration=%3
if not defined duration set duration="02:00:00"
@set ffmpeg=C:\Program Files\ffmpeg\bin\ffmpeg.exe
@Fusselwurm
Fusselwurm / is-integerstring-check-speed.php
Created September 11, 2014 07:13
Which is faster, regex or type casting, when deciding whether a string represents an integer?
<?php
$value = '0647№7№7№/0';
$time = microtime(true);
$loops = 100000;
$result = true;
for ($i = 0; $i < $loops; $i++) {
@Fusselwurm
Fusselwurm / server-status.php
Created September 26, 2014 20:25
hacky proxy script to get arma server status from steam
<?php
header("Access-Control-Allow-Origin: *");
$port = intval($_GET["port"]);
if ($port === 0) {
header("HTTP/1.1 400 Missing or invalid port parameter");
exit;
}
@Fusselwurm
Fusselwurm / get-pws-collection.php
Last active August 29, 2015 14:07
PlayWithSix json API containing a modcollection -> HTML table
<?php
/**
* @param $object
* @param string $className
* @return object
*/
function castToClass($object, $className) {
$result = new $className;
@Fusselwurm
Fusselwurm / arma-session-report.html
Created October 5, 2014 12:38
ArmA Session report (Session class in .rpt file) to json/markdown/html. Needs https://github.com/Fusselwurm/arma-class-to-json
<html>
<head>
<title>session report parser</title>
<style>
textarea {
height: 500px;
width: 100%;
}
#result textarea {
@Fusselwurm
Fusselwurm / prepare-repo-for-zsync.php
Created October 9, 2014 20:44
mörderdreckiges php-script, um für six-updater / playwithsix ein rsync- in ein zsync-repo umzuwandeln
<?php
// in der batchdatei davor:
// "C:\Program Files (x86)\SIX Projects\Six Updater\SixZsync.exe" --commit-repo d:/pws-repo-committed
// http://php.net/manual/de/function.copy.php#91010
function recurse_copy($src,$dst) {
$dir = opendir($src);
if (!$dir) {
throw new Exception('not a directory: ' . $dir);