Skip to content

Instantly share code, notes, and snippets.

View horne3754sg's full-sized avatar

Matthew Horne horne3754sg

  • United Kingdom
View GitHub Profile
@horne3754sg
horne3754sg / example-thesis-box-with-cpt
Last active August 29, 2015 14:06
An example Thesis 2 box demonstrating how to register a Custom Post Type (CPT) within boxes.
<?php
/*
Name: Example CPT registration in a Thesis 2 Box
Author: Matthew Horne - Zerogravityskins.com
Description: enter your description here.
Version: 1.0
Class: my_custom_class
*/
class my_custom_class extends thesis_box {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.header-block {
display: block;
padding: 1em;
@horne3754sg
horne3754sg / gist:548d66538ef8fd8e68d396b892d7c6fd
Created March 13, 2023 17:56
Basic React Router v6 and Relay integration
/**
* This may not be the most ideal way, but it works for me.
*
* You have to use one of their data routers in order to support loaders. https://reactrouter.com/en/main/routers/picking-a-router
*
* Then you can use loaders https://reactrouter.com/en/main/route/loader
*
* I played around with it for a while and eventually came up with something like this.
*/
@horne3754sg
horne3754sg / gist:5c1c05a50502d3cb5f414b8b7855420d
Created March 17, 2023 10:21
How to type multiple fragments which share the same reference
// Component 1
const fragment1 = graphql`
fragment Component1fragment1 on User {
id
}
`;
function Component1({ user }: { user: Component1fragment1$key }) {
const data = useFragment(fragment1, user);