Skip to content

Instantly share code, notes, and snippets.

Avatar

Robin rluiten

  • Brisbane/Australia
View GitHub Profile
@rluiten
rluiten / EqualTypes.ts
Last active Oct 2, 2020
Example of filterOptions, EqualTypes.
View EqualTypes.ts
// prettier-ignore
// Compare types for equivalence
// Reference: https://github.com/Microsoft/TypeScript/issues/27024
//
// Better fix coming in Typescript 4 ? my read isn't clear on this
// Reference: https://github.com/microsoft/TypeScript/issues/37314#issuecomment-598459316
export type EqualTypes<X extends unknown, Y extends unknown> =
(<T>() => T extends X ? 1 : 2) extends
(<T>() => T extends Y ? 1 : 2) ? true : false;
@rluiten
rluiten / reformed.tsx
Last active Jan 19, 2018
Implementation of react-reformed type safe high order component in typescript, this is formatted with prettier with single quotes option. It may not be perfect but I have already found it useful. Suggestions for improvements are welcomed.
View reformed.tsx
// This is a typescript version of react-formed.
// Reference: https://github.com/davezuko/react-reformed
//
// Good reference on creating high order components in Typescript.
// Reference: https://dev.to/danhomola/react-higher-order-components-in-typescript-made-simple
import * as React from 'react';
import * as assign from 'object-assign';
// State of the HOC you need to compute the InjectedProps
interface State<TModel> {
@rluiten
rluiten / redux-form.d.ts
Last active Aug 5, 2016
Basic typescript definition for redux-form v6. This is new and I am new to creating type definitions and I am only just getting into redux-form so it may well have errors, and be less strict than it can be. Updated 2016-07-08 again.
View redux-form.d.ts
/**
* Type definitions for Redux-form v6.
* Updated for 6.0.0-rc.3 including splitting of Field properties to 'input'.
*/
import {Component, ComponentClass, StatelessComponent, ReactElement, ReactEventHandler, SyntheticEvent} from 'react';
import {Dispatch, Reducer, Action} from 'redux';
declare namespace ReduxForm {
export type FieldValue = any;
View Crash.elm
<!DOCTYPE HTML>
<html><head><meta charset="UTF-8"><title>Main</title><style>html, head, body { padding:0; margin:0; }
body { font-family: calibri, helvetica, arial, sans-serif; }
a:link { text-decoration: none; color: rgb(15,102,230); }
a:visited { text-decoration: none; }
a:active { text-decoration: none; }
a:hover { text-decoration: underline; color: rgb(234,21,122); }
html,body { height: 100%; margin: 0px; }
</style></head><body><script>var Elm = Elm || { Native: {} };
Elm.Native.Basics = {};