Skip to content

Instantly share code, notes, and snippets.

Avatar

Moritz Onken monken

View GitHub Profile
@monken
monken / gist:1256169
Created Oct 1, 2011
build dbic schema dynamically
View gist:1256169
package MySchema;
use Moose;
extends 'DBIx::Class::Schema';
use Moose;
use DBIx::Class::ResultSource::Table;
my $result_class = Moose::Meta::Class->create(
Foo => ( superclasses => ['DBIx::Class::Core'] )
);
View gist:1200151
server {
listen 80;
server_name search.cpan.org sco.metacpan.org sco.metacpan.org cpansearch.perl.org;
if ($args ~ "query=([^&]+)" ) {
set $query $1;
rewrite ^/search$ https://metacpan.org/search?q=$query?;
}
rewrite ^/perldoc$ https://metacpan.org/module/$args?;
rewrite ^/\~([^/]+)/([^/]+)/?$ https://metacpan.org/release/$1/$2;
View gist:1170622
diff --git a/lib/Moose/Meta/TypeConstraint/DuckType.pm b/lib/Moose/Meta/TypeConstraint/DuckType.pm
index 8957156..82fc83c 100644
--- a/lib/Moose/Meta/TypeConstraint/DuckType.pm
+++ b/lib/Moose/Meta/TypeConstraint/DuckType.pm
@@ -24,10 +24,10 @@ my $inliner = sub {
return 'Scalar::Util::blessed(' . $val . ') '
. '&& Scalar::Util::blessed(' . $val . ') ne "Regexp" '
- . '&& &List::MoreUtils::all('
- . 'sub { ' . $val . '->can($_) }, '
View gist:1169553
eval "require Test::Aggregate::Nested";
$@ ? tests_recursive 't' : tests 't/*.t';
View gist:1161924
/usr/bin/find/-typed(-fstypenfs-o-fstypeNFS-o-fstypeproc-o-fstypeafs-o-fstypesmbfs-o-fstypeautofs-o-fstypeiso9660-o-fstypencpfs-o-fstypecoda-o-fstypedevpts-o-fstypeftpfs-o-fstypedevfs-o-fstypemfs-o-fstypesysfs-o-fstypeshfs-o-fstypecifs-o-fstype9P-o-fstypeunknown-o-regex\(^/mnt$\)\|\(^/cdrom$\)\|\(^/tmp$\)\|\(^/usr/tmp$\)\|\(^/var/tmp$\)\|\(^/var/spool$\)\|\(^/proc$\)\|\(^/media$\)\|\(^/sys$\))-prune-o-print0
@monken
monken / gist:1142048
Created Aug 12, 2011
PageRank top 100 results
View gist:1142048
Test-Simple-0.98 0.134009176432354
Test-Harness-3.23 0.114890159531868
Pod-Parser-1.38 0.100078003549883
PathTools-3.33 0.0861958513522049
Scalar-List-Utils-1.23 0.0515342379546982
File-Path-2.08 0.0387061680609517
Moose-2.0202 0.00629845730668331
MIME-Base64-3.13 0.00550044241816146
libwww-perl-6.02 0.00516502766265222
Exporter-5.63 0.00494346206334457
View gist:1116867
package Catalyst::Action::MetaCPAN::Deserialize;
use Moose;
use namespace::autoclean;
extends 'Catalyst::Action::Deserialize';
sub execute {
my $self = shift;
my ( $controller, $c ) = @_;
View gist:1111397
curl http://localhost:9200/twitter/tweet/QCpcz4q_5B5C9C75p49e3TZJvgw?pretty=1
{
"_index" : "twitter",
"_type" : "tweet",
"_id" : "QCpcz4q_5B5C9C75p49e3TZJvgw",
"_version" : 1,
"exists" : true, "_source" : {"post_date":"2011-07-28T11:16:15","user":"mo","id":"QCpcz4q_5B5C9C75p49e3TZJvgw","message":"Elastic baby!"}
}
View gist:1111289
{
"cpan_v3" : {
"aliases" : {
"cpan" : {
}
}
},
"user" : {
"aliases" : {
}
View gist:1108986
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/file/_mapping -d '
{
"file" : {
"properties" : {
"name" : {
"fields" : {
"analyzed" : {
"store" : "yes",