Skip to content

Instantly share code, notes, and snippets.

View stefanoverna's full-sized avatar

Stefano Verna stefanoverna

View GitHub Profile
{
"id": 0,
"name": "datocms-plugin-sdk",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 1,
"name": "Account",
{
"id": 0,
"name": "datocms-react-ui",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 137,
"name": "FieldGroupProps",
import type { RenderFieldExtensionCtx } from "datocms-plugin-sdk";
import { Canvas } from "datocms-react-ui";
import { useEffect, useState } from "react";
type Props = {
ctx: RenderFieldExtensionCtx;
};
export default function Editor({ ctx }: Props) {
const key = JSON.stringify([ctx.item?.id, ctx.fieldPath]);
{
"id": 0,
"name": "datocms-react-ui",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 135,
"name": "FieldGroupProps",
{
"id": 0,
"name": "datocms-plugin-sdk",
"variant": "project",
"kind": 1,
"flags": {},
"children": [
{
"id": 1,
"name": "Account",
import { buildClient } from "@datocms/cma-client-node";
import fetch from "cross-fetch";
const client = buildClient({
apiToken: process.env.READWRITE_DATOCMS_API_TOKEN,
fetchFn: fetch,
});
async function run() {
for await (const delivery of client.webhookCalls.listPagedIterator({
@stefanoverna
stefanoverna / index.tsx
Created March 28, 2023 09:27
Example of usage of new hooks
import { connect } from 'datocms-plugin-sdk';
connect({
buildItemPresentationInfo(item, ctx) {
// we only want to customize the presentation for records of a specific
// model
if (item.relationships.item_type.data.id !== '810975') {
return undefined;
}
#include <stdio.h>
#include <string.h>
struct KeyPoint
{
char key;
char points;
};
struct KeyPoint rules[] = {
import withLayoutProps from 'utils/withLayoutProps';
export const getStaticProps = withLayoutProps(async ({ params: { id } }) => {
const pokemon = await api.getPokemonById(id);
return {
props: { pokemon },
};
});
@stefanoverna
stefanoverna / accentate.json
Created January 27, 2021 08:49
Karabiner Italian Accents: put this in <CONFIG_FOLDER>/assets/complex_modifications/
{
"title": "Lettere accentate",
"rules": [
{
"description": "Option + e = è",
"manipulators": [
{
"type": "basic",
"from": {
"modifiers": {