Skip to content

Instantly share code, notes, and snippets.

@Maxim-Filimonov
Maxim-Filimonov / converter.ts
Created August 16, 2022 16:48
ApolloGraphQLInteraction with Pact V3
function convertApolloToV3Interaction(
apolloInteraction: ApolloGraphQLInteraction,
states?: V3ProviderState[],
): V3Interaction {
const interaction = apolloInteraction.json();
return {
states,
uponReceiving: interaction.description,
withRequest: {
method: interaction.request.method,
@Maxim-Filimonov
Maxim-Filimonov / ex1.md
Last active June 12, 2018 04:12
Express.js assignments

Grocery List API

Build an API for grocery list mobile app.

POST /groceries/

Example request:

POST /groceries

{
  title: "Milk",
  category: "Milk based products",
 amount: 1
@Maxim-Filimonov
Maxim-Filimonov / index.js
Created July 31, 2017 15:29
Sinon stubbing of function
function getTodos(listId, callback) {
helpers.makeHttpCall({
url: '/todo/' + listId + '/items',
success: function (data) {
// Node-style CPS: callback(err, data)
callback(null, data);
}
});
}
// This wrapper is required for our stubbing to work
@Maxim-Filimonov
Maxim-Filimonov / HYgL-0.js
Created April 25, 2017 03:40
null created by Maxim-Filimonov - https://repl.it/HYgL/0
function magic() {
console.log("MAGIC")
}
@Maxim-Filimonov
Maxim-Filimonov / Dockerfile
Created April 24, 2015 09:52
Docker meteor example files
# User for local dev
FROM app/base
RUN npm install -g orion-cli
# This forces package-catalog update. Should speed up further runs
RUN meteor show meteor-platform
@Maxim-Filimonov
Maxim-Filimonov / Codeship deployment script
Last active July 19, 2016 02:38
Precompile assets on codeship
# Assuming that you have followed all the instructions from https://github.com/rumblelabs/asset_sync
# Put this in your deployment script
# Choose any environment here the important part is that your environment is using the same bucket for all environments
# than you only need to precompile assets once
RAILS_ENV=staging bundle exec rake assets:precompile
# You need to set git credentials otherwise it won't be able to commit
git config --global user.email "codeship@codeship.com"
git config --global user.name "Codeship Server"
# Add your manifest file so that rails can find digested version of files
@Maxim-Filimonov
Maxim-Filimonov / .babelrc
Last active May 18, 2016 03:04
Array#flatten in JS
{ "presets": ["es2015"] }
@Maxim-Filimonov
Maxim-Filimonov / parser.go
Last active December 28, 2015 06:49
Parsing flat structure into a tree in Go %)
package parser
import (
"database/sql"
"fmt"
)
type Row struct {
MenuId int
Menu sql.NullString