Skip to content

Instantly share code, notes, and snippets.

Avatar
Time ain't on my side

Chase TotallyNotChase

Time ain't on my side
  • Hell
View GitHub Profile
@TotallyNotChase
TotallyNotChase / Woes.lhs
Last active October 1, 2022 11:07
Servant woes
View Woes.lhs
Servant woes for future me to figure out
========================================
```sh
stack ghci Woes.lhs \
--package servant \
--package servant-client-core \
--package servant-client \
--package text
```
@TotallyNotChase
TotallyNotChase / GCLI.hs
Last active April 2, 2022 07:53
Basic CLI generics-sop
View GCLI.hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
View type.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
import Prelude (Bool (True, False))
import Data.Kind (Type)
@TotallyNotChase
TotallyNotChase / example.ts
Last active March 27, 2022 13:37
Scoped, yet too unscoped - extensible records API in typescript, through expressive abstraction
View example.ts
import { stretch, stretchP } from './implementation';
interface IApplication {
wow: boolean;
great: string;
}
function stretchExample0(cond: boolean): IApplication {
// Reach for an `IApplication`, but start with `{}`.
const app = stretch<IApplication>()
@TotallyNotChase
TotallyNotChase / functors.c
Last active May 17, 2021 09:14
The Typeclass Design Pattern 2: Electric Functoraloo
View functors.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Functor(T, A, B) Functor##T##A##B
#define Functorable(T, A, B) Functorable##T##A##B
#define DefineFunctorOf(ReturnT, A, B) \
typedef struct \
{ \
View itrbench.c
#include "iterator.h"
#include "maybe.h"
#include "typeclass.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <time.h>
#include <unistd.h>
@TotallyNotChase
TotallyNotChase / yes.c
Created September 9, 2020 15:07
wow funne weezer macro in c
View yes.c
#include <stdio.h>
#define sleeping int
#define with main
#define mother (void)
#define theresa {
#define drifting char*
#define a =
#define brahmin ;
#define you puts
@TotallyNotChase
TotallyNotChase / host.json
Last active October 24, 2022 02:01
Native Messaging - Rust
View host.json
{
"name": "pingpong",
"description": "Native messaging host example",
"path": "path/to/release_executable",
"type": "stdio",
"allowed_origins": [
"chrome-extension://extension_id/"
]
}
@TotallyNotChase
TotallyNotChase / host.json
Last active October 24, 2022 02:01
Native Messaging - C
View host.json
{
"name": "pingpong",
"description": "Native messaging host example",
"path": "path/to/release_executable",
"type": "stdio",
"allowed_origins": [
"chrome-extension://extension_id/"
]
}
@TotallyNotChase
TotallyNotChase / strfuncs.c
Last active April 26, 2020 16:29
Some string functions to review
View strfuncs.c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "strfuncs.h"
#include "strfuncsdef.h"
// Append given char to given string
// Returns NULL on failure
static char* str_append(char element, char* str, size_t end_index, size_t* size)
{