Skip to content

Commit d80a1ea

Browse files
committed
RELEASE 0.3.0
2 parents 3d755a2 + 474a7b8 commit d80a1ea

30 files changed

+7946
-2911
lines changed

CHANGELOG.md

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,100 @@
1-
## [0.2.0] - 2020-12-03
1+
## [0.3.0] - 2020-12-21
2+
### Breaking Changes
3+
- Spaces are not allowed in hex numbers anymore but undorscores are.
4+
It caused problems since 0xAA B could not be unambiguously parsed (e.g. it can be 0xAAB or 0xAA B, where 'B' is a unit for 'bytes', so make it explicit by writing 0xAA_B).
5+
### Features
6+
- Dark Theme ![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/1e4fbe68e3e3e0f2b369b29d853881df/D10nAPmBHz.gif)
7+
- Render command optimizations, reducing render command count by around 40%
8+
(gutters, line number- and result backround
9+
are now rendered only once as a big rectangle and not line by line).
10+
- Active references (variables and line refs in the cursor's row) are now just underlined
11+
and the referenced lines are not highlighted fully only their left and right gutter.
12+
(Look at the image below)
13+
- Results where a denominator is a unit (e.g. 5 / year) are now rendered in a more user-friendly way (e.g. instead of `5 year^-1` it is `5 / year`)
14+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/b22cf68c1bb85d890bf1363e55e94435/0.0.3_unit_denom.png)
15+
- Automatic closing parenthesis/braces insertion when the opening one is typed
16+
- Automatic closing parenthesis/braces deletion when the opening one is deleted
17+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/a2b3699e56eb91dd74909091aa903098/0.0.3_parens.gif)
18+
- Automatic parenthesis/braces wrapping around selected text if opening one is typed while
19+
a text is selected
20+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/a4f947f869a4d4537043cc962551da8f/0.0.3_wrap.gif)
21+
- Matching parenthesis are highlighted if the cursor is inside them
22+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/9efb7959ddc5fde61f395f79f2027d9c/0.0.3_paren_hilight.gif)
23+
- The note can be saved with ``ctrl-s`` (Though it is still saved automatically when there is no user interaction)
24+
- It is possible to apply units directly on Line References or Variables, e.g.
25+
```
26+
var = 12
27+
var km
28+
```
29+
The result of the second line will be ``12 km``
30+
- Parsing improvement: Now the parser are smarter in deciding what is an operator (e.g. 'in' in `12 m in cm`),
31+
a unit (`12 in` which is 12 inch), or a simple string (`I downloaded 12 GB in 3 seconds`).
32+
Now it is even possible to evaluate this string `12 in in in`, which is equivalent of `12 inch in inch`
33+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/1f851d6b80e265dec9b6d055e2ae90b0/0.0.3_smar_parsing.png)
34+
- Percentage calculations
35+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/7941d87348496a4c9d3841a18a03431f/0.0.3_percentages.png)
36+
- Max row count was increased from 128 to 256
37+
- e (Euler's Number) was added, currently as a function (`e()`)
38+
- Invalid argument types for functions are highlighted as errors (See image below)
39+
- new functions:
40+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/e36e81db4efafb92695d8eb7f833a526/0.0.3_functions.png)
41+
- abs(num)
42+
- ln(num)
43+
- lg(num)
44+
- log(num, num)
45+
- sin(angle) -> num
46+
- cos(angle) -> num
47+
- tan(angle) -> num
48+
- asin(num) -> angle
49+
- acos(num) -> angle
50+
- atan(num) -> angle
251

