Skip to content

Instantly share code, notes, and snippets.

View aslakhellesoy's full-sized avatar
🤠
typing...

Aslak Hellesøy aslakhellesoy

🤠
typing...
View GitHub Profile
@rauchg
rauchg / README.md
Last active May 16, 2026 01:17
require-from-twitter
@001101
001101 / accounting.sql
Created February 18, 2017 09:08 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@flavioespinoza
flavioespinoza / depth_chart.html
Last active February 27, 2026 18:31
D3 Market Depth Chart built from Order Book
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>d3 depth chart</title>
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
<style>
@kelleyvanevert
kelleyvanevert / example-query.sql
Last active March 11, 2024 18:11
TypeScript-typed generateQuery for creating single-SQL nested queries for a certain schema
select json_build_object('__table', 'user', 'firstName', e."first_name", 'lastName', e."last_name", 'managedResources', coalesce("t_managedResources"."data", '[]'), 'ratings', coalesce("t_ratings"."data", '[]')) as "data"
from "user" as "e"
left join (
select "manager_id" as "fkey", json_agg(json_build_object('__table', 'resource', 'ratingTotals', "t_ratingTotals"."data")) as "data"
from "resource" as "e"
left join (
select "resource_id" as "fkey", json_build_object('__table', 'rating_totals', 'avgSatisfaction', e."avg_satisfaction") as "data"
from "rating_totals" as "e"
) as "t_ratingTotals" on "t_ratingTotals"."fkey" = "e"."id"
group by "manager_id"
@bouroo
bouroo / sse-worker.js
Last active December 23, 2025 20:36
example for cloudflare worker server-sent events
/**
* Cloudflare Worker for Server-Sent Events (SSE)
*
* This worker demonstrates how to set up an SSE endpoint
* that sends an initial message and then periodic updates.
*/
// Listen for incoming requests
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));