Skip to content

Instantly share code, notes, and snippets.

View damassi's full-sized avatar

Christopher Pappas damassi

  • Olympic Peninsula, Washington
View GitHub Profile
import React, { useContext, useEffect, useMemo, useState } from "react"
type ProviderComponent<T> = React.FC<{ initialValue: T }>
interface PrivateContextValue<T> {
useGlobalStateProxy(): T
}
class GlobalStateContext<T> {
constructor(private context: React.Context<PrivateContextValue<T>>, public Provider: ProviderComponent<T>) {}
}
/**
@damassi
damassi / get_schema.js
Created May 23, 2018 17:31 — forked from ssomnoremac/get_schema.js
get your graphql schema
var fetch = require('node-fetch');
var fs = require('fs');
const {
buildClientSchema,
introspectionQuery,
printSchema,
} = require('graphql/utilities');
console.log(introspectionQuery);
@damassi
damassi / launch.json
Created February 22, 2018 00:25
Debug random node script in VSCode
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Build",
@damassi
damassi / RelayStubProvider.jsx
Last active January 19, 2018 20:11
Stub Relay so that `react-relay` HOC components can accept raw data rather than using Relay network layer
import PropTypes from 'prop-types'
import { Component } from 'react'
import { Environment, Network, RecordSource, Store } from 'relay-runtime'
export class RelayStubProvider extends Component {
static propTypes = {
children: PropTypes.node.isRequired,
relay: PropTypes.object
}
@damassi
damassi / server.js
Last active April 26, 2022 07:20 — forked from tmcw/-
Universal Book ID Converter
const {send} = require('micro');
const bent = require('bent');
const wae = require('web-auto-extractor').default;
const https = require('https');
const pelo = require('pelo');
const url = require('url');
const cheerio = require('cheerio');
const {GOODREADS_KEY} = require('./settings');
const getJSON = bent('json', 200);
const getText = bent('string', 200);
@damassi
damassi / core.cljs
Created December 28, 2015 02:06 — forked from scttnlsn/core.cljs
Reagent/Secretary nested routing
(ns nested-routing.core
(:require [goog.events :as events]
[goog.history.EventType :as EventType]
[reagent.core :as reagent]
[reagent.ratom :refer-macros [reaction]]
[re-frame.core :refer [dispatch dispatch-sync register-handler register-sub subscribe]]
[secretary.core :as secretary :refer-macros [defroute]])
(:import goog.History))
(declare route-components

Keybase proof

I hereby claim:

  • I am damassi on github.
  • I am damassi (https://keybase.io/damassi) on keybase.
  • I have a public key whose fingerprint is 4A30 0A1E D483 2B06 B59E CEB7 DDA4 119C 746B 17B4

To claim this, I am signing this object: