Skip to content

Instantly share code, notes, and snippets.

Kristian Mandrup kristianmandrup

Block or report user

Report or block kristianmandrup

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
kristianmandrup / api.d.ts
Created Mar 29, 2019
Chevrotain CST with location info
View api.d.ts
export interface ILocation {
startOffset: number
startLine: number
export interface CstNode {
readonly name: string
readonly children: CstChildrenDictionary
readonly recoveredNode?: boolean
kristianmandrup / mockMang.js
Last active Oct 23, 2019
LevelUp Tuts: mockMang for testing Apollo GraphQL
View mockMang.js
import { makeExecutableSchema, addMockFunctionsToSchema } from "graphql-tools";
import { graphql } from "graphql";
import { ApolloClient } from "apollo-client";
import { from } from "apollo-link";
import { withClientState } from "apollo-link-state";
import { InMemoryCache } from "apollo-cache-memory";
import GoalsSchema from "../api/goals/Goal.graphql";
// import { defaultState } from '../ui/config/apollo/defaultState'
const defaultState = {};
View index.html
<!doctype html>
<link href="" rel="stylesheet">
<div aurelia-app="src/configure">
for i in 1 2 3; do
dm rm -f swarm-$i
# swarm with 3 managers
# switch to swarm-1 env
eval $(dm env swarm-1)
View testing-DSL-example.js
let testCall = async () => {
return await _.callApi(route + '/rate', 'POST', requests.rate);
test('route: components')
.that('POST component rating')
.will('add a rating to the component', async () => {
.will('NOT add a second rating to the component for the same user', async () => {
kristianmandrup / dsl.js
Last active Oct 16, 2016
Improved Javascript testing DSL
View dsl.js
const chai = require('chai');
class Tester {
constructor(parent, text, opts) {
this.parent = parent;
this.text = text;
View Artefact file

Artefact file structure

kristianmandrup /
Last active Apr 23, 2018
Aurelia dynamic view based on dynamic models

How to write a generic View renderer

Taken in part from discussions/solutions mentioned [here]this

Please also look at view-manager and aurelia-form for inspiration. Maybe also look here for example of dynamic data grid with rows and columns :)

Notes: This works for me as well. I only had to change view.bind(this.bindingContext); to view.bind(this); as I wanted to bind to the model itself (not its parent) and initially failed on using click delegates.


View app-alt.ts
// alternative way
ChildRouteLocator.prototype.convertInstructionToConfigurationUrl = (instruction) => {
kristianmandrup / React Reactive Component
Last active Mar 31, 2016
Reactive Component Styles for React
View React Reactive Component
export default Styles {
    constructor(props, state) {
        this.props = props;
        this.state = state;

    generic() {
        return [];
You can’t perform that action at this time.