Skip to content

Instantly share code, notes, and snippets.

@belsrc
belsrc / lc-and-encodings.md
Last active January 6, 2024 16:58
Lambda Calculus & Church Encodings

λ-Calculus, Church Encodings and Combinators [🌱]

Caution

NEED A INTRO TO LAMBDA CALC.

Calculus

First, lets define "calculus"

@belsrc
belsrc / gist-toc.md
Last active December 28, 2023 19:35
Gist TOC
Code Notes

@belsrc
belsrc / rust-wasm.md
Last active October 10, 2023 14:47
WIP Rust/WASM learn
@belsrc
belsrc / bit-array.md
Last active January 6, 2024 16:54
Bit Arrays Explanation

Bit Arrays Explanation in JS [🌳]

ArrayBuffer

Fixed length array of bytes, called a "byte array" in other languages. ArrayBuffers have no type assigned to them. They are simply chunks of memory (in bytes). They also cannot be altered directly. A View or TypedArray needs to be created first.

const buffer = new ArrayBuffer(3);
@belsrc
belsrc / bitwise.md
Last active January 6, 2024 16:54
Bitwise Explanation

Bitwise Explanation [🌳]

bitwise AND (&)

For each bit, if both are 1, the resulting bit is 1. If either or both are 0, the resulting bit is 0.

Given the following two values:

@belsrc
belsrc / _writeup.md
Last active January 6, 2024 16:56
Set of Typescript

You got Set Theory in my Typescript [🌱]

Element

${\in}$ equals an element of.

$3~{\in}~A$

$3$ is an element of set $A$

@belsrc
belsrc / extended-fetch.ts
Last active March 29, 2022 13:23
Extended Fetch function
type fetchOptions = {
timeout?: number,
retries?: number,
cancelable?: boolean,
method?: string,
mode?: RequestMode,
cache?: RequestCache,
credentials?: RequestCredentials,
headers?: HeadersInit,
redirect?: RequestRedirect,
@belsrc
belsrc / testing.md
Last active August 4, 2023 16:08
Javascript Testing Best Practices Readme in Relation to Components

Setup

I'm not going to go too far into the setup as it is not much different from any other normal Jest setup. And they have plenty of documentation covering it already. In the component test files themselves, you will need to make sure you import vue-test-utils and its probably a good idea to set some clean up in the beforeEach handler.

import { shallowMount } from '@vue/test-utils';
import Component from './index.jsx';

describe('Component', () => {
  beforeEach(() => {
 jest.resetModules();
@belsrc
belsrc / fp-intro.md
Last active January 12, 2024 14:59
Brief intro to functional programming in JS

Brief intro to functional programming in JS [🌳]

Functional programming (often abbreviated FP) is the process of building software by composing pure functions, avoiding shared state, mutable data, and side-effects. Functional programming is declarative rather than imperative, and application state flows through pure functions. Contrast with object oriented programming, where application state is usually shared and colocated with methods in objects.

Functional code tends to be more concise, more predictable, and easier to test than imperative or object oriented code — but if you're unfamiliar with it and the common patterns associated with it, functional code can also seem a lot more dense, and the related literature can be impenetrable to newcomers.

If you start googling functional programming terms, you're going to quickly hit a brick wall of academic lingo that can be very intimidating for beginners.

**Don't let all the

const isString = value => typeof value === 'string' || value instanceof String;
/*
camelCase('camel case'); // camelCase
camelCase('camel_case'); // camelCase
camelCase('camel-case'); // camelCase
*/
const camelCase = str => {
if(!isString(str)) {
return '';