Skip to content

Instantly share code, notes, and snippets.

View declann's full-sized avatar
👋

Declan Naughton declann

👋
View GitHub Profile
@declann
declann / spec.json
Created September 14, 2024 15:07
canvas gradient bug
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"background": "white",
"padding": 5,
"data": [
{"name": "grid_store"},
{"name": "cashflow_store"},
{"name": "source_0", "values": [{"point_id_in":1,"t_in":-1,"zero_duration_in":false,"mort_rate_factor_in":3,"model_id":0,"input_cursor_id":1,"formula":"pv_premiums","value":94.84,"t_in_step_end":0,"A_keep_gte_0":true,"partition":"A","duration_n":0,"value_n":91.11563150937634,"t_in_mean":4.5},{"point_id_in":1,"t_in":-1,"zero_duration_in":false,"mort_rate_factor_in":3,"model_id":0,"input_cursor_id":1,"formula":"pv_premiums","value":94.84,"t_in_step_end":0,"A_keep_gte_0":true,"partition":"B","duration_n":0,"value_n":91.07068315793605,"t_in_mean":4.5},{"point_id_in":1,"t_in":-1,"zero_duration_in":false,"mort_rate_factor_in":3,"model_id":0,"input_cursor_id":1,"formula":"pv_premiums","value":94.84,"t_in_step_end":0,"A_keep_gte_0":true,"partition":"keep","duration_n":0,"value_n":91.07068315793605,"t_in_mean":4.5},{"point_id_in":1,"t_in":-1,"
@declann
declann / spec.json
Created September 10, 2024 11:46
hatch gradient
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Google's stock price over time.",
"data": {"url": "data/stocks.csv"},
"transform": [{"filter": "datum.symbol==='GOOG'"}],
"layer": [
{"mark": {"type": "area", "fill": "orange"}},
{
"mark": {
"type": "area",
@declann
declann / spec.json
Created September 10, 2024 11:36
gradient texture
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Google's stock price over time.",
"data": {"url": "data/stocks.csv"},
"transform": [{"filter": "datum.symbol==='GOOG'"}],
"layer": [
{"mark": {"type": "area", "fill": "red"}},
{
"mark": {
"type": "area",
@declann
declann / spec.json
Created September 10, 2024 11:30
Vega-Lite spec from Tue Sep 10 2024
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Google's stock price over time.",
"data": {"url": "data/stocks.csv"},
"transform": [{"filter": "datum.symbol==='GOOG'"}],
"mark": {
"type": "area",
"line": {"color": "darkgreen"},
"fill": {
"x1": 0.1,
@declann
declann / spec.json
Created September 10, 2024 11:30
Vega-Lite spec from Tue Sep 10 2024
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Google's stock price over time.",
"data": {"url": "data/stocks.csv"},
"transform": [{"filter": "datum.symbol==='GOOG'"}],
"mark": {
"type": "area",
"line": {"color": "darkgreen"},
"fill": {
"x1": 0.1,
@declann
declann / spec.json
Created August 19, 2024 17:54
Vega-Lite spec from Mon Aug 19 2024
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": "Seattle Weather, 2012-2015",
"data": {
"url": "data/seattle-weather.csv"
},
"vconcat": [
{ "width": 600,
"height": 300,
"layer":[{
{
"$schema": "https://vega.github.io/schema/vega/v4.json",
"width": 500,
"height": 200,
"autosize": "none",
"signals": [
{
"name": "whichPoint",
"on": [
{
@declann
declann / spec.json
Created March 22, 2024 23:21
Vega spec from Fri Mar 22 2024
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 400,
"height": 400,
"signals": [
{
"name": "increase",
"on": [{"events": "rect:click", "force": true, "update": "datum"}]
}
],
@declann
declann / spec.json
Created March 11, 2024 00:13
Vega-Lite spec from Mon Mar 11 2024
{
"facet": {"column": {"field": "duration", "type": "nominal"}},
"spec": {
"encoding": {"x": {"field": "bin_i", "type": "ordinal"}},
"layer": [
{
"mark": {"type": "bar", "size": 2},
"encoding": {
"y": {"field": "min", "type": "quantitative"},
"y2": {"field": "max"}
// this is https://github.com/declann/calculang-miscellaneous-models/blob/main/models/pi/nilakantha-series_esm/cul_scope_0.mjs
// but with changes described
// so that it runs on numcalc.com (QuickJS)
// with arbirary \digits settings (e.g. \digits 100)
// Ensure in numeric (not algebraic mode)
// CHANGES:
// replaced res = 0 with res=0.0 and 4 by 4.0
//pi_approximation({terms_in:2000000})-PI