Skip to content

Instantly share code, notes, and snippets.

View prevostc's full-sized avatar

Clément prevostc

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_005046A8-D92D-4955-9B5D-64181AD2F137" xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/" xmlns:kie="http://www.drools.org/kie/dmn/1.2" xmlns:dmndi="http://www.omg.org/spec/DMN/20180521/DMNDI/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" id="_8D675920-0F53-4F0C-958F-529524842933" name="Untitled" typeLanguage="http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_005046A8-D92D-4955-9B5D-64181AD2F137">
<dmn:extensionElements/>
<dmn:decision id="_ADD466C4-4297-43E3-B2FA-243BA3463520" name="Decide amount to use per wallet">
<dmn:extensionElements/>
<dmn:variable id="_DED16D64-2B38-48AF-AAE5-1BD8E29E4610" name="Decide amount to use per wallet"/>
<dmn:informationRequirement id="_D5D3F0C7-7FB5-4A8A-9AED-96ACC329ABF7">
<dmn:requiredDecision href="#_6B37BF4D-7EF4-4
@prevostc
prevostc / Slider.tsx
Created August 22, 2018 15:49
Component with event listeners on window
import React, { Component, MouseEvent } from "react"
import { AnyChildren } from "react"
import { isServer } from "../../platform"
import { SliderArrows } from "./SliderArrows"
interface IProps<ItemType> {
children: (props: { item: ItemType }) => AnyChildren
items: ItemType[]
}
@prevostc
prevostc / graphql.ts
Created August 22, 2018 15:41
Detect Graphql Selected Fields and subfields, account for aliases and fragments
import {
FieldNode,
FragmentSpreadNode,
GraphQLResolveInfo,
ResponsePath,
SelectionSetNode,
} from "graphql"
import { flatMap } from "lodash"
function instanceOfFieldNode(object: any): object is FieldNode {
#!/usr/bin/env bash
NODE_ENV=development
outdated_dependencies=$(npm outdated --long | tail -n +2 | grep -v beta | grep -v git | grep -v webpack-dev-server)
if [[ ${outdated_dependencies} ]]; then
echo "Dependencies outdated"
echo "$outdated_dependencies"
exit 1
else
@prevostc
prevostc / .codegen generate_typings.sh
Created June 4, 2018 10:27
Generate TypeScript types from Grahphql api + usage examples for apollo react client + usage examples for node js apollo server resolvers
# .codegen/generate_typings.sh
#!/bin/sh
set -e # exit on error
SCRIPT=$(dirname "$0") # Absolute path to this script, e.g. /home/user/bin/foo.sh
BASE_DIR=$(dirname "$SCRIPT") # Absolute path this script is in, thus /home/user/bin
BIN_DIR=$BASE_DIR/node_modules/.bin
CODEGEN_DIR=$BASE_DIR/.codegen
@prevostc
prevostc / frontend: PostList.tsx
Last active May 18, 2018 23:09
graphql-binding: automatic types all the way. In response to https://github.com/graphql-binding/graphql-binding/issues/86
import { ApolloError } from "apollo-boost";
import gql from "graphql-tag";
import { graphql } from "react-apollo";
/////////////////////////////////////////////////////////////////////
// somehow generate these interfaces based on the query and schema //
/////////////////////////////////////////////////////////////////////
interface IPost {
id: number;