Skip to content

Instantly share code, notes, and snippets.

View marvinrabe's full-sized avatar

Marvin Rabe marvinrabe

View GitHub Profile
<template>
<div>
<foo />
</div>
</template>
<script>
export const foo = {
render(createElement) {
return createElement('p', 'Foo!')
@marvinrabe
marvinrabe / Request.php
Created May 14, 2019 06:56
Nuwave Lighthouse Resolve function changes
<?php
namespace App\GraphQL;
use GraphQL\Type\Definition\ResolveInfo;
use Illuminate\Support\Facades\Validator;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;
class Request
{
@marvinrabe
marvinrabe / IsExisting.ts
Created December 27, 2018 22:53
Validates if value exists or is unique in database. Using class-validator and typorm.
import {getRepository} from 'typeorm';
import {ValidationArguments, ValidatorConstraint, ValidatorConstraintInterface} from "class-validator";
@ValidatorConstraint({name: "exists", async: true})
export class IsExisting implements ValidatorConstraintInterface {
async validate(value: any, args: ValidationArguments) {
return 0 !== await getRepository(args.constraints[0]).count({
where: {
[args.constraints[1]]: value
@marvinrabe
marvinrabe / vue.config.js
Last active December 25, 2018 16:20
Change path of public folder in vue-cli
const path = require('path')
const publicDir = 'assets/html'
module.exports = {
chainWebpack: config => {
config
.plugin('html')
.tap(configs => {
configs[0].template = path.resolve(publicDir + '/index.html');
@marvinrabe
marvinrabe / Copy as Markdown
Last active June 1, 2016 11:16 — forked from jakob-stoeck/Copy as textile
Copies SequelPro results as a Markdown table to use it in markdown-supported systems.
#!/usr/bin/php
<?php
function parseInput() {
$in = fopen('php://stdin', 'r');
$result = array();
while($line = fgetcsv($in, 0, "\t")) {
$result[] = $line;
}
fclose($in);