Skip to content

Instantly share code, notes, and snippets.

View kamilkisiela's full-sized avatar
🕶️
Kamil Kisiela

Kamil Kisiela kamilkisiela

🕶️
Kamil Kisiela
View GitHub Profile
CREATE TABLE IF NOT EXISTS default.operation_collection
(
target LowCardinality(String) CODEC(ZSTD(1)),
hash String CODEC(ZSTD(1)),
name String CODEC(ZSTD(1)),
body String CODEC(ZSTD(1)),
operation_kind String CODEC(ZSTD(1)),
coordinates Array(String) CODEC(ZSTD(1)),
total UInt32 CODEC(T64, ZSTD(1)),
timestamp DateTime('UTC') CODEC(DoubleDelta, LZ4),
@kamilkisiela
kamilkisiela / checks.spec.ts
Created January 2, 2023 14:04
Checks - step by step
import { createCheck, runCheck } from '../providers/checks';
// <step status> (<requirement>) -> <step status> (<requirement>) = <failed step index 1,2...n> (<result status>)
runTest('skipped (optional) -> skipped (optional) = (completed)');
runTest('completed (optional) -> skipped (optional) = (completed)');
runTest('skipped (optional) -> skipped (required) = 2 (failed)');
runTest('skipped (required) -> skipped (required) = 1 (failed)');
runTest('completed (required) -> skipped (required) = 2 (failed)');
runTest('completed (optional) -> skipped (required) = 2 (failed)');
@kamilkisiela
kamilkisiela / machine.js
Last active November 7, 2019 19:40
Generated by XState Viz: https://xstate.js.org/viz
// actions
const addSuspensed = assign({
suspendedCount: context => context.suspendedCount + 1
});
const removeSuspensed = assign({
suspendedCount: context => context.suspendedCount - 1
});
@kamilkisiela
kamilkisiela / example.ts
Last active October 17, 2019 09:12
apollo-toolkit
// Before
this.addTransactionGQL.mutate(
{ input },
{
update: (cache, result) => {
const data = cache.readQuery<GetTransactions.Query>({
query: GET_TRANSACTIONS_QUERY
});
@kamilkisiela
kamilkisiela / sofa-swagger.ts
Last active January 24, 2019 16:15
Sofa with OpenAPI (Swagger)
import sofa, { OpenAPI } from 'sofa-api';
const openApi = OpenAPI({
schema,
info: {
title: 'Example API',
version: '3.0.0',
},
});
@kamilkisiela
kamilkisiela / sofa.ts
Last active January 24, 2019 16:09
Sofa
import sofa from 'sofa-api';
import express from 'express';
const app = express();
app.use(
sofa({ schema })
);
this.loona
.mutate(NewMessage, variables, {
optimisticResponse: {
newMessage: {
__typename: 'Message',
id: randomID(),
text,
createdAt: new Date(),
sender,
recipient,
@Injectable()
export class ChatsService {
constructor(
private http: HttpClient,
private store: Store<AppState>
) {}
getChats() {
return this.store
.select(state => state.chats)
{
chats @rest(type: "Chat", path: "/chats")
{
id @export(as: "chatId")
members @rest(type: "[User]", path: "/chats/:chatId/members") {
...UserFragment
}
recentMessage @type(name: "Message") {
...MessageFragment
}
@kamilkisiela
kamilkisiela / main.workflow
Created January 14, 2019 14:40
GraphQL Inspector as Github Action
workflow "On Push" {
on = "push"
resolves = "Check GraphQL with Inspector"
}
workflow "On Pull Request" {
on = "pull_request"
resolves = "Check GraphQL with Inspector"
}