Skip to content

Instantly share code, notes, and snippets.

View sorenhoyer's full-sized avatar

Søren Høyer sorenhoyer

  • Grundfos
  • Langå, Denmark
View GitHub Profile
@alloy
alloy / LiveQueryPolyfill.ts
Last active February 24, 2021 15:09
Rewrite GraphQL Live Query to subscription.
/**
* This is a Live Query polyfill, as graphql-js does not strictly have support for that. Instead, we leave it up to the
* client to recognize a Live Query is requested with the `@live` directive on a `query` operation and here we
* transform it into a `live` subscription instead.
*
* Consider a schema like the following:
*
* ```graphql
type Badge {
id: ID!
'use strict'
var sqlite = require('sqlite3').verbose();
var db = new sqlite.Database('test_db');
db.getAsync = function (sql) {
var that = this;
return new Promise(function (resolve, reject) {
that.get(sql, function (err, row) {
if (err)
@markerikson
markerikson / appEntryPoint.js
Last active August 1, 2022 07:41
Webpack React/Redux Hot Module Reloading (HMR) example
import React from "react";
import ReactDOM from "react-dom";
import configureStore from "./store/configureStore";
const store = configureStore();
const rootEl = document.getElementById("root");
@mbostock
mbostock / .block
Last active February 21, 2019 21:43
Canvas Line
license: gpl-3.0
@staltz
staltz / introrx.md
Last active May 18, 2024 05:17
The introduction to Reactive Programming you've been missing
@afternoon
afternoon / rename_js_files.sh
Created February 15, 2014 18:04
Rename .js files to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
@hisui
hisui / stream.ts
Last active August 21, 2020 21:20
Functional Reactive Programming (FRP) in TypeScript.
// stream.ts - A TypeScript module for FRP.
// - https://gist.github.com/hisui/6261547
// - tsc stream.ts -t es5 --sourcemap --noImplicitAny
module sf {
export class Packet<T> {
constructor(private _flags:number, private _value:any=void 0) {}
static next<A>(e:A):Packet<A> {