Skip to content

Instantly share code, notes, and snippets.

View monachilada's full-sized avatar

Mike Pierce monachilada

  • Berlin, Germany
View GitHub Profile
@monachilada
monachilada / .gitlab-ci.yml
Created October 10, 2019 08:05
Gitlab pipeline for running Craft/gatsby side by side on the same server to enable live preview.
include: 'https://gitlab.com/gitlab-cd/ssh-template/raw/master/ssh.yml'
# Install build dependencies.
.build:
image: node:12.8
variables:
YARN_CACHE_DIR: '.ci/yarn-cache'
script:
# Some build dependencies
@monachilada
monachilada / gatsby-config.js
Last active October 16, 2020 19:03
Sample gatsby-config.js enabling live preview in Craft CMS
const { createHttpLink } = require('apollo-link-http');
const fetch = require('node-fetch');
const store = require('store');
const sourceNodes = require('gatsby/dist/utils/source-nodes');
require('dotenv').config();
const craftGqlUrl = process.env.CRAFT_GQL_URL;
const craftGqlToken = process.env.CRAFT_GQL_TOKEN;
module.exports = {
<?
public function testNestedValidation() {
Validator::add('match', function($value, $format = null, array $options = array()) {
$options += array(
'against' => '',
'values' => array()
);
extract($options);