Skip to content

Instantly share code, notes, and snippets.

View iamcerebrocerberus's full-sized avatar
🎯
I'm just an algorithm with a heart 🚶‍♂️

Cerebro Cerberus iamcerebrocerberus

🎯
I'm just an algorithm with a heart 🚶‍♂️
View GitHub Profile
HTTP Verb Action Example
GET Read GET /posts/1
POST Create POST /posts
PUT Replace PUT /posts/1
PATCH Partially update PATCH /posts/1
DELETE Remove DELETE /posts/1
@iamcerebrocerberus
iamcerebrocerberus / #calculator.ts
Created June 26, 2025 00:42 — forked from tkrotoff/#calculator.ts
Calculator function using shunting yard algorithm and reverse Polish notation (RPN)
// https://gist.github.com/tkrotoff/b0b1d39da340f5fc6c5e2a79a8b6cec0
// WTF!
// parseFloat('-0') => -0 vs parseFloat(-0) => 0
// -0 === 0 => true vs Object.is(-0, 0) => false
const minus0Hack = (value: number) => (Object.is(value, -0) ? '-0' : value);
export const operators: {
[operator: string]:
| {