Skip to content

Instantly share code, notes, and snippets.

View mefellows's full-sized avatar

Matt Fellows mefellows

View GitHub Profile
@dwhitney
dwhitney / README.md
Last active March 5, 2022 12:54
Quick React Native with PureScript
  1. create-react-native-app purescript-app; cd purescript-app

  2. pulp init --force

  3. pulp build

  4. src/Main.js

var React = require("react");
var RN = require("react-native");

exports.text = function(props){
FROM node:6.10.0-alpine
RUN apk update && apk upgrade
# Install packages needed for production
RUN apk add --update bash python make g++
# Install packages needed for testing
RUN apk add --update ruby openssl
@toolmantim
toolmantim / pipeline.sh
Last active December 8, 2022 07:19
Ensuring Buildkite pipeline steps run on the same agent, using a dynamic pipeline generator script
#!/bin/bash
# Outputs a pipeline that targets agents that have the same 'name' meta-data
# value as the step that does the pipeline upload. This means that all the
# steps will run on the same agent machine, assuming that the 'name' meta-data
# value is unique to each agent.
#
# Each agent needs to be configured with meta-data like so:
#
# meta-data="name=<unique-name>"
@bethesque
bethesque / a_readme.md
Last active October 21, 2023 16:03
Using Pact with non-HTTP services

When you declare a request and response using the traditional Pact DSL, ("uponReceiving" and "willRespondWith") you're building a structure that has three purposes -

  1. it provides the concrete example request and response used in the tests
  2. it specifies the contents of the contract which...
  3. defines how to validate the the actual request/response against the expected request/response

The three different uses of this structure are hidden from you when using HTTP Pact because the mock service handles numbers 1 & 2 in the consumer tests, and the verification task handles number 3 for you in the provider tests. When using Pact in a non-HTTP scenario, there is no nice neat protocol layer to inject the code to do this for you, so you have to explicitly do each step.

The file expected_data_from_collector.rb declares an object graph using the Pact DSL. This is going to be used to create the concrete example and the contract. This could be declared inline, but for easier maintenance, and to allow the contr

@bethesque
bethesque / 1.sh
Last active July 10, 2018 06:56
HTTP requests to ruby mock server
You will need ruby or the standalone mock service to run these examples.
$ gem install pact-mock_service
@artyom
artyom / rpc-tls-client.go
Last active October 9, 2023 15:44
Go RPC over TLS.You have to create the following keys: certs/client.crt, certs/client.key, certs/server.crt, certs/server.key. client.crt and server.crt should be signed with ca.crt, which should be concatenated to both client.crt and server.crt. It's easier to do with easy-rsa: http://openvpn.net/index.php/open-source/documentation/howto.html#pki
package main
import (
"crypto/tls"
"crypto/x509"
"log"
"net/rpc"
)
func main() {
@andelf
andelf / sendMail.go
Last active September 20, 2023 15:13
golang send mail net/smtp SMTP
package main
import (
"log"
"net/mail"
"encoding/base64"
"net/smtp"
"fmt"
"strings"