Skip to content

Instantly share code, notes, and snippets.

@stemcstudio
Last active November 26, 2020 00:27
Show Gist options
  • Save stemcstudio/ef8133568e0645965710d83a26725793 to your computer and use it in GitHub Desktop.
Save stemcstudio/ef8133568e0645965710d83a26725793 to your computer and use it in GitHub Desktop.
Jessie Code Parsing

Jessie Code

Overview

This program demonstrates using JessieCode in STEMCstudio.

Highlighting is provided by using a C++ syntax highlighter. There is no validation of the JessieCode.

How it Works

STEMCstudio takes the contents of any file ending with .jessie and creates an HTMLScriptElement in the HTML body with the type text/jessiecode (it does something similar for CSV, GLSL, and Scheme files). This dovetails with the behavior of JSXGraph which is to auto-detect such scripts and process them, creating a div and rendering the JessiCode to a Board that is attached to the div.

Reference

JessieCode Reference on SketchBin

Credits

JSXGraph was developed by the Center for Mobile Learning with Digital Technology – Universität Bayreuth, Germany.

$$e^{i\pi}+1=0$$

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JSXGraph template</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<base href='/'>
<link rel='stylesheet' href="style.css" />
</head>
<body>
</body>
</html>
DomReady.ready(function() {
}).catch(e => console.warn(e))
$board.setView([-1.5, 2, 1.5, -1]);
// Triangle ABC
A = point(1, 0);
B = point(-1, 0);
C = point(0.2, 1.5);
pol = polygon(A,B,C) <<
fillColor: '#FFFF00',
borders: <<
strokeWidth: 2,
strokeColor: '#009256'
>>
>>;
// Perpendiculars and orthocenter i1
pABC = perpendicular(pol.borders[0], C);
pBCA = perpendicular(pol.borders[1], A);
pCAB = perpendicular(pol.borders[2], B);
i1 = intersection(pABC, pCAB, 0);
// Midpoints of segments
mAB = midpoint(A, B);
mBC = midpoint(B, C);
mCA = midpoint(C, A);
// Line bisectors and centroid i2
ma = segment(mBC, A);
mb = segment(mCA, B);
mc = segment(mAB, C);
i2 = intersection(ma, mc, 0);
// Circum circle and circum center
c = circumcircle(A, B, C) <<
strokeColor: '#000000',
dash: 3,
strokeWidth: 1,
center: <<
name: 'i_3',
withlabel:true,
visible: true
>>
>>;
// Euler line
euler = line(i1, i2) <<
dash:1,
strokeWidth: 2,
strokeColor:'#901B77'
>>;
{
"description": "Jessie Code Parsing",
"dependencies": {
"DomReady": "^1.0.0",
"jquery": "^2.1.4",
"jsxgraph": "^1.1.0"
},
"name": "jessie-code-parsing",
"version": "1.0.0",
"linting": true,
"author": "David Geo Holmes",
"hideConfigFiles": true,
"keywords": [
"JSXGraph",
"STEMCstudio"
]
}
body {
background: #cccccc;
}
pre code.hljs {
display: block;
}
code.hljs {
display: inline;
}
{
"allowJs": true,
"checkJs": true,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"jsx": "react",
"module": "system",
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"removeComments": true,
"skipLibCheck": true,
"sourceMap": false,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es5",
"traceResolution": true
}
{
"rules": {
"array-type": [
true,
"array"
],
"curly": false,
"comment-format": [
true,
"check-space"
],
"eofline": true,
"forin": true,
"jsdoc-format": true,
"new-parens": true,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": true,
"no-construct": true,
"no-for-in-array": true,
"no-inferrable-types": [
true
],
"no-magic-numbers": false,
"no-shadowed-variable": true,
"no-string-throw": true,
"no-trailing-whitespace": [
false,
"ignore-jsdoc"
],
"no-var-keyword": true,
"one-variable-per-declaration": [
true,
"ignore-for-loop"
],
"prefer-const": true,
"prefer-for-of": true,
"prefer-function-over-method": false,
"prefer-method-signature": true,
"radix": true,
"semicolon": [
true,
"never"
],
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"triple-equals": true,
"use-isnan": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment