Skip to content

Instantly share code, notes, and snippets.

View schwern's full-sized avatar

Michael G. Schwern schwern

View GitHub Profile
#include <time.h>
#include <stdio.h>
#include <math.h>
int main() {
time_t test;
int last_year = 0;
struct tm *date;
int i;
#include <time.h>
#include <stdio.h>
#include <math.h>
int main() {
time_t test;
int last_year = 70;
struct tm *date;
int i;
#!/usr/local/bin/perl
# Create a remote branch
my($remote, $branch, $start) = @ARGV;
die "$0 <remote> <newbranch> <start>\n" if @ARGV < 2;
$start ||= $remote;
system("git push $remote $start:refs/heads/$branch");
#!/usr/bin/perl
use v5.10;
use Test::More;
# Can you make this test pass just by changing UNIVERSAL::id and other
# dirty tricks?
#
# You cannot store anything in the object.
# You can make no assumptions about the structure of the object.
#!/usr/bin/perl
# The idea here is to take the benefits of make (highly visible code,
# excellent dependency tracking) and combine them with Module::Build
# (portable, OO overrides).
# This is all valid Perl code (with a small source filter)
# To use, you run the schmakefile directly.
# perl schmake
# perl schmake test
#!perl
use strict;
use warnings;
use autobox;
sub UNIVERSAL::mo {
return Meta::Instance->new($_[0]);
}
use strict;
use warnings;
my $File = "/etc/passwd";
use Benchmark "cmpthese";
sub schwern {
my($fh, $limit) = @_;
package MooseX::AlwaysCoerce;
use strict;
use warnings;
use namespace::autoclean;
use Moose ();
use MooseX::ClassAttribute ();
use Moose::Exporter;
use Moose::Util::MetaRole;
has "coerce" => (
is => 'rw',
lazy => 1,
reader => "should_coerce",
default => sub {
return 1 if shift->type_constraint->has_coercion;
return 0;
}
);
# So my $github = $obj->github({ arg => "foo" }) works;
has github =>
isa => "Gitpan::Github|HashRef",
is => 'rw',
lazy => 1,
trigger => sub { # trigger doesn't take a method
my($self, $new, $old) = @_;
return $new if $new->isa("Gitpan::Github");