Skip to content

Instantly share code, notes, and snippets.

View mfn's full-sized avatar

Markus Podar mfn

View GitHub Profile
@mfn
mfn / .tmux.conf
Created September 29, 2014 15:31
set -g default-terminal "screen-256color"
# Behave like screen; at least the stuff I use
unbind-key C-b
set-option -g prefix C-a
bind-key C-a last-window
set-window-option -g mode-keys vi
# Make window splitting more intuitive
unbind %
bind-key | split-window -h
@mfn
mfn / cmp404poka.html
Last active August 29, 2015 14:24
#camp404 "poker chip" code challenge: enter a number, tell the number the minimum number of chips required to represent them
<!-- challenge description:
- a given set of infinite poker chips in theses sizes: 500, 100, 50, 25, 10, 5, 2, 1
- enter a number
- tell the user the minimum number of chips necessary to represent the value
-->
<!-- initial 91 char solution ; thx to @neuling for the inspiration and @johannesnagl saving me one extra char -->
<p onclick="i=prompt();for(a of[500,100,50,25,10,5,2,1])if(e=~~(i/a))alert(e+' '+a,i%=a)">.
<!-- since it wasn't specified that spitting out 0 chips would be prohibited, another solution -->
@mfn
mfn / phpunit_xml_slicer.php
Last active March 11, 2021 15:18
Feed the output of `phpunit --list-tests-xml <file.xml>` and slice it up into smaller chunks
#!/usr/bin/env php
<?php declare(strict_types = 1);
// Source: https://gist.github.com/mfn/256636242cbe8a51252ce28181a6b074
$command = array_shift($argv);
if (2 !== count($argv)) {
echo "Please provide a XML file and a slice like `$command tests.xml 2/4`\n";
@mfn
mfn / endomondo_json2gpx.php
Last active January 9, 2021 15:45
Convert endomondo json tracking data to gpx
<?php declare(strict_types=1);
/*
Usage: php endomondo_json2gpx.php <path_to_file.json> […<path_to_other_file.json>]
The endomondo json format parsed here; only the fields actually used by this converted:
[
{"sport": "…"},
@mfn
mfn / phpunit_xml_class_to_file.php
Last active March 11, 2021 15:33
Take the output of https://gist.github.com/mfn/256636242cbe8a51252ce28181a6b074 and rewrite an existing phpunit.xml to use only these test classes (mapped to files)
#!/usr/bin/env php
<?php declare(strict_types = 1);
$command = array_shift($argv);
if (3 !== count($argv)) {
echo <<<USAGE
Usage: $command path/to/composer.json path/to/phpunit.xml path/to/slice.xml > new_phpunit.xml
Based on your composer PSR-4 autoload configuration, the classes referenced