Skip to content

Commit a13a6d1

Browse files
authored
Update Readme.md
1 parent 4f234c9 commit a13a6d1

File tree

1 file changed

+0
-350
lines changed

1 file changed

+0
-350
lines changed

Readme.md

Lines changed: 0 additions & 350 deletions
Original file line numberDiff line numberDiff line change
@@ -23,353 +23,3 @@ Most features of the Numi for macOS are supported in CLI. However, these are the
2323
- Variables
2424
- Tokens (sum, prev, avg)
2525
- Plugins/extension
26-
27-
## Documentation
28-
29-
- [Unit Conversion](#unit-conversion)
30-
- [Time Zone Conversion](#time-zone-conversion)
31-
- [Operations](#operations)
32-
- [Numbers](#numbers)
33-
- [Currency](#currency)
34-
- [Percentage](#percentage)
35-
- [Scales](#scales)
36-
- [Variables](#variables)
37-
- [Constants](#constants)
38-
- [Functions](#functions)
39-
- [CSS](#css)
40-
- [Previous Result](#previous-result)
41-
- [Sum](#sum)
42-
- [Average](#average)
43-
- [SI prefixes](#si-prefixes)
44-
- [Date & Time](#date-time)
45-
- [Temperature](#temperature)
46-
- [Length](#length)
47-
- [Area](#area)
48-
- [Volume](#volume)
49-
- [Weight](#weight)
50-
- [Angular](#angular)
51-
- [Data](#data)
52-
- [Format](#format)
53-
- [Shortcuts](#shortcuts)
54-
- [Import & Export](#import-export)
55-
- [Alfred](#alfred)
56-
57-
### Unit Conversion
58-
59-
With `in (into, as, to)` you can convert one unit into another. Numi will automatically convert units to perform operations if it's needed during conversion.
60-
$30 in Euro
61-
$30 CAD + 5 USD - 7EUR
62-
63-
### Time Zone Conversion
64-
65-
Use `time` or `now` function to get time in your time zone. You can prefix this functions with time zone location (or use `in` with time zone suffix) to get current time for specified location. Results are always in sync with global time, so, at any point of time you will get the right time.
66-
67-
It's also possible to convert specific time or date from one time zone into another. Or calculate difference between time in different time zones:
68-
69-
PST time
70-
New York time
71-
Time in Madrid
72-
2:30 pm HKT in Berlin
73-
74-
### Operations
75-
76-
You can use sign and word operators. Several expressions might be stacked together. Notice, expressions will be multiplied if used in parentheses one after another.
77-
78-
8 times 9
79-
1 meter 20 cm = 120 cm
80-
6 (3) = 18
81-
82-
<table>
83-
<thead><tr><th width="40%"> Operation </th> <th> Sample </th> </tr></thead>
84-
85-
<tr><td>Addition</td> <td>+, plus, and, with</td> </tr>
86-
<tr><td>Subtraction</td> <td>-, minus, subtract, without</td> </tr>
87-
<tr><td>Multiplication</td> <td>*, times, multiplied by, mul</td> </tr>
88-
<tr><td>Division</td> <td>/, divide, divide by</td> </tr>
89-
<tr><td>Exponent</td> <td>^</td> </tr>
90-
<tr><td>Bitwise And</td> <td>&amp;</td> </tr>
91-
<tr><td>Bitwise Or</td> <td>|</td> </tr>
92-
<tr><td>Bitwise Xor</td> <td>xor</td> </tr>
93-
<tr><td>Left Shift</td> <td>&lt;&lt;</td> </tr>
94-
<tr><td>Right Shift</td> <td>&gt;&gt;</td> </tr>
95-
<tr><td>Modulo</td> <td>mod</td> </tr>
96-
97-
</table>
98-
99-
### Numbers
100-
101-
Besides decimal numeral system, it is possible to use numbers in binary, octal or hexadecimal form using appropriate prefix: `0b`, `0o` and `0x`. You can use `sci` or `scientific` to format results in scientific notation.
102-
103-
0b110111011
104-
0o1435343 in hex
105-
5 300 in sci
106-
107-
### Currency
108-
109-
You can use [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes for currency (like USD, RUB, CAD etc). You can also use common currency names and signs, like `$` for the US dollars, `roubles` for Russian roubles, or `` for Euro. Numi updates currency rates several times a day using [open exchange rates](https://openexchangerates.org) service. Numi also supports a huge list of cryptocurrencies with hourly rates updates.
110-
111-
### Percentage
112-
113-
In addition to general percentage operations like adding or subtracting percent of value (`$10 - 40%`), you also can use additional operations :
114-
115-
<table>
116-
<thead><tr><th width="60%"> Operation </th> <th> Example </th> </tr></thead>
117-
118-
<tr><td>Percentage value</td> <td>20% of $10</td> </tr>
119-
<tr><td>Adding percentage</td> <td>5% on $30</td> </tr>
120-
<tr><td>Subtracting percentage</td> <td>6% off 40 EUR</td> </tr>
121-
122-
<tr><td>Percentage value of one value relative to another</td> <td>$50 as a % of $100</td> </tr>
123-
<tr><td>Percentage addition of one value relative to another</td> <td>$70 as a % on $20</td> </tr>
124-
<tr><td>Percentage subtraction of one value relative to another</td> <td>$20 as a % off $70</td> </tr>
125-
126-
<tr><td>Value by percent part</td> <td>5% of what is 6 EUR</td> </tr>
127-
<tr><td>Value by percent addition</td> <td>5% on what is 6 EUR</td> </tr>
128-
<tr><td>Value by percent subtraction</td> <td>5% off what is 6 EUR</td> </tr>
129-
130-
</table>
131-
132-
### Scales
133-
134-
Scales used for shorter form of writing big numbers. Please note that one-letter scales are case-sensitive, since `m` used for meters, and `K` used for Kelvins. Supported scales: thousands (`k`, `thousand`), millions (`M`, `million`), billions (`billion`).
135-
136-
$2k
137-
2M eur
138-
139-
### Variables
140-
141-
You can declare variables and reuse them using the `=` operator. Please note some characters and keywords cannot be used as a variable. For example, `K` might be used as a temperature unit in Kelvin. Variable names should not contain whitespaces or special characters, and should not start with number:
142-
143-
v = $20
144-
v2 = 5%
145-
v times 7 - v2
146-
v + $10
147-
148-
### Constants
149-
150-
<table>
151-
<thead><tr><th width="60%"> Description </th> <th> Value </th> </tr></thead>
152-
153-
<tr><td>Pi</td> <td>3.1415926536</td> </tr>
154-
<tr><td>E</td> <td>2.7182818285</td> </tr>
155-
156-
</table>
157-
158-
### Functions
159-
160-
By default trigonometrical functions uses parameters in radians.
161-
162-
<table>
163-
<thead><tr><th width="60%"> Description </th> <th>Function</th> <th> Example </th> </tr></thead>
164-
165-
<tr><td>N-th root</td> <td>root</td> <td>root 2 (8)</td> </tr>
166-
<tr><td>Square root</td> <td>sqrt</td> <td>sqrt 16</td> </tr>
167-
<tr><td>Cubed root</td> <td>cbrt</td> <td>cbrt 8</td> </tr>
168-
<tr><td>Absolute value</td> <td>abs</td> <td>abs(-4)</td> </tr>
169-
<tr><td>Logarithm</td> <td>log</td> <td>log 2 (10)</td> </tr>
170-
<tr><td>Natural logarithm</td> <td>ln</td> <td>ln 3</td> </tr>
171-
<tr><td>Factorial</td> <td>fact</td> <td>fact 5</td> </tr>
172-
<tr><td>Rounding</td> <td>round</td> <td>round 3.45</td> </tr>
173-
<tr><td>Ceiling</td> <td>ceil</td> <td>ceil 3.76</td> </tr>
174-
<tr><td>Flooring</td> <td>floor</td> <td>floor 2.56</td> </tr>
175-
<tr><td>Sine</td> <td>sin</td> <td>sin 45°</td> </tr>
176-
<tr><td>Cosine</td> <td>cos</td> <td>cos 3.45</td> </tr>
177-
<tr><td>Tangent</td> <td>tan</td> <td>tan 8</td> </tr>
178-
<tr><td>Arcsine</td> <td>arcsin</td> <td>arcsin 30</td> </tr>
179-
<tr><td>Arccosine</td> <td>arccos</td> <td>arccos 85</td> </tr>
180-
<tr><td>Arctangent</td> <td>arctan</td> <td>arctan 9</td> </tr>
181-
<tr><td>Hyperbolic sine</td> <td>sinh</td> <td>sinh 3</td> </tr>
182-
<tr><td>Hyperbolic cosine</td> <td>cosh</td> <td>cosh 9</td> </tr>
183-
<tr><td>Hyperbolic tangent</td> <td>tanh</td> <td>tanh 11</td> </tr>
184-
</table>
185-
186-
### CSS
187-
188-
Numi supports several CSS units: pixels (px), points (pt), em. Em is set to 16 px by default, but you can assign different value to it. Conversion from screen units to other length units performed using pixel per inch value (ppi). By default `ppi` is set to 96 pixels, which mean in every inch there're 96 pixels. You can set custom value for `ppi`.
189-
190-
12 pt in px
191-
em = 20px
192-
1.2 em in px
193-
1 inch in px = 96 px
194-
ppi = 326
195-
1 cm in px = 128,35 px
196-
197-
### Previous Result
198-
199-
Use `prev` token to use result from previous line:
200-
201-
Cost: $20 + 56 EUR
202-
Discounted: prev - 5% discount
203-
204-
### Sum
205-
206-
You can calculate sum of all lines above (until empty line) using `sum` ( `total` ) operator.
207-
208-
Line 1: $10
209-
Line 2: $15
210-
Result: sum
211-
212-
### Average
213-
214-
You can calculate an average of all lines above (until empty line) using `average` ( `avg` ) operator.
215-
216-
Line 1: $10
217-
Line 2: $20
218-
Result: average
219-
220-
### SI prefixes
221-
222-
SI-based units support all [SI prefixes](https://en.wikipedia.org/wiki/Metric_prefix), both short and long form. Note that SI prefixes are case-sensitive. For example, use `MB` for megabytes, not mB:
223-
224-
1 mm
225-
2 picometers
226-
3 GB
227-
228-
### Date & Time
229-
230-
To make time calculations more straightforward, 1 year is equal to 365 days, and 1 month equal to 1/12 of the year. In cases where results give non-integer value, round functions might be used to make an integer. Supported units: Second, minute, hour, day, week, month, year. Use `fromunix` function to convert timestamp into dates.
231-
232-
round(1 month in days)
233-
fromunix(1446587186)
234-
235-
### Temperature
236-
237-
Supported units: kelvin, celsius, fahrenheit
238-
239-
### Length
240-
241-
Supported units: meter, mil, points, lines, inch, hand, foot, yard, rod, chain, furlong, mile, cable, nautical mile, league. Note, since `in` used as a conversion operator, you cannot use it for inches.
242-
243-
### Area
244-
245-
Supported units: hectare, are, acre and all "squared" length units. Use `square` or `sq` prefix for this case.
246-
247-
20 sq cm
248-
30 square inches
249-
11 sqm
250-
251-
### Volume
252-
253-
Supported units: Pint, quart, gallon, tea spoon, table spoon, cup. It is possible to use all length units with `cubic`, `cu` or `cb` prefix.
254-
255-
20 cu cm
256-
30 cubic inches
257-
11 cbm
258-
259-
### Weight
260-
261-
Supported units: gram, tonne, carat, centner, pound, stone, ounce.
262-
263-
### Angular
264-
265-
Supported units: radians, degree. You can use both as text form of unit (radians, degrees) as sign. For example, 45 °
266-
267-
### Data
268-
269-
Bytes multiplies contain 1000 bytes. If you need 1024 multiplier, use [kibibytes](https://en.wikipedia.org/wiki/Kibibyte). Please note lowercase `b` is used for bits, and uppercase `B` for bytes.
270-
271-
### Format
272-
273-
Use hash symbol at the beginning of the line to make a header. If you want to comment part of the line, use double quotes. To comment all line, use double slash. Use colon to make a label (label will not be evaluated).
274-
275-
# This is header
276-
$275 for the "Model 227"
277-
// This is comment
278-
Price: $11 + $34.45
279-
280-
### Shortcuts
281-
282-
<table>
283-
<tr><td width="80%">Surround with parentheses</td> <td>⇧⌘0</td> </tr>
284-
<tr><td>Copy result on current line</td> <td>⇧⌘C</td> </tr>
285-
<tr><td>Select all</td> <td>⌘A</td> </tr>
286-
<tr><td>Delete all</td> <td>⎇⌘⌫</td> </tr>
287-
<tr><td>Copy all</td> <td>⎇⌘C</td> </tr>
288-
<tr><td width="80%">Import</td> <td>⌘O</td> </tr>
289-
<tr><td>Export</td> <td>⌘S</td> </tr>
290-
<tr><td>Print</td> <td>⌘P</td> </tr>
291-
</table>
292-
293-
### Import & Export
294-
295-
Numi does not modify imported files until you explicitly export them. All exported files have .numi extension. You can open .numi files with any text editor since Numi uses plain text and UTF-8 encoding to store files.
296-
297-
### Alfred
298-
299-
You can use Numi with [Alfred](https://alfredapp.com) for quick calculations. Just type `numi`, <kbd>n</kbd> or <kbd>=</kbd> in front of your expressions in Alfred. Please note, time zones functionality is not available via integration.
300-
301-
First you will need to install the [Numi workflow](https://github.com/nikolaeu/Numi/releases/download/mac-3.20.4/Numi.alfredworkflow), and enable Alfred integration in Numi preferences.
302-
303-
For the LaunchBar extension please refer to [https://github.com/Rahlir/NumiLaunchbar](https://github.com/Rahlir/NumiLaunchbar).
304-
305-
![gif](http://numi.app/gif/alfred.gif)
306-
307-
## Plugins
308-
309-
You can use JavaScript extensions to add global variables, custom units or functions. Right now only limited set of API is available via JavaScript, but the plan is to open as much API as possible.
310-
311-
Extension folder located in `~/Library/Application Support/com.dmitrynikolaev.numi/extensions` of your home folder. Open finder app, choose **Go** -> **Go to Folder** in menu (Or use shortcut `Cmd+Shift+G`) and type `~/Library/Application Support/com.dmitrynikolaev.numi/extensions` in destination. Press **Go** button and you'll navigate to the extension folder.
312-
313-
Use `~/Library/Application Support/com.nikolaeu.numi-setapp/extensions` for SetApp version.
314-
315-
Numi extension logs should be viewable via the `Console` application. Open Console app, type `NumiExtension` in the search bar, and choose `category` filter to focus on the extension logs.
316-
317-
- [Logging](#logging)
318-
- [Values and Variables](#values-and-variables)
319-
- [Custom Units](#custom-units)
320-
- [Custom Functions](#custom-functions)
321-
- [List of Base Units](#list-of-base-units)
322-
- [Alfred integration](#alfred-integration)
323-
324-
### Logging
325-
326-
Use `log` function to send output from your extension to log window.
327-
328-
`js log("Function called!"); `
329-
330-
### Values and Variables
331-
332-
Each value in Numi might be represented in JavaScript as an object with a set of properties, describing decimal value, unit type etc. Here is the usual way of creating new values for Numi:
333-
334-
`js var value = { "double": 5, "unitId" : "USD" } `
335-
336-
Use `numi.setVariable` function to declare global variables.
337-
338-
`js numi.setVariable("xxx", { "double": 5, "unitId" : "USD" }); `
339-
340-
You can also use plain JavaScript numbers for cases when you'll need to return value for Numi. This will be treated as a value with decimal number.
341-
342-
`js numi.setVariable("yyy", 122); `
343-
344-
### Custom Units
345-
346-
Use `numi.addUnit` to add new unit. `id` field required for internal use, and might be any unique literal. `phrases` contains string with comma-separated phrases that might be used for the unit, `format` field used for results formatting.
347-
348-
Unit conversion limited to ratio-based conversion ATM. For each unit you can specify base unit identifier `baseUnitId` and `ratio` to that unit. Conversion from one unit to another in this case happening through base unit. On first step value will be converted to the base unit. On second step base value will be converted to result unit. `baseUnitId` might be picked up from [list of base units](#list-of-base-units).
349-
350-
`js numi.addUnit({ "id": "horse", "phrases": "horse, horses, hrs", "baseUnitId": "m", "format" : "hrs", "ratio" : 2.4, }); `
351-
352-
### Custom Functions
353-
354-
Use `numi.addFunction` to add new function. Values passed into evaluated function in form of array. To use function with multiple arguments you can use `;` in Numi, like `myFunction(1;5;4)`.
355-
356-
`js numi.addFunction({ "id": "zum", "phrases": "zum" }, function(values) { return { "double": values[0].double + values[1].double }; }); `
357-
358-
### List of Base Units
359-
360-
| Unit name | Unit ID |
361-
| ------------ | ------- |
362-
| Meter | m |
363-
| Second | second |
364-
| Percentage | percent |
365-
| Square meter | m2 |
366-
| Cubic meter | m3 |
367-
| Bit | bit |
368-
| Byte | byte |
369-
| Radian | radian |
370-
| Gram | gram |
371-
| US Dollars | USD |
372-
373-
### Sample Extensions
374-
375-
- [Fluid ounces](https://github.com/nikolaeu/numi/blob/master/plugins/sample.js)

0 commit comments

Comments
 (0)