This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test2::V0; | |
use Object::Pad 0.808; | |
class Power { | |
field $_power :inheritable = 0; | |
method of ($number) { $number ** $_power }; | |
}; | |
class Square { | |
inherit Power '$_power'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
# | |
# Install the dev utilities I need | |
# emacs (blead) | |
if ! [ -x "$(command -v emacs)" ]; then | |
# I needed these dependencies (you might not) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test2::V0; | |
subtest 'Using stubs in Test2' => sub { | |
my $user = mock { company => 'dev' }; | |
my $userdata = mock { day => '2022-02-02' }; | |
my $stats = mock { user => $user, userdata => $userdata }; | |
is( $stats->user->company, 'dev', | |
'should return the right value for $stats->user->company', | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
git init | |
npm init -y | |
npm install -D depcheck eslint eslint-config-prettier eslint-plugin-jsdoc eslint-plugin-json eslint-plugin-prettier husky lint-staged prettier | |
npm pkg set scripts.depcheck='depcheck' | |
npm pkg set scripts.lint-staged='lint-staged --allow-empty' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://json-schema.org/draft/2019-09/schema", | |
"additionalProperties": false, | |
"properties": { | |
"client_id": { | |
"type": "string" | |
}, | |
"source_id": { | |
"type": "string" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
package MyTypes; | |
use Type::Library -extends => ['Types::Standard'], -declare => qw< Transaction >; | |
use Type::Utils -all; | |
use JSON::Schema::AsType; | |
my $schema_uri | |
= 'https://gist.githubusercontent.com/j1n3l0/43676471d8121bfbce2835119201b3ed/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
package MyTypes; | |
use Type::Library -extends => ['Types::Standard'], -declare => qw< Error >; | |
use Type::Utils -all; | |
declare Error, as Dict [ error => Str ]; | |
__PACKAGE__->meta->make_immutable(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chai = require('chai'); | |
const chaiHttp = require('chai-http'); | |
const nock = require('nock'); | |
const axios = require('axios'); | |
chai.use(chaiHttp); | |
const { expect, request } = chai; | |
class Client { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Client; | |
use Moo; | |
use Type::Utils qw< class_type >; | |
use Types::Standard -types; | |
use URI; | |
use experimental qw< signatures >; | |
has service_uri => ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test2::V0; | |
package Api::Client 1.0 { | |
use Moose; | |
use Moose::Util::TypeConstraints; | |
use Readonly; | |
Readonly my $DEFAULT_HOSTNAME => 'api.example.com'; | |
subtype 'EmptyStr', as 'Str', where { /^$/ }; |
NewerOlder