Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Moissette kaosat-dev

View GitHub Profile
@kaosat-dev
kaosat-dev / Flecs_ecs_collisions_error
Created Dec 26, 2020
Compile / run errors for ecs_collisions (flecs)
View Flecs_ecs_collisions_error
ckaos@pop-os:~/dev/experiments/flecs$ bake run ecs_collisions
[ build] package cglm => '/home/ckaos/bake/src/cglm'
[ build] package flecs => '/home/ckaos/dev/experiments/flecs/flecs'
[ build] package flecs.meta => '/home/ckaos/bake/src/flecs-meta'
[ build] package flecs.util => '/home/ckaos/bake/src/flecs-util'
[ 50%] ringbuf.c
In file included from /home/ckaos/bake/src/flecs-util/include/flecs_util.h:5,
from /home/ckaos/bake/src/flecs-util/src/ringbuf.c:3:
/home/ckaos/bake/src/flecs-util/include/flecs-util/ringbuf.h:15:1: error: unknown type name ‘FLECS_UTIL_EXPORT’; did you mean ‘FLECS_UTIL_API’?
15 | FLECS_UTIL_EXPORT
@kaosat-dev
kaosat-dev / !QuickJs_SharedLib.md
Last active Dec 20, 2020
QuickJS: creating a shared c module and import it as a module in js
View !QuickJs_SharedLib.md

QuickJS: creating a shared c module and import it as a module in js

preparing the .c/.h files

  • the first few lines of your .c/.h files are very important !
    • #define countof(x) (sizeof(x) / sizeof((x)[0])) => this one should be copy & pasted, or inclued
    • the JS_INIT_MOULE is also critical as quickjs relies on that ! typos are critical (spent an hour on a typo ...)
@kaosat-dev
kaosat-dev / differenceVSnegate.js
Last active Oct 26, 2018
Laying out the differences (pun intended) between boolean difference & the proposed 'negate()/negative()' operation
View differenceVSnegate.js
// with difference only, assuming that the details of partWithCuts are known (otherwise it cannot work)
const partWithCuts = () => {
const block = cube()
const cutOut = cylinder()
const cutOut2 = cylinder()
// not useable, information about cut is lost
// return difference(block, cutOut, cutout2)
return {keep: [block], remove: [cutOut, cutOut2]}
}
View jscad-projection.js
const projection = function (params, ...csgs) {
const defaults = {
plane: [0, 0, 1, 1],// x, y, z, w : as an array, magically simple !!
cut: false
}
const {plane, cut} = Object.assign({}, defaults, params)
const [x, y, z, w] = plane
// for now we still have to convert arrays to something way more complicated internally , sigh
const orthobasis = new CSG.OrthoNormalBasis(new CSG.Plane(new CSG.Vector3D([x, y, z]), w))
@kaosat-dev
kaosat-dev / codepen.md
Created Dec 2, 2017 — forked from serapath/codepen.md
A synchronous `require` function for the browser that downloads and caches modules from npm - just copy & paste it to the dev tools javascript console
View codepen.md

use require in a codepen

  1. click on the little icon Open JS Settings on the JavaScript editor pane
  2. Then add the following link under Add External Javascript
https://cdn.rawgit.com/serapath/e2b55cab315e60fbbffea7b43acd8749/raw/a2709905ca06830f78d6069b97cda1f18eb9ef4c/require.js
  1. Press Save & Close and start using the require(...) in your JavaScript code on codepen
@kaosat-dev
kaosat-dev / .gitignore
Created Nov 10, 2017 — forked from claudiopro/.gitignore
require-from-dat
View .gitignore
/node_modules/
module.js
@kaosat-dev
kaosat-dev / notes.md
Last active Jul 11, 2017
CSG.js restructuring notes
View notes.md

CSG.js notes:

  • CAG : any boolean ops converts to CSG and back again !
    • sides are very inneficient data structures : there are duplicates of every points! (end of one side, start of next)
    • CAG’s could retain api by just providing accessors to underlying data structures
  • Vertex vs Vector :
    • potentially redundant ? needs more investigating
    • “only” has an extra ‘tag’ field nothing more
  • methods that can be easily extracted (barely any ‘this’ references, if at all, etc)
    • overCutInsideCorners
      • used in tests only => good candidate
@kaosat-dev
kaosat-dev / auto-deploy.md
Created May 5, 2017 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis
View auto-deploy.md

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.