Skip to content

Instantly share code, notes, and snippets.

💭
Currently in the garden. Will be back in (Australian) Winter.

Beth Skurrie bethesque

💭
Currently in the garden. Will be back in (Australian) Winter.
Block or report user

Report or block bethesque

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View send_ctrl_c.c
// attribution: http://stackoverflow.com/a/15281070/32453
// you can compile this with gcc [mingw or mingw-w64] and probably other compilers as well
#include <stdlib.h> // NULL
#include <stdbool.h> // false
#include <windows.h> // AttachConsole, CTRL_C_EVENT, etc.
#include <stdio.h> // printf
#include <strsafe.h>
void logLastError()
@bethesque
bethesque / 1.sh
Last active Jul 10, 2018
HTTP requests to ruby mock server
View 1.sh
You will need ruby or the standalone mock service to run these examples.
$ gem install pact-mock_service
@bethesque
bethesque / thoughts.md
Last active Jan 1, 2016
Thoughts on flexible matching for Pact
View thoughts.md

Assumptions based on experience with pacts so for:

  • The most common type of matching that is useful is asserting that:
    • The expected keys are present
    • The values at the actual keys are of the same class (string/number/nil) as the expected values
    • Occasionally we'll want a literal match
    • Occasionally we'll want a regular expresssion
    • Extra keys in a hash are OK for responses but not for requests (following the "be strict with what you send out, be lax with what you accept" principle)
    • Extra items in an array are debatable (extra keys in a hash are generally ignored, however, all items in an array are generally processed, so allowing "unverified" extras to sneak in could be a bad thing. Working out what to do with "extras" is not immediately obvious to me however.)
@bethesque
bethesque / flexible-matching.rb
Last active Jan 1, 2016
An idea of what a flexible matching fluent API might look like, and how it could be serialised.
View flexible-matching.rb
# Notes:
# Headers and status would still be value based matching
# Default to type based matching???
# like(xxx) means xxx and all children would be matched using type based matching
# literal(xxx) means xxx and all children would be matched using exact value matching
# eg(generate, matcher) would be a regular expression match
# each_like([]) would indicate the each element in the array should be like the example given
# A like() could be nested inside a literal() which could be nested inside a like() - at each stage,
# it changes the matching type for all children until it gets switched back.
You can’t perform that action at this time.