Skip to content

Instantly share code, notes, and snippets.

Avatar

Mitchel van Eijgen mvaneijgen

View GitHub Profile
@mvaneijgen
mvaneijgen / function.php
Last active Aug 18, 2020
Possible solution for multiple where: in GraphQL and Wordpress
View function.php
<?php
// Register extra types
add_action('graphql_register_types', function () {
$customposttype_graphql_single_name = “MyCustomPostType”;
register_graphql_field('RootQueryTo' . $customposttype_graphql_single_name . 'ConnectionWhereArgs', 'postObjectIdTWO', [
'type' => 'ID',
'description' => __('The ID of the post object to filter by', 'your-textdomain'),
]);
View external.js
(function ($) {
// External tools and plugis JS
gsap.registerPlugin(ScrollTrigger); // Register plugin so you can use defauls
gsap.registerPlugin(MotionPathPlugin);
ScrollTrigger.defaults({ // Defaults are used by all ScrollTriggers
toggleActions: "restart pause reverse pause", // Scoll effect Forward, Leave, Back, Back Leave
markers: true // Easaly remove markers for production
});
View Taxonomy loop.php
<?php
$taxonamy = 'location';
$terms = get_terms($taxonamy, array('hide_empty' => true));
?>
<?php if (!empty($terms) && !is_wp_error($terms)) : ?>
<?php foreach ($terms as $term) : ?>
<?php
$args = array(
'post_type' => 'thanks',
'posts_per_page' => -1,
View group_58f9b55cdbf02.json
{
"key": "group_58f9b55cdbf02",
"title": "Flex",
"fields": [
{
"key": "field_58f9b56154b9a",
"label": "Contentblokken",
"name": "content-blocks",
"type": "flexible_content",
"instructions": "",
@mvaneijgen
mvaneijgen / colorSorting.js
Created Apr 25, 2020 — forked from afonsograca/colorSorting.js
Color sorting in JavaScript
View colorSorting.js
//Sorting Hex Color:
var scheme = [
"#4C4C4C","#1F2029","#35404E","#282938","#00A0BE","#C67C48","#32CF72", "#4155D1","#B86838","#D81196","#149C92","#786DC4","#DB2C38","#83C057", "#A4A4A4","#55747C","#FFFFFF"
];
var Color = function Color(hexVal) { //define a Color class for the color objects
this.hex = hexVal;
};
View 4096 Hex colors
000
001
002
003
004
005
006
007
008
009
View GSAP.js
import Vue from 'vue'
import { gsap } from "gsap";
import { DrawSVGPlugin } from "../static/DrawSVGPlugin.min.js";
import { MorphSVGPlugin } from "../static/MorphSVGPlugin.min.js";
import ScrollMagic from 'scrollmagic'
import 'imports-loader?define=>false!scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap'
gsap.registerPlugin(DrawSVGPlugin, MorphSVGPlugin);
const GSAPScrollMagic = {
View CloudWatch Puppeteer error
2020-04-21
No older events found at the moment. Retry.
13:45:57
START RequestId: 46169c68-fd33-4ace-ab16-f352be1798c1 Version: $LATEST
START RequestId: 46169c68-fd33-4ace-ab16-f352be1798c1 Version: $LATEST
13:46:02
2020-04-21T13:46:02.436Z 46169c68-fd33-4ace-ab16-f352be1798c1 ERROR Error occured in serverless-plugin-chrome wrapper when trying to ensure Chrome for hello() handler. { flags: [] } Error: Unable to start Chrome. If you have the DEBUG env variable set,there will be more in the logs. at /var/task/node_modules/@serverless-chrome/lambda/dist/bundle.cjs.js:376:13 at Generator.throw (<anonymous
2020-04-21T13:46:02.436Z 46169c68-fd33-4ace-ab16-f352be1798c1 ERROR Error occured in serverless-plugin-chrome wrapper when trying to ensure Chrome for hello() handler. { flags: [] } Error: Unable to start Chrome. If you have the DEBUG env variable set,there will be more in the logs.
@mvaneijgen
mvaneijgen / ogimages.js
Created Apr 1, 2020
Function to create OG images on a lamda function also should work on Netlify taken from Wes Bos
View ogimages.js
const chrome = require('chrome-aws-lambda');
const puppeteer = require('puppeteer-core');
const wait = require('waait');
const cached = new Map();
const exePath = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
async function getOptions(isDev) {
if (isDev) {
View config.json
{
"bridge": {
"name": "Homebridge 39ED",
"username": "0E:6B:84:75:39:ED",
"port": 51988,
"pin": "617-71-158"
},
"hosts": [
{
"address": "191.168.1.69",
You can’t perform that action at this time.