Skip to content

Instantly share code, notes, and snippets.


Patrick Roza patroza

View GitHub Profile
View do.test.ts
import * as O from 'fp-ts/Option'
import * as IO from 'fp-ts/IO'
import * as T from 'fp-ts/Task'
import * as A from 'fp-ts/Array'
import { HKT, Kind, URIS } from 'fp-ts/HKT'
import { Monad, Monad1 } from 'fp-ts/Monad'
import { pipe } from 'fp-ts/function'
const _: any = function* (x: any): any {
return yield x
FradSer /
Last active March 22, 2023 21:09
Switch iTerm2 color preset automatic base on macOS dark mode.

The latest beta (3.5) includes separate color settings for light & dark mode. Toggling dark mode automatically switches colors.

Vist iTerm2 homepage or use brew install iterm2-beta to download the beta. Thanks @stefanwascoding.

  1. Add to ~/Library/ApplicationSupport/iTerm2/Scripts/AutoLaunch with:
View do-notation.ts
import { right, either, left } from 'fp-ts/lib/Either'
import { HKTAs, HKT2As, HKT2, HKTS, HKT, HKT2S } from 'fp-ts/lib/HKT'
import { Monad } from 'fp-ts/lib/Monad'
import { option, some } from 'fp-ts/lib/Option'
function Do<M extends HKT2S>(m: Monad<M>): <L, A>(generator: () => Iterator<HKT2<M, L, A>>) => HKT2As<M, L, A>
function Do<M extends HKTS>(m: Monad<M>): <A>(generator: () => Iterator<HKT<M, A>>) => HKTAs<M, A>
function Do<M extends HKTS>(m: Monad<M>): <A>(generator: () => Iterator<HKT<M, A>>) => HKT<M, A> {
return <A>(generator: () => Iterator<HKT<M, A>>): HKT<M, A> => {
const iterator = generator()
yxy /
Last active September 16, 2021 17:03
Railway Oriented Programming in python. inspired by
class Success(object):
def __init__(self, value):
self.value = value
class Error(object):
def __init__(self, value):
self.value = value
class wrapper(object):
def __init__(self, result):
enricosada / fsharp and .net core sdk
Last active March 29, 2020 13:13
.NET Core sdk, msbuild, fsharp, fsc, etc
View fsharp and .net core sdk

.NET Core sdk, msbuild, fsharp, fsc, etc

How to finish/polish the integration between msbuild based .net core sdk and f# (fsc, FscTask, etc)

This doc contains current issues i known and a proposed solution (already implemented in a PR, and works) on how to fix these (obv ihmo).

AFAIK all the solution i choose are based on where dotnet/sdk, microsoft/msbuild and dotnet/cli are going with development, and updated to latest release (preview4), and vnext in development now.


View CompressionMiddleware.cs
using System;
using System.IO;
using System.IO.Compression;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace Middlewares
/// <summary>
/// Experimental compression middleware for self-hosted web app
OlegIlyenko / Event-stream based GraphQL
Last active March 27, 2023 14:32
Event-stream based GraphQL subscriptions for real-time updates
View Event-stream based GraphQL

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.

ejdyksen /
Last active March 28, 2023 02:55
A script to fix EDID problems on external monitors in macOS


A script to fix EDID problems on external monitors in macOS.


  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):