The initial spark for Virtual Sales Lab was conceived during a late-night dinner with one of my business mentors.
The exquisit but now defunct restaurant Margaretha's in Oudenaarde/Belgium was where it all happened
[ | |
{ | |
"op": "add", | |
"path": "/builders/textures/-", | |
"value": { | |
"id": "lshape", | |
"name":"lshape", | |
"imageUrl": "https://picsum.photos/512", | |
"repeat":{"x":1,"y":1}, | |
"rotation": 3.14159 |
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])), |
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); } |
const TokenExpressions = { | |
comment: /^((\/\/[^\n]+)|(\/\*[^(\*\/)]+)\*\/)/, | |
strings: /^("(\\"|[^"])*")/, | |
multiline_strings: /^(`[^\`]+`)/, | |
whitespace: /^([\s\n\r]+)/, | |
brace: /^[\(\)]/, | |
curlyBrace: /^[\{\}]/, | |
array: /^[\[\]]/, | |
comma: /^\,/, | |
operator: /^(\+|-|\*|\/|=|>|<|>=|<=|&|\||%|!|\^|)/, |
// 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. | |
// |
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 initial spark for Virtual Sales Lab was conceived during a late-night dinner with one of my business mentors.
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> |