Skip to content

Instantly share code, notes, and snippets.

View wclr's full-sized avatar
🔥
Fighting the SUN

Alex wclr

🔥
Fighting the SUN
  • Need a light, hah?
  • Upper Worlds
View GitHub Profile
@wclr
wclr / generic-deriving.purs
Created April 19, 2021 15:54 — forked from dlants/generic-deriving.purs
Generic deriving with purescript
-- an example of how to derive a show instance for a Maybe type
-- not totally sure why `derive instance showMyMaybe :: (Show a) => Show (MyMaybe a)` errors with...
-- error: CannotDerive :
-- Cannot derive a type class instance for Data.Show.Show (MyMaybe a) since instances of this type class are not derivable.
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
@wclr
wclr / tuple.md
Created December 7, 2017 18:34 — forked from jcalz/tuple.md
TypeScript tuple inference

You can use the tuple() function in tuple.ts to infer tuple types in TypeScript and cut down on the need to repeat yourself. Without tuple(), declaring a constant of a tuple type looks like this:

const daysOfTheWeek: ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] = 
  ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];

You can't do this:

const daysOfTheWeek = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; 
@wclr
wclr / tuple.md
Created December 7, 2017 18:34 — forked from jcalz/tuple.md
TypeScript tuple inference

You can use the tuple() function in tuple.ts to infer tuple types in TypeScript and cut down on the need to repeat yourself. Without tuple(), declaring a constant of a tuple type looks like this:

const daysOfTheWeek: ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] = 
  ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];

You can't do this:

const daysOfTheWeek = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; 
@wclr
wclr / Event-stream based GraphQL subscriptions.md
Created April 5, 2016 11:44 — forked from OlegIlyenko/Event-stream based GraphQL subscriptions.md
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@wclr
wclr / main.js
Created March 5, 2016 21:31 — forked from staltz/main.js
Cycle.js demo with MIDI and Web Audio
import {Observable, Disposable} from 'rx';
import {run} from '@cycle/core'
const jsondiffpatch = require('jsondiffpatch').create({
objectHash: function(obj) {
return obj.name;
}
});
function generateCurve(steps){
var curve = new Float32Array(steps)
@wclr
wclr / react-driver.js
Created February 25, 2016 12:23 — forked from justinwoo/react-driver.js
A React driver for Cycle.js that handles injection via context. Warning: you should probably not actually use this and prefer making your own driver with props instead.
/* @flow */
import Rx from 'rx';
import React from 'react';
import ReactDOM from 'react-dom';
export function makeReactDriver<T>(
containerId: string,
childContextTypes: any,
getChildContext: () => {[key: string]: () => void},