Skip to content

Instantly share code, notes, and snippets.

View glennreyes's full-sized avatar
🎵

Glenn Reyes glennreyes

🎵
View GitHub Profile
@glennreyes
glennreyes / query-response.json
Last active September 20, 2023 15:20
GraphQL Workshop slides snippets
{
"data": {
"viewer": {
"id": "clmrvzzlx000008l6e8a4de9o",
"name": "Glenn",
"posts": [
{
"id": "clmrw16zi000108l619ctafwt",
"message": "I'm excited you're here at the awesome GraphQL Workshop!"
},
@glennreyes
glennreyes / polymorphic-component.tsx
Last active April 3, 2024 21:00
An h1 that can be anything from an h1-h4
import type { ComponentPropsWithoutRef, ElementType } from 'react';
type H1Props<TElementType extends ElementType> = Omit<ComponentPropsWithoutRef<TElementType>, 'className'> & {
as?: Extract<TElementType, 'h1' | 'h2' | 'h3' | 'h4'>;
};
export function H1<TElementType extends ElementType>({ as, ...props }: H1Props<TElementType>) {
const Component = as ?? 'h1';
return <Component className="text-5xl font-extrabold tracking-tight" {...props} />;
@glennreyes
glennreyes / workshop-graphql.md
Last active May 17, 2019 09:04
GraphQL for JavaScript developers

GraphQL for JavaScript developers

In this workshop we will dive into GraphQL and build a complete GraphQL backend in JavaScript. This workshop is targeted to engineers who want to learn to build a complete GraphQL server.

Topics covered

  • Fundamentals & GraphQL core concepts
  • Setting up the GraphQL Server
  • Exploring the GraphQL API
  • Working with the SDL (Schema Defintion Language)
@glennreyes
glennreyes / workshop-react-graphql.md
Last active July 2, 2019 12:29
React and GraphQL – From zero to production

React and GraphQL – From zero to production

In this workshop we will build a Twitter Lite React app with a GraphQL backend. This workshop is targeted to engineers who want to learn to build a complete and full stack React app with GraphQL.

Topics covered

  • Fundamentals & GraphQL core concepts
  • Setting up the GraphQL Server
  • Exploring the GraphQL API
  • Setting up the GraphQL Client
const say = (str) => {
let result = str;
const next = (nextStr) => {
if (!nextStr) return result
result += ` ${nextStr}`;
return next
}
@glennreyes
glennreyes / gql-example.js
Created September 10, 2018 17:54
GraphQL import
import { gql } from 'apollo-tag';
const ArticleQuery = gql`
query ArticleQuery {
articles {
id
title
}
}
`;
@glennreyes
glennreyes / config.cfg
Created February 2, 2018 14:35
My very ancient Counter-Strike 1.6 config files
unbindall
bind "TAB" "+showscores"
bind "ESCAPE" "cancelselect"
bind "SPACE" "+jump"
bind "," "buyammo1"
bind "." "buyammo2"
bind "0" "slot10"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
@glennreyes
glennreyes / kill-port.sh
Created December 18, 2017 13:43
Kill process on port 4000
lsof -t -i tcp:4000 | xargs kill
@glennreyes
glennreyes / webpack.config.js
Created October 21, 2017 17:12
Disable Code Splitting in webpack
module.exports = {
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
],
};
@glennreyes
glennreyes / razzle.config.js
Created October 21, 2017 17:09
Code Splitting disabled on server
module.exports = {
modify: (config, { target }) => {
if (target === 'node') {
return {
...config,
plugins: [
...config.plugins,
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),