Skip to content

Instantly share code, notes, and snippets.

View bschulz87's full-sized avatar
๐Ÿ‰

Benjamin Schulz bschulz87

๐Ÿ‰
  • Germany, Berlin
View GitHub Profile
@bschulz87
bschulz87 / testing-graphql.sh
Created February 4, 2025 14:21 — forked from dabit3/testing-graphql.sh
GraphQL requests using CURL
# query
curl \
-X POST \
-H "x-api-key: xxx-xxxx" \
-H "Content-Type: application/json" \
-d '{ "query": "query { listUsers { name } }" }' \
https://app-id.appsync-api.us-east-1.amazonaws.com/graphql
# mutation with variables
curl \
@bschulz87
bschulz87 / datastore-resolver.js
Created January 27, 2025 10:36
Webiny DataStore Resolver
import { util } from "@aws-appsync/utils";
/**
* Sends a POST request to create a new user
* @param {import('@aws-appsync/utils').Context<{input: {id: string; name:string}}>} ctx the context
* @returns the request
*/
export function request(ctx) {
return fetch("/graphql", {
method: "POST",
@MappableRecord()
typedef Shop = ({
String id,
String name,
DateTime createdAt,
String address,
});
final res = await Amplify.API
.query(
@bschulz87
bschulz87 / stories.dart
Last active July 1, 2024 14:14
Storybook Riverpod Knob
extension on Iterable<(String, Override)> {
List<Option> toKnobOptions() => List<Option>.from(map((e) => Option(label: e.$1, value: e)));
}
final knobOverride = Story(
name: "Knob/Override",
builder: (context) {
final options = [
(
"Loading",
@bschulz87
bschulz87 / gist:74315bc555b502250200ee79a0ad3a7b
Created October 23, 2023 14:34
Simple case insensitive search replace wordpress meta values
SET @old = "Holzbraun";
SET @new = "wooden";
SET @meta_key = "color";
UPDATE wp_postmeta
SET meta_value = REPLACE(REPLACE(meta_value,@old,@new),LOWER(@old),@new)
WHERE LOWER(meta_value) LIKE LOWER(CONCAT('%',@old,'%')) AND meta_key = @meta_key;
SELECT meta_id, post_id, meta_key, meta_value
FROM wp_postmeta
From 7f8939186cb26bf950c6326657edc0b973a8709c Mon Sep 17 00:00:00 2001
From: Benjamin Schulz <[email protected]>
Date: Wed, 14 Sep 2022 14:29:28 +0200
Subject: [PATCH] Fix starqltechn
---
META-INF/com/google/android/update-binary | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary
@bschulz87
bschulz87 / Time-based-auto-scaling-on-fargate.md
Created April 10, 2020 08:44 — forked from toricls/Time-based-auto-scaling-on-fargate.md
Example: Time-based Auto Scaling on Amazon ECS + AWS Fargate

Set parameters

$ export ECS_CLUSTER_NAME={YOUR_ECS_CLUSTER_NAME}
$ export ECS_SERVICE_NAME={YOUR_ECS_SERVICE_NAME}

RegisterScalableTarget

@bschulz87
bschulz87 / index.html
Created February 12, 2019 15:15
vue-matomo with external tracking client
<!DOCTYPE html>
<html lang="en">
<head>
<!-- ... --->
<script src="https://my.matomo.cloud/matomo.js"></script>
<!-- ... --->
</head>
<body>
<!-- ... --->
</body>
@bschulz87
bschulz87 / controls.php
Last active February 5, 2020 16:12
Elementor Custom Control
<?php
namespace ElementorControls;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Elementor_Custom_Controls {
private static $_instance = null;
@bschulz87
bschulz87 / Query.vue
Last active October 7, 2019 09:04
Squidex GraphQL Query
<template lang="pug">
div {{ api }}
</template>
<script>
import { queryCMS } from '@/api'
export default {
data: () => ({
api: null
}),