Skip to content

Instantly share code, notes, and snippets.

View wmaurer's full-sized avatar

Wayne Maurer wmaurer

View GitHub Profile
import type { ParseOptions } from "@effect/schema/AST"
import * as Parser from "@effect/schema/Parser"
import * as PR from "@effect/schema/ParseResult"
import * as S from "@effect/schema/Schema"
import { pipe } from "effect"
const TypeId: unique symbol = Symbol.for("@typed/decoder/decoder") as TypeId
export type TypeId = typeof TypeId
interface Decoder<I, O> {
@wmaurer
wmaurer / index.js
Created December 17, 2019 12:28
tree-shaking-test fp-ts build output
!(function(n) {
var t = {};
function r(e) {
if (t[e]) return t[e].exports;
var u = (t[e] = { i: e, l: !1, exports: {} });
return n[e].call(u.exports, u, u.exports, r), (u.l = !0), u.exports;
}
(r.m = n),
(r.c = t),
(r.d = function(n, t, e) {
@wmaurer
wmaurer / flatMap.ts
Created December 12, 2015 18:04
flatMap function on Array.prototype
interface Array<T> {
flatMap<TResult>(selector: (source: T) => Array<TResult>): Array<TResult>;
}
Array.prototype.flatMap = function<T, TResult>(selector: (source: T) => Array<TResult>) {
return (this as Array<T>).map(value => selector(value)).reduce((acc, value) => {
return acc.concat(value);
});
};
@wmaurer
wmaurer / _VSCode_Typescript.md
Last active September 30, 2015 05:46
Force Visual Studio Code to use a different (later) version of Typescript

Visual Studio Code and Typescript

Background: Visual Studio code releases are often slightly behind Typescript releases. For example, Typescript 1.6 (with JSX/TSX support) was released in 2015-09-11, but as of 2015-09-29, VSCode hadn't been updated to use Typescript 1.6.

You can, however, force VSCode to use the latest version of Typescript (tsc / tssserver). Let's assume you have Typescript installed globally via npm, i.e. you've run:

npm install -g typescript

Then it's mostly likely been installed in:

@wmaurer
wmaurer / _ReactiveUI_CodeSnippets_README.md
Last active July 27, 2016 15:47 — forked from rzhw/README.md
ReactiveUI read/wite property code snippet
  • Separate public/private literals
  • For RxUI 6
  • With private, because that's the way I like it
  • Single line get/set

Forked from rzhw/README.md

@wmaurer
wmaurer / 0_DateTimeOffsetExtensions.cs
Last active August 16, 2017 22:43
Convert to and from Unix time
namespace Extensions
{
using System;
public static class DateTimeOffsetExtensions
{
public static DateTimeOffset FromUnixTimeSeconds(this long seconds)
{
var dateTimeOffset = new DateTimeOffset(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
dateTimeOffset = dateTimeOffset.AddSeconds(seconds);
@wmaurer
wmaurer / 0_reuse_code.js
Created January 9, 2014 10:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console