Skip to content

Instantly share code, notes, and snippets.

View exodist's full-sized avatar

Chad Granum exodist

View GitHub Profile
@exodist
exodist / Whoa!
Created September 11, 2014 04:40
Whoa!
use strict;
use warnings;
{
package Foo;
sub finish {
$_[0] = undef;
}
@exodist
exodist / bad_diea
Created July 28, 2014 21:45
Bad idea, thanks Josh
package Test::Calculate;
use strict;
use warnings;
use Data::Dumper;
use base 'Exporter';
use Carp qw/croak/;
our @EXPORT = ('CALCULATE');
@exodist
exodist / .zshrc
Created March 19, 2014 16:49
zsh git stuff
BLACK="%{"$'\033[01;30m'"%}"
GREEN="%{"$'\033[01;32m'"%}"
RED="%{"$'\033[01;31m'"%}"
YELLOW="%{"$'\033[01;33m'"%}"
BLUE="%{"$'\033[01;34m'"%}"
BOLD="%{"$'\033[01;39m'"%}"
NORM="%{"$'\033[00m'"%}"
function gstat() {
branchinfo=`git branch 2>/dev/null`
@exodist
exodist / gist:9538247
Created March 13, 2014 22:18
zsh expansion issue
exodist@Aswan $ setopt PROMPT_SUBST
exodist@Aswan $ function foo() { date +%s }
exodist@Aswan $ export RPROMPT="%{$(foo)%}"
exodist@Aswan $ 1394749035
exodist@Aswan $ 1394749035
exodist@Aswan $ 1394749035
exodist@Aswan $ 1394749035
#!/usr/bin/perl
use strict;
use warnings;
my $foo = "hello\n";
$a = undef;
$b = undef;
EVIL:
$foo = $a if $a;
Cleaning up build files
Building Hash-StoredIterator
cc -I/home/exodist/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/x86_64-linux/CORE -DXS_VERSION="0.004" -DVERSION="0.004" -fPIC -c -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -o lib/Hash/StoredIterator.o lib/Hash/StoredIterator.c
lib/Hash/StoredIterator.c: In function ‘XS_Hash__StoredIterator_hash_get_iterator’:
lib/Hash/StoredIterator.c:212:2: warning: passing argument 2 of ‘Perl_sv_setpv’ from incompatible pointer type [enabled by default]
In file included from /home/exodist/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/x86_64-linux/CORE/perl.h:5030:0,
from lib/Hash/StoredIterator.xs:2:
/home/exodist/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/x86_64-linux/CORE/proto.h:4154:20: note: expected ‘const char * const’ but argument is of type ‘struct hsi *’
ExtUtils::Mkbootstrap::Mkbootstrap('blib/arch/auto/Hash/StoredIterator/StoredIterator.bs')
cc -shared -O2 -L/usr/local/lib -f
@exodist
exodist / gist:4774332
Last active December 12, 2015 12:48
no eval
package My::Thing;
use strict;
BEGIN {
$INC{'My/Thing.pm'} = __FILE__;
}
sub import {
my $class = shift;
my $caller = caller;
@exodist
exodist / gist:4774202
Created February 12, 2013 22:48
eval example
package My::Thing;
use strict;
BEGIN {
$INC{'My/Thing.pm'} = __FILE__;
}
sub import {
my $caller = caller;
eval <<" EOT" || die $@;
@exodist
exodist / composition
Created May 24, 2012 04:06
Composition
Role Composition:
* Adopt all attributes of sub-roles, error on conflict
* Adopt all requirements of sub-roles, except those met by this role.
* Adopt all methods of sub-roles, add conflicts to required
* Merge roles hash (squash config)
Type Composition:
* Adopt all attributes of roles, error on conflict
* For each role
* bring in role methods, exclude those also listed as a requirement
@exodist
exodist / format
Created March 2, 2012 05:19
format
IndexableArchiveVXXXX.XXXX
uint64 jump size
uint64 jump count
...long data...
(
Checksum
Data
)
...index index...