52+
### Changed
53+
- When opening a not empty note, the result panel now tries
54+
to be as close to the editor as possible to have a better
55+
overview about calculations and their results.
56+
- GitHub and website links were added to the NoteCalc page
57+
- Strings at the frontend are now rendered char by char. It is necessary
58+
to be able to place the cursor at the right place, since the text rendering
59+
does not guarantee that a single char takes exactly 'char-width' pixels.
60+
- Overlay canvas (the canvas above the app canvas) was removed. It was used to draw
61+
overlay effects (e.g. pulsing), but it was problematic since it needed alpha blending,
62+
which wasn't always nice and console frontend support is limited.
63+
Now pulses are rendered above "BelowText" layer and below the "Text" layer.
64+
- underscore is allowed in binary numbers (e.g. ``0b11_00``)
65+
- Parenthesis have different color than operators.
66+
- Remove `Vec` and dynamic allocation from unit parsing and operations.
67+
- Replaced all unit `RefCells` to `Rc`, it was a mistake to use `RefCells` in the first place.
68+
- Matrices cannot be deleted anymore by `DEL` or `BACKSPACE`, ctrl is needed
69+
70+
### Fixed
71+
- Dead characters (e.g. '^' on a hungarian keyboard) were not possible to type
72+
- Longest visible result length was calculated wrongly when there were multiple headers
73+
in a note, which affected the result panel size.
74+
- `sum` variable get emptied at #Headers
75+
- Char width at the fonrend is now integer, ceiling upward. It caused issues
76+
with rendering (widths of recatngles were float as well and did not always fill up
77+
the required space)
78+
- Underlines and line reference background rectangles were rendered even if they
79+
were outside of the editor area
80+
- `ctrl-x` did not copy the selected text
81+
- Units in the denominator behaved buggy. now expressions like this works well
82+
```
83+
tax A = 50 000/month
84+
tax B = 50 000/year
85+
(tax A + tax B) * (1 year)
86+
```
87+
- u64 values can be parsed correctly (e.g. 0xFFFFFFFFFFFFFFFF)
88+
- Bitwise operations now work on u64 values
89+
- Negative numbers can be presented in binary and hex form
90+
- Line reference pulsing was called each time a cursor was pressed on the line ref's line, causing
91+
flickering
92+
- 'Line normalization' (the process where the referenced lines' id is normalized to the referenced line actual line number)
93+
could be undo with ctrl-z
94+
- Bitwise shifting operators (`<<` and `>>`) used wrapping, resulted in unwanted situations. Now it is an error
95+
to use larger shift operands than the underlying integer representation (u64 currently)
96+
97+
## [0.2.0] - 2020-12-03
398
### Breaking Changes
499
`--` does not set the `sum` variable to zero, but every header does
5100
### Features

assets/frontend_web.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ __exports.handle_resize = function(app_ptr, new_client_width) {
7171
wasm.handle_resize(app_ptr, new_client_width);
7272
};
7373

74+
/**
75+
* @param {number} app_ptr
76+
* @param {number} theme_index
77+
*/
78+
__exports.set_theme = function(app_ptr, theme_index) {
79+
wasm.set_theme(app_ptr, theme_index);
80+
};
81+
7482
let cachegetInt32Memory0 = null;
7583
function getInt32Memory0() {
7684
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
@@ -272,13 +280,6 @@ __exports.reparse_everything = function(app_ptr) {
272280
wasm.reparse_everything(app_ptr);
273281
};
274282

275-
/**
276-
* @param {number} app_ptr
277-
*/
278-
__exports.rerender = function(app_ptr) {
279-
wasm.rerender(app_ptr);
280-
};
281-
282283
/**
283284
* @param {number} app_ptr
284285
*/

assets/frontend_web_bg.wasm

18.7 KB
Binary file not shown.

assets/fuzz.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ let chance_tab = 0;
2424
let chance_insert_lineref = 0;
2525

2626
let event_history = [];
27+
let sim_time = 0;
2728

2829
function random_float(min, max) {
2930
return Math.random() * (max - min) + min;
@@ -54,7 +55,6 @@ function init() {
5455
chance_undo = rnd_eql();
5556
chance_tab = rnd_eql();
5657
chance_insert_lineref = rnd_eql();
57-
5858
}
5959

6060
function toggle_fuzzing() {
@@ -217,6 +217,9 @@ function simulate_input() {
217217
return false;
218218
}
219219
content_before_event = null;
220+
221+
sim_time += 100;
222+
wasm_bindgen.handle_time(app_ptr, sim_time);
220223
if (event_history.length > 1000) {
221224
console.log("FUZZING RESTART");
222225
// remove the tab

compile_and_run.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
wasm-pack build --release --target no-modules frontend-web
1+
wasm-pack build --dev --target no-modules frontend-web
22
serve .

examples/binary_interp.notecalc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Write your input here
2+
input = 0xc0e00000
3+
// use ALT+(Left|Right) while
4+
// the cursor is on the above line
5+
// to change to hex or binary representation
6+
7+
# interpreting input as...
8+
## ...several unsigned data types
9+
input AND 0xFF // u8
10+
input AND 0xFFFF // u16
11+
input AND 0xFFFFFFFF // u32
12+
input AND 0xFFFFFFFFFFFFFFFF // u64
13+
14+
## ...file sizes / number of bytes
15+
input = input byte
16+
input in kilobyte
17+
input in MB
18+
input in GB
19+
// ... *ibi-bytes
20+
input in KiB
21+
input in MiB
22+
input in GiB

examples/financial.notecalc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
price = 350 000$
2+
down payment = price * 20%
3+
finance amount = price - down payment
4+
5+
interest rate = 3.7%/year
6+
term = 30year
7+
8+
n = term * 12/year
9+
r = interest rate / (12/year)
10+
11+
monthly payment = r/(1 - (1+r)^(-n)) * finance amount

examples/leangains.notecalc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
source: https://rippedbody.com/how-to-calculate-leangains-macros/
2+
3+
weight = 80 kg
4+
height = 190 cm
5+
age = 31
6+
7+
# Step 1: Calculate your (Basal Metabolic Rate) (BMR)
8+
men BMR = 66 + (13.7 * weight/1kg) + (5 * height/1cm) - (6.8 * age)
9+
10+
# STEP 2. FIND YOUR TDEE BY ADJUSTING FOR ACTIVITY
11+
Choose Activity
12+
1 - Sedentary (little or no exercise) [BMR x 1.15]
13+
2 - Mostly sedentary (office work), plus 36 days of weight lifting [BMR x 1.35]
14+
3 - Lightly active, plus 36 days of weight lifting [BMR x 1.55]
15+
4 - Highly active, plus 36 days of weight lifting [BMR x 1.75]
16+
activity = 2
17+
TDEE = (men BMR * nth([1.15,1.35,1.55,1.75], activity-1))
18+
19+
# STEP 3. ADJUST CALORIE INTAKE BASED ON YOUR GOAL
20+
## Fat loss
21+
target weekly fat loss rate = 0.5%
22+
(TDEE - ((weight/1kg) * target weekly fat loss rate * 1100)) kcal
23+
## Muscle gain
24+
monthly rates of weight gain = 1%
25+
(TDEE + (weight/1kg * monthly rates of weight gain * 330)) kcal
26+
27+
## Protein intake
28+
// choose a value between 1.6 g/kg and 2.2 g/kg
29+
p = 2.2 g/kg
30+
protein intake = weight * p in g
31+
calories from protein = protein intake * 4kcal/g in kcal
32+
## Fat intake
33+
// 0.5g/kg or at least 30% of the calories
34+
fat contains 9kcal/g
35+
calories from fat = &[22] * 30%
36+
fat intake = calories from fat / &[34] in g
37+
## Carb intake
38+
Carb is the remainder of your total budget
39+
protein contains 4kcal/gram
40+
calories from carb = (&[22] - calories from fat - calories from protein)
41+
carb intake = calories from carb / &[39] in g
42+
43+
Check
44+
calories from carb + calories from fat + calories from protein
45+
P, C, F intake [protein intake,carb intake,fat intake]

examples/meal_calc.notecalc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Arrays contain the Protein, Fat and Carbohydrate
2+
content of each food in this respective order.
3+
4+
# Food list
5+
P F Ch
6+
chicken breast = [22.5 g,2.6 g,0 g] / 100g
7+
rice = [6.0 g,0.2g,72g] / 100g
8+
9+
# Daily intake
10+
chicken breast * 500g
11+
rice * 300g
12+
daily intake = sum
13+
daily intake * [4kcal/g;4kcal/g;9kcal/g] in kcal
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,29 @@ Some examples. Feel free to change them and play around.
1919
200 * 5%
2020
200 - 20%
2121

22+
## Find the rate when the base and result are known
23+
20 is what percent of 60
24+
220 is what percent of 200
25+
26+
## Find the base when the result and rate are known
27+
5 is 25% of what
28+
12 is 12% of what
29+
30+
## Find the base when the result and increase/decrease are known
31+
5 is 25% on what
32+
or in other forms:
33+
25% on what is 5
34+
what plus 25% is 5
35+
36+
5 is 25% off what
37+
or in other forms:
38+
what minus 25% is 5
39+
25% off what is 5
40+
41+
## Find the increase/decrease when the base and he result are known
42+
44 is what % on 40
43+
24 0 is what % off 300
44+
2245

2346
# Numbers
2447
You don't have to count zeros 100k

0 commit comments

Comments
 (0)