Skip to content

Instantly share code, notes, and snippets.

View Getty's full-sized avatar
💭
building empires...

Torsten Raudssus Getty

💭
building empires...
View GitHub Profile
@Getty
Getty / gist:1126619
Created August 4, 2011 23:55
Synopsis preview for Test::DBIC::Schema::Connector
use Test::DBIC::Schema::Connector;
my $schema = test_dbic_schema_connect('MySchema');
# MYSCHEMA_DSN will be used as DSN if given
# MYSCHEMA_USER will be used as username if given
# MYSCHEMA_PASS will be used as password if given
my $schema = test_dbic_schema_connect('MySchema',{
@Getty
Getty / Form.pm
Created August 8, 2011 23:12
Some experimental form class
package SyContent::Web::Form;
use Moose;
use SyContent::Web::Form::Field;
has name => (
isa => 'Str',
is => 'ro',
required => 1,
);
@Getty
Getty / Field.pm
Created August 9, 2011 04:08
More working code of the experimental form management
package SyContent::Web::Form::Field;
use Moose;
has name => (
isa => 'Str',
is => 'ro',
required => 1,
);
@Getty
Getty / disp.pl
Created August 23, 2011 17:21
Magic
use strict;
use warnings;
use Path::Dispatcher;
use Test::More;
my @calls;
my $dispatcher = Path::Dispatcher->new(
rules => [
Path::Dispatcher::Rule::Under->new(
@Getty
Getty / gist:1244324
Created September 27, 2011 04:07
most stupid website search
if ($c->req->params->{q}) {
my $q = $c->req->params->{q};
$c->stash->{q} = $q;
my @words = map { lc($_) } split(/ /,$q);
my $like = '%'.join('%',@words).'%';
my @results = $c->model('DB::Search')->search({
content => { like => '%'.$q.'%' },
})->all;
my %res;
for (@results) {
@Getty
Getty / roletest.pl
Created November 15, 2011 04:01
Testing concept for traits based on params
#!/usr/bin/env perl
{
package MyTest::Source::File;
use Moose::Role;
has filename => (
isa => 'Str',
is => 'ro',
required => 1,
@Getty
Getty / OverviewPerl.md
Created February 2, 2012 21:47
Overview of Perl

Overview of Perl

What is Perl?

Perl is a general purpose scripting language, which is often called "the glue of the internet". It is very flexible and powerful, and so it can be easily misused, which leads to a history with lots of misunderstandments, so, whatever you heard about Perl before, please forget it first, and start getting a feeling for the modern and new culture of Perl.

For getting a really complete overview of the current culture of Perl, we strongly suggest reading of the free modern Perl book of Onyx Neon. But we will give a small overview of the most important things to know here, if you already know other languages and are aware of developing by itself.

At first its important to understand that even if Perl is a script language, many of the modules uses compiled C code, thats why you cant just copy together some Perl modules (the .pm files) and think this work. An installation of a Perl distribution is a specific process, which is covere

@Getty
Getty / PerlDevEnv.md
Created February 2, 2012 23:11
Setting up a Perl development environment

Setting up a Perl development environment

Getting the right base system

We at DuckDuckGo, only work with Linux (mostly Ubuntu and Debian) as base systems for our code, so we also only cover this in this documentation. It is essential that you have an Ubuntu or a Debian (it should have Perl 5.10 installed, which is on all stable version of those distributions), if you dont have those systems, you should think about installing a virtual machine on your system. Most easy is VMware Player which you can get from here. A Debian image you can get from here. We require that you have some base knowledge of Linux and know how to handle a shell. We cant really give you hints how to obtain this knowledge, but you are welcome to visit us on our Chat and we can talk about it :).

Incase of trouble...

Please contact us and our community on our chat at [http://webchat.fr

@Getty
Getty / DuckDuckGoPerl.md
Created February 3, 2012 00:38
DuckDuckGo and Perl

DuckDuckGo and Perl

Our version of Perl

Right now, all we do on DuckDuckGo (so the search engine itself, the community platform and all additional services), is using Perl 5.10.1 as base. In the near future we want to upgrade to Perl 5.16 to bringup the most recent speed advantages to our platform, but right now its all Perl 5.10.1 and will stay on this only we start planning to change this. It will anyway not impact the development of the modules, because Perl 5.16 is compatible to Perl 5.10.1 like all Perl versions are backward compatible. This way it assures that the switch will be very painless.

DuckDuckGo Core and DuckDuckGo Community

On DuckDuckGo we try to use the most fitting solutions for the problem. Thats why we have splitted up our Perl development into 2 general paths: "Most Modern" and "Most Fast", to put it into easy words. The "Most Modern" way is the way of the Community Platform and all services which are not part of the core search engine abilities. This way we assure that we ca

@Getty
Getty / DuckPAN.pm
Created February 3, 2012 02:04
What is the DuckPAN?
# What is the DuckPAN?
## General purpose
The [DuckPAN](http://duckpan.org) is our central release registry for all our opensource code distributions. The main purpose is to open a release based contribution concept which allows the developer to NOT leave his common workflow to generate the contributions for DuckDuckGo.
## Uploading Perl distributions
For uploading Perl modules to DuckPAN, we added a PAUSE like upload point, which you can use with the [Community Platform](https://dukgo.com/) credentials. We provide a [Dist::Zilla](https://metacpan.org/module/Dist::Zilla) module as [Dist::Zilla::Plugin::UploadToDuckPAN](https://metacpan.org/module/Dist::Zilla::Plugin::UploadToDuckPAN), which makes it trivial to upload a Perl distribution to our DuckPAN.