Skip to content

Instantly share code, notes, and snippets.

@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"
@flavioespinoza
flavioespinoza / depth_chart.html
Last active April 21, 2023 14:00
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>
@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...
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
library(quantreg)
library(dplyr)
library(lubridate)
library(stringr)
library(readr)
library(ggplot2)
library(devtools)
library(splines)
@DmitrySoshnikov
DmitrySoshnikov / Recursive-descent-backtracking.js
Last active January 3, 2024 17:15
Recursive descent parser with simple backtracking
/**
* = Recursive descent parser =
*
* MIT Style License
* By Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
*
* In this short lecture we'll cover the basic (non-predictive, backtracking)
* recursive descent parsing algorithm.
*
* Recursive descent is an LL parser: scan from left to right, doing
@o11c
o11c / test-annotations.md
Last active October 6, 2023 12:11
Possible test annotations and results

Things that a test can be annotated with:

  • XFAIL(cond): for tests that are known to be buggy.
  • FLAKY(cond): for tests that have nondeterministic bugs that have not been hunted down.
  • SKIP(cond): for tests not applicable to the current platform, that cannot be fixed by installing or configuring dependencies.
  • MISSING(cond): for tests that can't run because of uninstalled or unconfigured dependencies.
  • WIP: for tests you are implementing
  • TIME(cpumin, cpumax, realmax): min/max computation expected for a test. Also real time added in case you sleep or something.
@delitescere
delitescere / README.md
Last active August 29, 2015 14:17
Zulu 8 on busybox (with OpenSSL). Leiningen on busybox (with bash).
@torgeir
torgeir / minimal-maven-pom.xml
Last active February 17, 2024 00:08
A minimal maven pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gd.wa</groupId>
<artifactId>minimal-pom</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
@pmeinhardt
pmeinhardt / session.rb
Last active April 15, 2017 18:18
sign users in/out in cucumber scenarios, without filling in a sign-in form each time (using warden, works with devise)
# features/support/session.rb
# Sign-in users directly, without going through the sign-in form each time.
#
# Including the Warden::Test::Helpers in the cucumber world, allows us
# to call login_as(user, opts = {}) and logout(*scopes) in cucumber steps.
#
# http://git.io/h1NRxQ
Before do |scenario|