Skip to content

Instantly share code, notes, and snippets.

View sblom's full-sized avatar

Scott Blomquist sblom

View GitHub Profile
@Avaq
Avaq / combinators.js
Last active May 8, 2025 16:30
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@nicebyte
nicebyte / dyn_arr.h
Last active February 25, 2025 10:29
dyn_arr
#pragma once
#define DYN_ARR_OF(type) struct { \
type *data; \
type *endptr; \
uint32_t capacity; \
}
#if !defined(__cplusplus)
#define decltype(x) void*

Iterables, AsyncIterables, Observables, Oh My!

I know there is a lot of confusion around Observables, Iterables, AsyncIterables and AsyncObservables. Let's try to break this down and the reasons for each.

Pull versus Push Collections

When it comes to collections, you have two ways of thinking about collections, push versus pull. With pull, the consumer is in control of when you get the items, but with push, you get the values when the producer is ready.

Pull Based Collections

@kunalspathak
kunalspathak / README.md
Last active June 21, 2023 14:49
Startup performance comparison of paint.net on x64 vs. arm64

Purpose

This report compares the startup performance of paint.net version 5.0.3 against dotnet version 8.0.0-preview.4.23259.5. The application was ran on Intel and Ampere machines. To make sure we are doing a comparable measurements, the application was started by affinitizing the number of cores. For x64, it was set to 0x5555 and for arm64, it was set to 0xFF. They both were ran using start /AFFINITY <mask> /WAIT dotnet.exe paintdotnet.dll. There are PaintDotnetTrace events that are logged. I used PerfView to profile the application and then studied the call stack between Started (first line of the Main() method) and Ready (all data-structures are initialized) events. The measurements are taken on Intel Cascade lake (x64) and Ampere (arm4) machine.

You will see lot of screenshots of callstack. In all of them, left side indicates x64 profile and right indicates arm64 profile.

Table of contents

  • [TL
@sblom
sblom / TotalHours.excel
Last active October 30, 2023 22:17
Native Excel array function to take a horizontal array of clock-in/clock-out times and return total hours
=LET(MakeAcc,LAMBDA(item1,item2,MAKEARRAY(2,1,LAMBDA(row,col,IF(row=1,item1,item2)))),
LAMBDA(arr,INDEX(REDUCE({0;-1},FILTER(arr,MAP(arr,LAMBDA(x,ISNUMBER(x))),{0}),LAMBDA(accum,time,
LET(total,INDEX(accum,1),start,INDEX(accum,2),
IF(start<>-1,
MakeAcc(total+(time-start)*24,-1),
MakeAcc(total,time)
)
))),1)))