Skip to content

Instantly share code, notes, and snippets.

View kristianmandrup's full-sized avatar

Kristian Mandrup kristianmandrup

  • Freelancer
  • Copenhagen
View GitHub Profile
@kristianmandrup
kristianmandrup / amplify-roze-style.css
Created November 20, 2020 20:32
Roze styling for Amplify Auth
.signin {
text-align: center;
}
.signin div {
background-color: transparent;
color: whitesmoke;
box-shadow: none;
}
@kristianmandrup
kristianmandrup / typeTable.nim
Last active February 29, 2020 16:22
Nim type/id table display
type
TIdTableEntry = object
id: string
genId: string
startIndex: int
endIndex: int
PIdTableEntry = ref TIdTableEntry
TIdLookupTable = object
@kristianmandrup
kristianmandrup / api.d.ts
Created March 29, 2019 09:10
Chevrotain CST with location info
export interface ILocation {
startOffset: number
startLine: number
}
export interface CstNode {
readonly name: string
readonly children: CstChildrenDictionary
readonly recoveredNode?: boolean
/**
@kristianmandrup
kristianmandrup / mockMang.js
Last active October 23, 2019 19:41
LevelUp Tuts: mockMang for testing Apollo GraphQL
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 = {};
<!doctype html>
<html>
<head>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<div aurelia-app="src/configure">
Loading...
for i in 1 2 3; do
dm rm -f swarm-$i
done
# swarm with 3 managers
scripts/dm-swarm.sh
# switch to swarm-1 env
eval $(dm env swarm-1)
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 () => {
check.ratingAdded(testCall());
})
.will('NOT add a second rating to the component for the same user', async () => {
@kristianmandrup
kristianmandrup / dsl.js
Last active October 16, 2016 13:51
Improved Javascript testing DSL
require('babel-core/register');
require('babel-polyfill');
const chai = require('chai');
chai.should();
class Tester {
constructor(parent, text, opts) {
this.parent = parent;
this.text = text;

Artefact file structure

artefact.json
map.json
/view-models
/services
/ui
/preview
/fakes
@kristianmandrup
kristianmandrup / Readme.md
Last active April 23, 2018 10:05
Aurelia dynamic view based on dynamic models

How to write a generic View renderer

Taken in part from discussions/solutions mentioned [here]this aurelia/templating#35)

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.

Alternative!?