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
kristianmandrup / Converting libraries to Ember CLI addons.md
Last active Aug 1, 2019
Guide to Developing Addons and Blueprints for Ember CLI
View Converting libraries to Ember CLI addons.md

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

@kristianmandrup
kristianmandrup / pdf_converter.rb
Last active May 31, 2019
Jekyll PDF Converter using PDFKit
View pdf_converter.rb
require 'pdfkit'
require 'nokogiri'
require 'haml'
# config/initializers/pdfkit.rb
PDFKit.configure do |config|
# Note: Often required for Windows OS configuration
# config.wkhtmltopdf = '/path/to/wkhtmltopdf'
@kristianmandrup
kristianmandrup / mockMang.js
Last active May 15, 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 = {};
@kristianmandrup
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
/**
View Converting macports to homebrew
Homebrew is the way of the future..
1. Save list of installed ports
2. Uninstall macports
3. Install Homebrew
4. Install old ports using brew
1. Save list of installed ports
----------------------------
1. port installed > ports_installed.txt
View index.html
<!doctype html>
<html>
<head>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<div aurelia-app="src/configure">
Loading...
@kristianmandrup
kristianmandrup / Readme.md
Last active Apr 23, 2018
Aurelia dynamic view based on dynamic models
View Readme.md

How to write a generic View renderer

Taken in part from discussions/solutions mentioned [here]this https://github.com/aurelia/templating/issues/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!?

View docker-jenkins.sh
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)
@kristianmandrup
kristianmandrup / aurelia-started.md
Last active Feb 22, 2017
Aurelia Getting started - walk through
View aurelia-started.md

Aurelia

Recipe

  • Install NVM
  • Install IO.js
  • Install global Node.js utility modules (gulp, jspm, yo)
  • Install RethinkDB
  • Install Koa.js
  • Install Aurelia generator
  • Create Aurelia app via generator
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 () => {
check.ratingAdded(testCall());
})
.will('NOT add a second rating to the component for the same user', async () => {
You can’t perform that action at this time.