Skip to content

Instantly share code, notes, and snippets.

Fence Configurator - Pricing & Quote Rules

Overview

This document describes the business rules that generate quotes and pricing for the fence configurator system. The system calculates prices based on fence specifications, materials, beams, gates, and accessories.

Table of Contents

  1. Fence Types & Heights
  2. Beam Specifications
  3. Pricing Components
  4. Gate Pricing
@ToJans
ToJans / overrule-material.json
Last active January 26, 2024 16:09
testing if my json-patch-url works
[
{
"op": "add",
"path": "/builders/textures/-",
"value": {
"id": "lshape",
"name":"lshape",
"imageUrl": "https://picsum.photos/512",
"repeat":{"x":1,"y":1},
"rotation": 3.14159
@ToJans
ToJans / ganja.js
Last active March 20, 2022 12:25
Ganja.js extrude cheat sheet
window.d = 2;
Algebra(d,0,1,()=>{
var point = (x,y)=>!(1e0 + x*1e1 + y*1e2),
// return functions instead of values, so they update when you drag the points
linesFromPoints = ps => ps.map((p,i,a) => ()=>p & (a[(i+1)%a.length]||a[0])),
pointsFromLines = e => e.map((ev,i,a) => ()=> ev * (a[(i+1)%a.length]||a[0])),
@ToJans
ToJans / CVector.js
Created February 17, 2022 21:08
Here's a super compact vector class that supports multiple dimensions
class CVector {
constructor(components = []) { this.components = components; }
get lengthSquared() { return this.components.reduce((p, c) => p + c * c); }
get length() { return Math.sqrt(this.lengthSquared); }
get normalized() { return new CVector(this.components.map(x => x / this.length)); }
get sum() { return Math.sum(this.components); }
add(other, missingComponentValue = 0) { return this._zip(other, (a, b) => a + b, missingComponentValue); }
sub(other, missingComponentValue = 0) { return this._zip(other, (a, b) => a - b, missingComponentValue); }
mul(other, missingComponentValue = 1) { return this._zip(other, (a, b) => a * b, missingComponentValue); }
div(other, missingComponentValue = 1) { return this._zip(other, (a, b) => a / b, missingComponentValue); }
@ToJans
ToJans / javascript-ast.ts
Last active February 17, 2022 16:24
Minimalistic example to parse javascript.
const TokenExpressions = {
comment: /^((\/\/[^\n]+)|(\/\*[^(\*\/)]+)\*\/)/,
strings: /^("(\\"|[^"])*")/,
multiline_strings: /^(`[^\`]+`)/,
whitespace: /^([\s\n\r]+)/,
brace: /^[\(\)]/,
curlyBrace: /^[\{\}]/,
array: /^[\[\]]/,
comma: /^\,/,
operator: /^(\+|-|\*|\/|=|>|<|>=|<=|&|\||%|!|\^|)/,
@ToJans
ToJans / directus_extensions_endpoints_filestorage_index.js
Last active January 30, 2025 07:08
Quick hack: Redirect to asset by URL - Endpoint extension for directus.io
// Quick hack: Redirect to asset by URL - Endpoint extension for directus.io
// =========================================================================
//
// 2021 - ToJans - Public Domain
//
// *** Don't hold me liable if it breaks anything! Quick hack, might expose all your data!
//
// You can use this endpoint extension to access assets via the folder and file structure
// you used in the file module, so you don't need to reference assets by guid anymore.
//
@ToJans
ToJans / whut.txt
Created May 6, 2021 08:52
Muahaha
Hello world!
using System;
using System.Collections.Generic;
using System.Linq;
/**
Chess: potential moves etc by @ToJans
Spiked in a couple of hours of late-night code for a tweet by @gregyoung
https://twitter.com/gregyoung/status/1385285718113722374

The story behind Virtual Sales Lab

The initial seed of the idea

The initial spark for Virtual Sales Lab was conceived during a late-night dinner with one of my business mentors.

Margareta's The exquisit but now defunct restaurant Margaretha's in Oudenaarde/Belgium was where it all happened

class MyConverter : Newtonsoft.Json.Converters.CustomCreationConverter<IDictionary<string, object>>
{
public override IDictionary<string, object> Create(Type objectType)
{
return new Dictionary<string, object>();
}
public override bool CanConvert(Type objectType)
{
// in addition to handling IDictionary<string, object>