Skip to content

Instantly share code, notes, and snippets.

View martijnvdbrug's full-sized avatar

Martijn martijnvdbrug

View GitHub Profile
@martijnvdbrug
martijnvdbrug / VuePage.vue
Last active October 4, 2022 09:12
Javascript variables and Vue props
<template>
<!-- Geef string door aan component. hetzelfde als standaard HTML attributen -->
<ProductCard
title="Dit wordt de titel"
/>
<!-- Geef een variabele door aan component -->
<ProductCard
:title="productName"
@martijnvdbrug
martijnvdbrug / Index.vue
Last active January 18, 2021 13:15
Gridsome Vendure hydration example
<template>
<div>
<div v-for="product in $page.Vendure.products.items" >
<img :src="product.featuredAsset.preview" class="thumbnail" />
<p :class="product.soldOut ? 'sold-out' : ''" class="product-title">{{ product.name }}</p>
<p :class="product.soldOut ? 'sold-out' : ''">{{ product.variants[0].priceWithTax }}</p>
<p v-if="product.soldOut">SOLD OUT</p>
</div>
</div>
</template>
@martijnvdbrug
martijnvdbrug / deploy.yml
Last active May 29, 2020 13:24
Example setup of GitHub action to deploy to multiple Google Cloud Run environments
name: Deploy
on:
push:
tags:
- '**'
env:
RUN_REGION: europe-west1
SERVICE_NAME: api
export class CompleteFlow implements Flow {
createConfiguration(): Promise<ProductConfiguration> {
// blijft hetzelfde?
return undefined;
}
getOptions(): Promise<ProductConfigurationOption> {
// is anders per flow
return undefined;
import {Injectable, Module} from '@nestjs/common';
import {NestFactory} from '@nestjs/core';
@Injectable()
export class SlowService {
constructor() {
console.log(`Created SlowService`);
}
}
import {Injectable, Module} from '@nestjs/common';
import {NestFactory} from '@nestjs/core';
@Injectable()
export class SlowService {
constructor() {
console.log(`Created SlowService`);
}
}
type Tesla {
id: ID!
model: String
edition: String
kwh: Int
range: Int
wheels: Wheel
}
type Wheel {
import {Module} from '@nestjs/common';
import {Tesla, Wheel} from '../../generated/graphql-types';
import shortid = require('shortid');
class IResolvers {
}
@Module({
providers: [],
exports: []
import {NestFactory} from '@nestjs/core';
import {INestApplicationContext} from '@nestjs/common';
import {AppModule} from './app/app.module';
import {ApolloServer} from 'apollo-server-cloud-functions';
export let context: INestApplicationContext;
export async function bootstrap(): Promise<any> {
context = await NestFactory.createApplicationContext(AppModule); // Initialize Nest without starting a server (because we're running in GCloud functions)
const app = context.get(AppModule);
@martijnvdbrug
martijnvdbrug / app.module.ts
Last active March 1, 2019 12:58
app.module.ts used for Google Cloud Function + NestJS POC
import {DocumentNode} from 'graphql';
import {Module} from '@nestjs/common';
import { TeslaModule } from './tesla/tesla.module';
import * as fs from 'fs';
import glob = require('glob');
@Module({
imports: [
TeslaModule
],