Skip to content

Instantly share code, notes, and snippets.

View wchristian's full-sized avatar

Christian Walde (Mithaldu) wchristian

View GitHub Profile
use v5.10;
use strict;
use warnings;
system(1, $^X, '-e', 'sleep 5; print qq[not ok 1 - blah blah\n]');
@wchristian
wchristian / git-size.pl
Created April 29, 2014 12:49
git-size.pl - size of each commit in a git repository
#!/usr/bin/perl
use strictures;
for my $rev ( `git rev-list --all --pretty=oneline` ) {
my $tot = 0;
$rev =~ s/\s+$//;
( my $sha = $rev ) =~ s/\s.*$//;
( my $msg = $rev ) =~ s/^$sha //;
for my $blob ( `git diff-tree -r -c -M -C --no-commit-id $sha` ) {
$blob = ( split /\s/, $blob )[3];
next if $blob eq "0000000000000000000000000000000000000000"; # Deleted
@wchristian
wchristian / gist:f6a41314be966b957193
Created October 26, 2014 18:35
quoting myself from elsewhere on paths
(Mithaldu) first off, you need to differentiate between paths in your program, and objects representing actual file system objects on your machine
(Mithaldu) and then you have code portable between machines, so both classes need to carry around attributes marking which OS the path is for
(Mithaldu) and then you can have volumes with different file systems mounted to the same machine
(Mithaldu) and then you can have different configurations for the same file system type
(Mithaldu) and nothing gets all of these right
<script type="text/javascript">
// This is a workaround for using jquery-validation-engine with select2 for 'required' validation
// Since the _required validator for jquery-validation-engine uses .val() to see
// if there's anything in the input, we can hijack .val() for the container created by select2\
// and redirect it to the value of the hidden element
// jquery-validation-engine throws an error if the thing we're validating doesn't have an id
// so we'll put one on the container created by select2 (that way, the positioning of the prompts
// will be correct)
$('#mySelector').select2('container').attr('id', 'mySelectorValidate');

Squad spawn rules:

  • vehicles eligible for Squad Spawn are:
    • Galaxy
    • undeployed Sunderer (!!!)
    • Valkyrie
  • a vehicle becomes Squad Spawn by being piloted by any squad mate
  • any squad member can deploy into any Squad Spawn
  • driver's squad leader status does not matter
  • location of Squad Spawn does not matter
@wchristian
wchristian / _output
Created August 8, 2010 20:42
a script that collects statistics on perl code to aid in prioritizing while refactoring
D:\Web-Dev\Greenphyl_v2\perlcodegreenphyl\apps\GreenPhyl\test>perl code_statistics.pl
### Collecting block statistics
### Average Block Length
18.5932553337922
### Average Block Size
670.863041982106
package Greenphyl::Load::Family;
use strict;
use warnings;
no warnings 'once';
use Carp;
use Bio::Seq;
use Bio::SearchIO;
use Bio::SeqIO;
use lib "../../lib";
c:\Perl\HTML-Tree-3.23>perl code_statistics.pl
### Collecting block statistics
### Average Block Length
16.1738382099828
### Average Block Size
529.349397590361
package Local::Patched::Foo;
use strict;
use warnings;
no warnings 'redefine';
use parent 'Exporter';
use constant functions => qw( baz );
use Foo functions;
@wchristian
wchristian / Test::Class::TestGroup.pm
Created August 16, 2010 20:24
a subclass of Test::Class that adds a TestGroup attribute
use strict;
use warnings;
package Test::Class::TestGroup;
no warnings 'redefine';
use parent 'Test::Class';
use Test::More;
use Data::Dumper;