Skip to content

Instantly share code, notes, and snippets.

View a-mckinley's full-sized avatar

Alastair McKinley a-mckinley

  • Analytics Engines
  • Belfast, United Kingdom
View GitHub Profile
@adunstan
adunstan / sql_json_comparison_ops.sql
Last active April 18, 2023 10:26
JSON comparison operations in SQL for PostgreSQL
CREATE OR REPLACE FUNCTION json_cmp(left json, right json)
RETURNS integer AS $$
select bttextcmp($1::text, $2::text)
$$ LANGUAGE sql IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION json_eq(json, json)
RETURNS BOOLEAN LANGUAGE SQL STRICT IMMUTABLE AS $$
SELECT json_cmp($1, $2) = 0;
$$;
@avi-perl
avi-perl / df_to_table.py
Last active December 15, 2022 21:27
Convert a pandas.DataFrame object into a rich.Table object for stylized printing in Python.
from datetime import datetime
from typing import Optional
import pandas as pd
from rich import box
from rich.console import Console
from rich.table import Table
console = Console()
import "./index.css";
import React from "react";
import ReactDOM from "react-dom";
import {
DataBrowserRouter,
Route,
useLoaderData,
Form,
useNavigation,
} from "react-router-dom";