Skip to content

Instantly share code, notes, and snippets.

View jjn1056's full-sized avatar

John Napiorkowski jjn1056

View GitHub Profile
X-Apparently-To: [email protected]; Wed, 07 Aug 2019 01:32:58 +0000
Return-Path: <[email protected]>
Authentication-Results: mta4190.mail.ne1.yahoo.com;
dkim=neutral (no sig) [email protected];
spf=fail [email protected];
dmarc=NULL(p=NULL sp=NULL dis=NULL) header.from=catme.org;
X-YahooFilteredBulk: 108.198.161.166
Received-SPF: fail (domain of catme.org does not designate 108.198.161.166 as permitted sender)
X-YMailISG: tg6NnfsWLDvWWh6mwvwhcKF3FyJGtbAbGZnPLwWj6wcZp8_C
43FJTqRtaxULmVwPoEvQQOqOiLpBTfjF6W6vR64d6CgrsC7k_aqRLg23m7qL
==> /var/log/httpd/error_log <==
ENVELOPE TO : [email protected]
ENVELOPE FROM: [email protected]
---------- begin message
Date: Tue, 6 Aug 2019 20:35:59 -0500
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Subject: Welcome to CATME - Please Read 17
From: "CATME Team Tools" <[email protected]>
MIME-Version: 1.0
From: john napiorkowski <[email protected]>
Date: Tue, 6 Aug 2019 19:32:52 -0500
Message-ID: <CAMF3Vngj9ie7Z6Kr2foHU2wX_2dCDV_3YAakZejmF8Db+Z2K5A@mail.gmail.com>
Subject: test
To: [email protected]
Content-Type: multipart/alternative; boundary="000000000000da2ed9058f7c152a"
Bcc: [email protected]
Content-Length: 267
@jjn1056
jjn1056 / validation.pm
Last active July 26, 2019 14:38
another validation example
$c->req->data('name', 'Invalid Name')
->exists
->defined
->size(3,10)
->json(',num')
$c->res->http_ok->json($data);
package MyApp::User {
use Moo;
# Decorate this with validation and Schema
has ['name', 'age'] => (is=>'ro', required);
}
use MyApp::User;
use GraphQL::Type::Scalar qw($String);
my $type = GraphQL::Type::Object->new(
name => 'Object',
fields => {
field_name => {
type => $String,
directives => [
{
name => 'isAuthorized',
ub rebuild_schema {
my ($proto) = @_;
my $class = ref $proto || $proto;
my $target_dir = File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]);
my $tables = join('|', @TABLES);
my $constraint = qr/\A(?:$tables)\z/x;
my @args = (
$class,
{
debug => $ENV{CATME_SCHEMA_LOADER_DEBUG}||0,
with demo_surveys as (
select distinct s.survey_id
from survey s
join team t on t.survey_id=s.survey_id
join person student on student.person_id=t.person_id
where substring(student.email from '@(.+)$') = 'sysiphus.com'
group by s.survey_id),
demos as (select
ds.survey_id,
CASE
catme=> select
catme-> CASE
catme-> WHEN COALESCE(name, school) = '' THEN 'EMPTY STRING'
catme-> WHEN COALESCE(name, school) = NULL THEN 'NULL1'
catme-> WHEN COALESCE(name, school) IS NULL THEN 'NULL2'
catme-> ELSE COALESCE(name, school)
catme-> END as institution
catme-> from (
catme(> SELECT 'name' as name, 'school' as school
catme(> UNION ALL
use strict;
use warnings;
use Test::More;
use Test::Warn;
use Test::Exception;
use SQL::Abstract::Test import => [qw(is_same_sql_bind diag_where dumper) ];
use SQL::Abstract;
use SQL::Abstract::ExtraClauses;