- commit
- f07cae2
- parent
- 5964be9
- author
- chasinglightning
- date
- 2025-01-28 13:28:30 -0500 EST
set up stow
120 files changed,
+21,
-10764
A
stow.sh
+1,
-0
1@@ -0,0 +1 @@
2+git/.gitconfig
+3,
-0
1@@ -0,0 +1,3 @@
2+\.git
3+\.gitignore
4+\themes
+0,
-8
1@@ -1,8 +0,0 @@
2-[Desktop Entry]
3-Name=ComicTagger
4-GenericName=
5-Comment=
6-Exec=/home/kat/Downloads/Programs/ComicTagger-x86_64.AppImage
7-Type=Application
8-Icon=/media/kat/disk/Pictures/Miscellaneous/misc icons/comictagger.png
9-Terminal=false
+0,
-8
1@@ -1,8 +0,0 @@
2-[Desktop Entry]
3-Name=ElectronWMD
4-GenericName=
5-Comment=
6-Exec=/home/kat/Downloads/Programs/electronwmd-0.5.0-1.5.0-linux_x86_64.AppImage
7-Type=Application
8-Icon=/media/kat/disk/Pictures/Miscellaneous/misc icons/mdlogoiconwmdp.png
9-Terminal=false
+0,
-8
1@@ -1,8 +0,0 @@
2-[Desktop Entry]
3-Name=MKVToolNix
4-GenericName=
5-Comment=
6-Exec=/home/kat/Downloads/Programs/MKVToolNix_GUI-82.0-x86_64.AppImage
7-Type=Application
8-Icon=/media/kat/disk/Pictures/Miscellaneous/misc icons/c0d03eb7.png
9-Terminal=false
+0,
-8
1@@ -1,8 +0,0 @@
2-[Desktop Entry]
3-Name=Obsidian
4-GenericName=
5-Comment=
6-Exec=/home/kat/Downloads/Programs/Obsidian-1.6.7.AppImage
7-Type=Application
8-Icon=/media/kat/disk/Pictures/Miscellaneous/misc icons/2023_Obsidian_logo.svg.png
9-Terminal=false
+0,
-8
1@@ -1,8 +0,0 @@
2-[Desktop Entry]
3-Name=Shotcut
4-GenericName=
5-Comment=
6-Exec=/home/kat/Downloads/Programs/shotcut-linux-x86_64-240128.AppImage
7-Type=Application
8-Icon=/media/kat/disk/Pictures/Miscellaneous/misc icons/shotcut-logo-640x640.png
9-Terminal=false
+0,
-8
1@@ -1,8 +0,0 @@
2-[Desktop Entry]
3-Name=Soulseek
4-GenericName=
5-Comment=
6-Exec=/home/kat/Downloads/Programs/SoulseekQt-2018-1-30-64bit.AppImage
7-Type=Application
8-Icon=/media/kat/disk/Pictures/Miscellaneous/misc icons/soulseek-online-bigblue.png
9-Terminal=false
+0,
-8
1@@ -1,8 +0,0 @@
2-[Desktop Entry]
3-Name=Waterfox
4-GenericName=
5-Comment=
6-Exec=/home/kat/Downloads/Programs/waterfox/waterfox
7-Type=Application
8-Icon=/media/kat/disk/Pictures/Miscellaneous/misc icons/waterfox.GgOAxZ-_.svg
9-Terminal=false
R home/.config/conky/launch.sh =>
config/.config/conky/launch.sh
+0,
-0
R home/.config/conky/themes/strip-clear/dark-strip-l-clear-1920-1080.conf =>
config/.config/conky/themes/strip-clear/dark-strip-l-clear-1920-1080.conf
+0,
-0
R home/.config/conky/wttr.sh =>
config/.config/conky/wttr.sh
+0,
-0
R home/config/gallery-dl/gallery-dl.conf =>
config/.config/gallery-dl/gallery-dl.conf
+0,
-0
R home/config/mangamanager/settings.ini =>
config/.config/mangamanager/settings.ini
+0,
-0
R home/.config/micro/colorschemes/catppuccin-frappe.micro =>
config/.config/micro/colorschemes/catppuccin-frappe.micro
+0,
-0
R home/.config/starship.toml =>
config/.config/starship.toml
+0,
-0
R home/.local/bin/covid =>
config/.local/bin/covid
+0,
-0
R home/.local/bin/getlyr =>
config/.local/bin/getlyr
+0,
-0
R home/.local/bin/news =>
config/.local/bin/news
+0,
-0
R home/.local/bin/nowplaying =>
config/.local/bin/nowplaying
+0,
-0
R home/.local/bin/weather =>
config/.local/bin/weather
+0,
-0
1@@ -1,41 +0,0 @@
2-# config structure
3-
4-[OPTIONS]
5-alignment=left
6-source=google
7-interval=1500
8-player=mpd
9-autoswitch=on
10-mpd_host=127.0.0.1
11-mpd_port=6600
12-mpd_pass=
13-#colors
14-#offset=1
15-statusbar=on
16-
17-[BINDINGS]
18-up=arrow_up
19-down=arrow_down
20-
21-step-up=arrow_left
22-step-down=arrow_right
23-step-size=5
24-
25-left=j
26-center=k
27-right=l
28-
29-autoswitchtoggle=a
30-cycle-source=c
31-
32-delete=d
33-edit=e
34-find=/
35-find-next=n
36-find-prev=p
37-
38-help=h
39-
40-quit=q
41-
42-
+0,
-21
1@@ -1,21 +0,0 @@
2-MIT License
3-
4-Copyright (c) 2022 Tero Karvinen https://TeroKarvinen.com
5-
6-Permission is hereby granted, free of charge, to any person obtaining a copy
7-of this software and associated documentation files (the "Software"), to deal
8-in the Software without restriction, including without limitation the rights
9-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-copies of the Software, and to permit persons to whom the Software is
11-furnished to do so, subject to the following conditions:
12-
13-The above copyright notice and this permission notice shall be included in all
14-copies or substantial portions of the Software.
15-
16-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-SOFTWARE.
+0,
-62
1@@ -1,62 +0,0 @@
2-# micro-cheat - F1 cheatsheet for the language you're editing
3-
4-**F1** Show cheatsheet for the language you're editing: Lua, Go, Python...
5-
6-A plugin for Micro editor.
7-
8-## Usage
9-
10-Edit a source code file with micro. Press **F1**.
11-
12-A cheatsheet for the language opens. If you're editing Python, it's a Python cheatsheet. If Go, then Go cheatsheet.
13-Press Ctrl-Q to close the cheatsheet tab and return to editing.
14-
15-For your convenience, micro-cheat also provides a command 'cheat' that you can bind to any key or run with ctrl-E.
16-
17-Tested with
18-
19-- Python
20-- Go (Golang)
21-- Lua
22-- Javascript
23-- CSS (cascading style sheets)
24-- HTML
25-- HAML (HTML abstraction markup language)
26-- Vagrantfile (by filename)
27-- Dockerfile (by filename)
28-- Makefile
29-- JavaScript (ECMAScript)
30-- TypeScript
31-- YAML (yet another markup language)
32-- org-mode (*.org)
33-- bash (shell)
34-
35-## Installation
36-
37-In the future, you will be able to install micro-cheat by
38-
39- $ micro --plugin install micro-cheat
40-
41-Currently, there is just development install
42-
43- $ cd $HOME/.config/micro/plug/
44- $ git clone https://github.com/terokarvinen/micro-cheat
45-
46-## Tutorial
47-
48-[Installation & tutorial for 4 plugins: Palettero, Cheat, Run and Jump](https://terokarvinen.com/2022/command-palette-cheatsheet-run-and-make-micro/)
49-
50-## Limitations
51-
52-All cheatsheets included in cheatsheets/ directory are not supported yet. Micro-cheat has only been tested on Linux.
53-
54-## Todo
55-
56-Bibtex references cheatsheet. Should be MIT licensed to be included in this plugin.
57-
58-## Adminstrivia
59-
60-Cheatsheets are from https://devhints.io project, copyright (c) 2021 Rico Sta. Cruz and contributors, received under MIT license.
61-
62-Micro-cheat plugin is Copyright 2022 Tero Karvinen https://TeroKarvinen.com, MIT license.
63-
1@@ -1,102 +0,0 @@
2----
3-title: Ansible
4-category: Ansible
5----
6-
7-{% raw %}
8-
9-## Getting started
10-
11-### Hosts
12-
13- $ sudo mkdir /etc/ansible
14- $ sudo vim /etc/ansible/hosts
15-
16- [example]
17- 192.0.2.101
18- 192.0.2.102
19-
20-### Running a playbook
21-
22- $ ansible-playbook playbook.yml
23-
24-## Tasks
25-
26- - hosts: all
27- user: root
28- sudo: no
29- vars:
30- aaa: bbb
31- tasks:
32- - ...
33- handlers:
34- - ...
35-
36-### Includes
37-
38- tasks:
39- - include: db.yml
40- handlers:
41- - include: db.yml user=timmy
42-
43-## Handlers
44-
45- handlers:
46- - name: start apache2
47- action: service name=apache2 state=started
48-
49- tasks:
50- - name: install apache
51- action: apt pkg=apache2 state=latest
52- notify:
53- - start apache2
54-
55-## Vars
56-
57- - host: lol
58- vars_files:
59- - vars.yml
60- vars:
61- project_root: /etc/xyz
62- tasks:
63- - name: Create the SSH directory.
64- file: state=directory path=${project_root}/home/.ssh/
65- only_if: "$vm == 0"
66-
67-## Roles
68-
69- - host: xxx
70- roles:
71- - db
72- - { role:ruby, sudo_user:$user }
73- - web
74-
75- # Uses:
76- # roles/db/tasks/*.yml
77- # roles/db/handlers/*.yml
78-
79-### Task: Failures
80-
81- - name: my task
82- command: ...
83- register: result
84- failed_when: "'FAILED' in result.stderr"
85-
86- ignore_errors: yes
87-
88- changed_when: "result.rc != 2"
89-
90-### Env vars
91-
92- vars:
93- local_home: "{{ lookup('env','HOME') }}"
94-
95-## References
96-
97- * [Intro](http://www.ansibleworks.com/docs/intro_configuration.html)
98- * [Modules](http://www.ansibleworks.com/docs/modules.html)
99-
100-{% endraw %}
101-
102-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
103-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,112 +0,0 @@
2----
3-title: Chef
4-category: Devops
5-layout: 2017/sheet
6----
7-
8-### Install
9-
10-In your server:
11-{: .-setup}
12-
13-```bash
14-$ sudo apt-get install curl
15-```
16-
17-```bash
18-$ curl -L https://omnitruck.chef.io/install.sh | sudo bash
19-Thank you for installing Chef!
20-```
21-
22-```bash
23-$ chef-solo -v
24-...
25-Chef: 14.5.33
26-```
27-
28-### Start the cookbook
29-
30-```bash
31- wget http://github.com/chef-cookbooks/chef-repo/tarball/master -O - | tar xzf - --strip-components=1
32-```
33-
34-### Knife
35-
36-```bash
37-$ knife supermarket download mysql
38-```
39-
40-### Invoking chef-solo
41-
42-```bash
43-$ chef-solo -c solo.rb -j web.json
44-```
45-
46-## Examples
47-
48-### Simple compile-from-source
49-
50-```ruby
51-execute "tar --no-same-owner -zxf hi.tar.gz" do
52- cwd "/usr/local/src"
53- creates "/usr/local/src/node-v#{version}"
54-end
55-```
56-
57-```ruby
58-bash "compile" do
59- cwd "/usr/local/src/node-v#{version}"
60- code %[
61- PATH=/usr/local/bin:$PATH
62- ./configure
63- make
64- ]
65- creates "/usr/local/src/node-v#{version}/node"
66-end
67-```
68-
69-### remote file
70-
71-```ruby
72-remote_file "/usr/local/src/hi.tar.gz" do
73- source "http://..."
74- checksum "ab83be..."
75- mode 0644
76- action :create_if_missing
77-end
78-```
79-
80-### ruby_block
81-
82-```ruby
83-ruby_block "name" do
84- block { File.read ... }
85- not_if { File.exists?(...) }
86-end
87-```
88-
89-### Execute
90-
91-```ruby
92-execute "name" do
93- cwd "..."
94- environment({ "PATH" => "..." })
95- command "make install"
96- creates "..."
97-end
98-```
99-
100-### Conditions
101-
102-```ruby
103- creates "/usr/local/src/node-v#{version}/node"
104- not_if { File.exists?('...') }
105-```
106-
107-## Also see
108-
109-* [Learn Chef Rally](https://learn.chef.io) _(learn.chef.io)_
110-* [install_from_source.rb recipe](https://github.com/mdxp/nodejs-cookbook/blob/master/recipes/install_from_source.rb) _(github.com)_
111-
112-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
113-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,73 +0,0 @@
2----
3-title: Cron
4-category: CLI
5-layout: 2017/sheet
6-updated: 2018-05-03
7-weight: -3
8----
9-
10-## Format
11-{: .-two-column}
12-
13-### Format
14-
15-```
16-Min Hour Day Mon Weekday
17-```
18-{: .-setup}
19-
20-```
21-* * * * * command to be executed
22-```
23-
24-```
25-┬ ┬ ┬ ┬ ┬
26-│ │ │ │ └─ Weekday (0=Sun .. 6=Sat)
27-│ │ │ └────── Month (1..12)
28-│ │ └─────────── Day (1..31)
29-│ └──────────────── Hour (0..23)
30-└───────────────────── Minute (0..59)
31-```
32-{: .-setup.-box-chars}
33-
34-### Operators
35-
36-| Operator | Description |
37-| --- | --- |
38-| `*` | all values |
39-| `,` | separate individual values |
40-| `-` | a range of values |
41-| `/` | divide a value into steps |
42-
43-### Examples
44-
45-| Example | Description |
46-| --- | --- |
47-| `0 * * * *` | every hour |
48-| `*/15 * * * *` | every 15 mins |
49-| `0 */2 * * *` | every 2 hours |
50-| `0 18 * * 0-6` | every week Mon-Sat at 6pm |
51-| `10 2 * * 6,7` | every Sat and Sun on 2:10am |
52-| `0 0 * * 0` | every Sunday midnight |
53-| --- | --- |
54-| `@reboot` | every reboot |
55-
56-### Crontab
57-
58-```bash
59-# Adding tasks easily
60-echo "@reboot echo hi" | crontab
61-```
62-
63-```bash
64-# Open in editor
65-crontab -e
66-```
67-
68-```bash
69-# List tasks
70-crontab -l [-u user]
71-```
72-
73-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
74-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,218 +0,0 @@
2----
3-title: CSS
4-category: CSS
5-layout: 2017/sheet
6-weight: -1
7-keywords:
8- - "margin, padding, border"
9- - "div, .class, #id, [attr]"
10- - "font, background"
11- - "display: block, inline, flex"
12- - Selectors
13- - Properties
14----
15-
16-## Basics
17-{: .-three-column}
18-
19-### Selectors
20-
21-```css
22-.class {
23- font-weight: bold;
24-}
25-```
26-{: .-setup}
27-
28-| Selector | Description |
29-| ----------------- | ------------ |
30-| `*` | All elements |
31-| `div` | Element |
32-| `.class` | Class |
33-| `#id` | ID |
34-| `[disabled]` | Attribute |
35-| `[role="dialog"]` | Attribute |
36-
37-### Combinators
38-
39-| Selector | Description |
40-| ------------------- | ----------------- |
41-| `.parent .child` | Descendant |
42-| `.parent > .child` | Direct descendant |
43-| `.child + .sibling` | Adjacent sibling |
44-| `.child ~ .sibling` | Far sibling |
45-| `.class1.class2` | Have both classes |
46-
47-### Attribute selectors
48-
49-| Selector | Description |
50-| ------------------ | ----------------------------------- |
51-| `[role="dialog"]` | `=` Exact |
52-| `[class~="box"]` | `~=` Has word |
53-| `[class|="box"]` | `|=` Exact or prefix (eg, `value-`) |
54-| `[href$=".doc"]` | `$=` Ends in |
55-| `[href^="/index"]` | `^=` Begins with |
56-| `[class*="-is-"]` | `*=` Contains |
57-
58-### Pseudo-classes
59-
60-| Selector | Description |
61-| -------------------- | ------------------------------------------ |
62-| `:target` | eg, `h2#foo:target` |
63-| --- | --- |
64-| `:disabled` | |
65-| `:focus` | |
66-| `:active` | |
67-| --- | --- |
68-| `:nth-child(3)` | 3rd child |
69-| `:nth-child(3n+2)` | 2nd child in groups of 3 |
70-| `:nth-child(-n+4)` | |
71-| --- | --- |
72-| `:nth-last-child(2)` | |
73-| `:nth-of-type(2)` | |
74-| --- | --- |
75-| `:checked` | Checked inputs |
76-| `:disabled` | Disabled elements |
77-| `:default` | Default element in a group |
78-| --- | --- |
79-| `:empty` | Elements without children |
80-
81-### Pseudo-class variations
82-
83-| Selector |
84-| ----------------- |
85-| `:first-of-type` |
86-| `:last-of-type` |
87-| `:nth-of-type(2)` |
88-| `:only-of-type` |
89-| --- |
90-| `:first-child` |
91-| `:last-child` |
92-| `:nth-child(2)` |
93-| `:only-child` |
94-{: .-left-align}
95-
96-## Fonts
97-{: .-left-reference}
98-
99-### Properties
100-
101-| Property | Description |
102-| ------------------ | ------------------------------------ |
103-| `font-family:` | `<font>, <fontN>` |
104-| `font-size:` | `<size>` |
105-| `letter-spacing:` | `<size>` |
106-| `line-height:` | `<number>` |
107-| --- | --- |
108-| `font-weight:` | `bold` `normal` |
109-| `font-style:` | `italic` `normal` |
110-| `text-decoration:` | `underline` `none` |
111-| --- | --- |
112-| `text-align:` | `left` `right` `center` `justify` |
113-| `text-transform:` | `capitalize` `uppercase` `lowercase` |
114-{: .-key-values}
115-
116-### Shorthand
117-{: .-prime}
118-
119-| | style | weight | size (required) | | line-height | family |
120-| ------- | -------- | ------ | --------------- | --- | ----------- | ----------------- |
121-| `font:` | `italic` | `400` | `14px` | `/` | `1.5` | `sans-serif` |
122-| | style | weight | size (required) | | line-height | family (required) |
123-{: .-css-breakdown}
124-
125-### Example
126-
127-```css
128-font-family: Arial;
129-font-size: 12pt;
130-line-height: 1.5;
131-letter-spacing: 0.02em;
132-color: #aa3322;
133-```
134-
135-### Case
136-
137-```css
138-text-transform: capitalize; /* Hello */
139-text-transform: uppercase; /* HELLO */
140-text-transform: lowercase; /* hello */
141-```
142-
143-## Background
144-{: .-left-reference}
145-
146-### Properties
147-
148-| Property | Description |
149-| ------------------------ | ---------------------------------------- |
150-| `background:` | _(Shorthand)_ |
151-| --- | --- |
152-| `background-color:` | `<color>` |
153-| `background-image:` | `url(...)` |
154-| `background-position:` | `left/center/right` `top/center/bottom` |
155-| `background-size:` | `cover` `X Y` |
156-| `background-clip:` | `border-box` `padding-box` `content-box` |
157-| `background-repeat:` | `no-repeat` `repeat-x` `repeat-y` |
158-| `background-attachment:` | `scroll` `fixed` `local` |
159-{: .-key-values}
160-
161-### Shorthand
162-
163-| | color | image | positionX | positionY | | size | repeat | attachment |
164-| ------------- | ------ | ------------- | --------- | --------- | --- | -------------- | ----------- | ---------- |
165-| `background:` | `#ff0` | `url(bg.jpg)` | `left` | `top` | `/` | `100px` `auto` | `no-repeat` | `fixed;` |
166-| `background:` | `#abc` | `url(bg.png)` | `center` | `center` | `/` | `cover` | `repeat-x` | `local;` |
167-| | color | image | positionX | positionY | | size | repeat | attachment |
168-{: .-css-breakdown}
169-
170-### Multiple backgrounds
171-
172-```css
173-background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
174- url('background.jpg') center center / cover, #333;
175-```
176-
177-## Animation
178-{: .-left-reference}
179-
180-### Properties
181-
182-| Property | Value |
183-| ---------------------------- | -------------------------------------------------------- |
184-| `animation:` | _(shorthand)_ |
185-| `animation-name:` | `<name>` |
186-| `animation-duration:` | `<time>ms` |
187-| `animation-timing-function:` | `ease` `linear` `ease-in` `ease-out` `ease-in-out` |
188-| `animation-delay:` | `<time>ms` |
189-| `animation-iteration-count:` | `infinite` `<number>` |
190-| `animation-direction:` | `normal` `reverse` `alternate` `alternate-reverse` |
191-| `animation-fill-mode:` | `none` `forwards` `backwards` `both` `initial` `inherit` |
192-| `animation-play-state:` | `normal` `reverse` `alternate` `alternate-reverse` |
193-{: .-key-values}
194-
195-### Shorthand
196-
197-| | name | duration | timing-function | delay | count | direction | fill-mode | play-state |
198-| ------------ | -------- | -------- | --------------- | ------- | ---------- | ------------------- | --------- | ---------- |
199-| `animation:` | `bounce` | `300ms` | `linear` | `100ms` | `infinite` | `alternate-reverse` | `both` | `reverse` |
200-| | name | duration | timing-function | delay | count | direction | fill-mode | play-state |
201-{: .-css-breakdown}
202-
203-### Example
204-
205-```css
206-animation: bounce 300ms linear 0s infinite normal;
207-animation: bounce 300ms linear infinite;
208-animation: bounce 300ms linear infinite alternate-reverse;
209-animation: bounce 300ms linear 2s infinite alternate-reverse forwards normal;
210-```
211-
212-### Event
213-
214-```js
215-.one('webkitAnimationEnd oanimationend msAnimationEnd animationend')
216-```
217-
218-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
219-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,115 +0,0 @@
2----
3-title: Dockerfile
4-category: Devops
5-layout: 2017/sheet
6-prism_languages: [docker]
7-updated: 2019-10-20
8----
9-
10-## Reference
11-{: .-three-column}
12-
13-### Inheritance
14-
15-```docker
16-FROM ruby:2.2.2
17-```
18-
19-### Variables
20-
21-```docker
22-ENV APP_HOME /myapp
23-RUN mkdir $APP_HOME
24-```
25-
26-```docker
27-ARG APP_HOME=""
28-RUN mkdir $APP_HOME
29-```
30-
31-### Initialization
32-
33-```docker
34-RUN bundle install
35-```
36-
37-```docker
38-WORKDIR /myapp
39-```
40-
41-```docker
42-VOLUME ["/data"]
43-# Specification for mount point
44-```
45-
46-```docker
47-ADD file.xyz /file.xyz
48-COPY --chown=user:group host_file.xyz /path/container_file.xyz
49-```
50-
51-### Run commands in strict shell
52-
53-```docker
54-ENV my_var
55-SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
56-
57-# With strict mode:
58-RUN false # fails build like using &&
59-RUN echo "$myvar" # will throw error due to typo
60-RUN true | false # will bail out of pipe
61-```
62-
63-Using `shell` will turn on strict mode for shell commands.
64-
65-### Onbuild
66-
67-```docker
68-ONBUILD RUN bundle install
69-# when used with another file
70-```
71-
72-### Commands
73-
74-```docker
75-EXPOSE 5900
76-CMD ["bundle", "exec", "rails", "server"]
77-```
78-
79-### Entrypoint
80-
81-```docker
82-ENTRYPOINT ["executable", "param1", "param2"]
83-ENTRYPOINT command param1 param2
84-```
85-
86-Configures a container that will run as an executable.
87-
88-```docker
89-ENTRYPOINT exec top -b
90-```
91-
92-This will use shell processing to substitute shell variables, and will ignore any `CMD` or `docker run` command line arguments.
93-
94-### Metadata
95-
96-```docker
97-LABEL version="1.0"
98-```
99-
100-```docker
101-LABEL "com.example.vendor"="ACME Incorporated"
102-LABEL com.example.label-with-value="foo"
103-```
104-
105-```docker
106-LABEL description="This text illustrates \
107-that label-values can span multiple lines."
108-```
109-
110-## See also
111-{: .-one-column}
112-
113-- <https://docs.docker.com/engine/reference/builder/>
114-
115-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
116-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,78 +0,0 @@
2----
3-title: editorconfig
4-layout: 2017/sheet
5-prism_languages: [ini]
6-weight: -1
7-updated: 2019-09-25
8-category: Apps
9----
10-
11-### Short example
12-{: .-prime}
13-
14-```ini
15-# editorconfig.org
16-root = true
17-
18-[*]
19-indent_style = space
20-indent_size = 2
21-tab_width = 2
22-end_of_line = lf
23-charset = utf-8
24-trim_trailing_whitespace = true
25-insert_final_newline = true
26-```
27-
28-This example should be fine for most projects indented by 2 spaces. See: [animate.css editorconfig](https://github.com/daneden/animate.css/blob/master/.editorconfig)
29-
30-### Properties
31-
32-```ini
33-indent_style = {space|tab}
34-indent_size = {4|tab}
35-tab_width = 2
36-end_of_line = {cr|lf|crlf}
37-charset = {utf-8|utf-16be|utf-16le|latin1}
38-trim_trailing_whitespace = false
39-insert_final_newline = true
40-max_line_length = 80
41-```
42-
43-### Full example
44-
45-```ini
46-# top-most EditorConfig file
47-root = true
48-
49-# Unix-style newlines with a newline ending every file
50-[*]
51-end_of_line = lf
52-insert_final_newline = true
53-
54-# 4 space indentation
55-[*.py]
56-indent_style = space
57-indent_size = 4
58-
59-# Tab indentation (no size specified)
60-[*.js]
61-indent_style = tab
62-
63-# Indentation override for all JS under lib directory
64-[lib/**.js]
65-indent_style = space
66-indent_size = 2
67-
68-# Matches the exact files either package.json or .travis.yml
69-[{package.json,.travis.yml}]
70-indent_style = space
71-indent_size = 2
72-```
73-
74-### References
75-
76-- <https://EditorConfig.org>
77-
78-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
79-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,766 +0,0 @@
2----
3-title: Elixir
4-category: Elixir
5-layout: 2017/sheet
6-tags: [New]
7-updated: 2018-07-04
8-weight: -10
9----
10-
11-## Getting started
12-{: .-three-column}
13-
14-### Hello world
15-{: .-prime}
16-
17-```elixir
18-# hello.exs
19-defmodule Greeter do
20- def greet(name) do
21- message = "Hello, " <> name <> "!"
22- IO.puts message
23- end
24-end
25-
26-Greeter.greet("world")
27-```
28-
29-```bash
30-elixir hello.exs
31-# Hello, world!
32-```
33-{: .-setup}
34-
35-### Variables
36-
37-```elixir
38-age = 23
39-```
40-
41-### Maps
42-
43-```elixir
44-user = %{
45- name: "John",
46- city: "Melbourne"
47-}
48-```
49-
50-```elixir
51-IO.puts "Hello, " <> user.name
52-```
53-{: .-setup}
54-
55-### Lists
56-
57-```elixir
58-users = [ "Tom", "Dick", "Harry" ]
59-```
60-{: data-line="1"}
61-
62-```elixir
63-Enum.map(users, fn user ->
64- IO.puts "Hello " <> user
65-end)
66-```
67-
68-### Piping
69-
70-```elixir
71-source
72-|> transform(:hello)
73-|> print()
74-```
75-{: data-line="2,3"}
76-
77-```elixir
78-# Same as:
79-print(transform(source, :hello))
80-```
81-
82-These two are equivalent.
83-
84-### Pattern matching
85-
86-```elixir
87-user = %{name: "Tom", age: 23}
88-%{name: username} = user
89-```
90-{: data-line="2"}
91-
92-This sets `username` to `"Tom"`.
93-
94-### Pattern matching in functions
95-
96-```elixir
97-def greet(%{name: username}) do
98- IO.puts "Hello, " <> username
99-end
100-
101-user = %{name: "Tom", age: 23}
102-```
103-{: data-line="1"}
104-
105-Pattern matching works in function parameters too.
106-
107-Control flow
108-------------
109-{: .-three-column}
110-
111-### If
112-
113-```elixir
114-if false do
115- "This will never be seen"
116-else
117- "This will"
118-end
119-```
120-### Case
121-
122-```elixir
123-case {1, 2, 3} do
124- {4, 5, 6} ->
125- "This clause won't match"
126- {1, x, 3} ->
127- "This will match and bind x to 2"
128- _ ->
129- "This will match any value"
130-end
131-```
132-
133-### Cond
134-
135-```elixir
136-cond do
137- 1 + 1 == 3 ->
138- "I will never be seen"
139- 2 * 5 == 12 ->
140- "Me neither"
141- true ->
142- "But I will (this is essentially an else)"
143-end
144-```
145-
146-### With
147-
148-```elixir
149-with {:ok, {int, _asdf}} <- Integer.parse("123asdf"),
150- {:ok, datetime, _utc_offset} <- DateTime.from_iso8601("2021-10-27T12:00:00Z") do
151- DateTime.add(datetime, int, :second)
152- # optional else clause. if not provided and an error occurs, the error is returned
153-else
154- :error -> "couldn't parse integer string"
155- {:error, :invalid_format} -> "couldn't parse date string"
156- _ -> "this will never get hit because all errors are handled"
157-end
158-```
159-
160-### Errors
161-
162-```elixir
163-try do
164- throw(:hello)
165-catch
166- message -> "Got #{message}."
167-after
168- IO.puts("I'm the after clause.")
169-end
170-```
171-
172-## Types
173-
174-### Primitives
175-
176-| Sample | Type |
177-| --- | --- |
178-| `nil` | Nil/null |
179-| `true` _/_ `false` | Boolean |
180-| --- | --- |
181-| `?a` | Integer (ASCII) |
182-| `23` | Integer |
183-| `3.14` | Float |
184-| --- | --- |
185-| `'hello'` | Charlist |
186-| `<<2, 3>>` | Binary |
187-| `"hello"` | Binary string |
188-| `:hello` | Atom |
189-| --- | --- |
190-| `[a, b]` | List |
191-| `{a, b}` | Tuple |
192-| --- | --- |
193-| `%{a: "hello"}` | Map |
194-| `%MyStruct{a: "hello"}` | Struct |
195-| `fn -> ... end` | Function |
196-
197-### Type checks
198-
199-```elixir
200-is_atom/1
201-is_bitstring/1
202-is_boolean/1
203-is_function/1
204-is_function/2
205-is_integer/1
206-is_float/1
207-```
208-
209-```elixir
210-is_binary/1
211-is_list/1
212-is_map/1
213-is_tuple/1
214-```
215-
216-```elixir
217-is_nil/1
218-is_number/1
219-is_pid/1
220-is_port/1
221-is_reference/1
222-```
223-
224-### Operators
225-
226-```elixir
227-left != right # equal
228-left !== right # match
229-left ++ right # concat lists
230-left <> right # concat string/binary
231-left =~ right # regexp
232-```
233-
234-Modules
235--------
236-
237-### Importing
238-
239-```elixir
240-require Redux # compiles a module
241-import Redux # compiles, and you can use without the `Redux.` prefix
242-
243-use Redux # compiles, and runs Redux.__using__/1
244-use Redux, async: true
245-
246-import Redux, only: [duplicate: 2]
247-import Redux, only: :functions
248-import Redux, only: :macros
249-
250-import Foo.{Bar, Baz}
251-```
252-
253-### Aliases
254-
255-```elixir
256-alias Foo.Bar, as: Bar
257-alias Foo.Bar # same as above
258-
259-alias Foo.{Bar, Baz}
260-```
261-
262-## String
263-
264-### Functions
265-
266-```elixir
267-import String
268-```
269-{: .-setup}
270-
271-```elixir
272-str = "hello"
273-str |> length() # → 5
274-str |> codepoints() # → ["h", "e", "l", "l", "o"]
275-str |> slice(2..-1) # → "llo"
276-str |> split(" ") # → ["hello"]
277-str |> capitalize() # → "Hello"
278-str |> match(regex)
279-```
280-
281-### Inspecting objects
282-
283-```elixir
284-inspect(object, opts \\ [])
285-```
286-```elixir
287-value |> IO.inspect()
288-```
289-```elixir
290-value |> IO.inspect(label: "value")
291-```
292-
293-## Numbers
294-
295-### Operations
296-
297-```elixir
298-abs(n)
299-round(n)
300-rem(a, b) # remainder (modulo)
301-div(a, b) # integer division
302-```
303-
304-### Float
305-
306-```elixir
307-import Float
308-```
309-{: .-setup}
310-
311-```elixir
312-n = 10.3
313-```
314-{: .-setup}
315-
316-```elixir
317-n |> ceil() # → 11.0
318-n |> ceil(2) # → 11.30
319-n |> to_string() # → "1.030000+e01"
320-n |> to_string([decimals: 2, compact: true])
321-```
322-
323-```elixir
324-Float.parse("34") # → { 34.0, "" }
325-```
326-
327-### Integer
328-
329-```elixir
330-import Integer
331-```
332-{: .-setup}
333-
334-```elixir
335-n = 12
336-```
337-{: .-setup}
338-
339-```elixir
340-n |> digits() # → [1, 2]
341-n |> to_charlist() # → '12'
342-n |> to_string() # → "12"
343-n |> is_even()
344-n |> is_odd()
345-```
346-
347-```elixir
348-# Different base:
349-n |> digits(2) # → [1, 1, 0, 0]
350-n |> to_charlist(2) # → '1100'
351-n |> to_string(2) # → "1100"
352-```
353-
354-```elixir
355-parse("12") # → {12, ""}
356-undigits([1, 2]) # → 12
357-```
358-
359-### Type casting
360-
361-```elixir
362-Float.parse("34.1") # → {34.1, ""}
363-Integer.parse("34") # → {34, ""}
364-```
365-
366-```elixir
367-Float.to_string(34.1) # → "3.4100e+01"
368-Float.to_string(34.1, [decimals: 2, compact: true]) # → "34.1"
369-```
370-
371-## Map
372-
373-### Defining
374-
375-```elixir
376-m = %{name: "hi"} # atom keys (:name)
377-m = %{"name" => "hi"} # string keys ("name")
378-```
379-
380-### Updating
381-
382-```elixir
383-import Map
384-```
385-{: .-setup}
386-
387-```elixir
388-m = %{m | name: "yo"} # key must exist
389-```
390-
391-```elixir
392-m |> put(:id, 2) # → %{id: 2, name: "hi"}
393-m |> put_new(:id, 2) # only if `id` doesn't exist (`||=`)
394-```
395-
396-```elixir
397-m |> put(:b, "Banana")
398-m |> merge(%{b: "Banana"})
399-m |> update(:a, &(&1 + 1))
400-m |> update(:a, fun a -> a + 1 end)
401-```
402-
403-```elixir
404-m |> get_and_update(:a, &(&1 || "default"))
405-# → {old, new}
406-```
407-
408-### Deleting
409-
410-```elixir
411-m |> delete(:name) # → %{}
412-m |> pop(:name) # → {"John", %{}}
413-```
414-
415-### Reading
416-
417-```elixir
418-m |> get(:id) # → 1
419-m |> keys() # → [:id, :name]
420-m |> values() # → [1, "hi"]
421-```
422-
423-```elixir
424-m |> to_list() # → [id: 1, name: "hi"]
425- # → [{:id, 1}, {:name, "hi"}]
426-```
427-
428-### Deep
429-
430-```elixir
431-put_in(map, [:b, :c], "Banana")
432-put_in(map[:b][:c], "Banana") # via macros
433-```
434-
435-```elixir
436-get_and_update_in(users, ["john", :age], &{&1, &1 + 1})
437-```
438-
439-### Constructing from lists
440-
441-```elixir
442-Map.new([{:b, 1}, {:a, 2}])
443-Map.new([a: 1, b: 2])
444-Map.new([:a, :b], fn x -> {x, x} end) # → %{a: :a, b: :b}
445-```
446-
447-### Working with structs
448-
449-#### Struct to map
450-
451-```elixir
452-Map.from_struct(%AnyStruct{a: "b"}) # → %{a: "b"}
453-```
454-
455-#### Map to struct
456-
457-```elixir
458-struct(AnyStruct, %{a: "b"}) # → %AnyStruct{a: "b"}
459-```
460-
461-## List
462-
463-```elixir
464-import List
465-```
466-{: .-setup}
467-
468-```elixir
469-l = [ 1, 2, 3, 4 ]
470-```
471-{: .-setup}
472-
473-```elixir
474-l = l ++ [5] # push (append)
475-l = [ 0 | list ] # unshift (prepend)
476-```
477-
478-```elixir
479-l |> first()
480-l |> last()
481-```
482-
483-```elixir
484-l |> flatten()
485-l |> flatten(tail)
486-```
487-
488-Also see [Enum](#enum).
489-
490-
491-## Enum
492-
493-### Usage
494-
495-```elixir
496-import Enum
497-```
498-{: .-setup}
499-
500-```elixir
501-list = [:a, :b, :c]
502-```
503-{: .-setup}
504-
505-```elixir
506-list |> at(0) # → :a
507-list |> count() # → 3
508-list |> empty?() # → false
509-list |> any?() # → true
510-```
511-
512-```elixir
513-list |> concat([:d]) # → [:a, :b, :c, :d]
514-```
515-
516-Also, consider streams instead.
517-
518-### Map/reduce
519-
520-```elixir
521-list |> reduce(fn)
522-list |> reduce(acc, fn)
523-list |> map(fn)
524-list |> reject(fn)
525-list |> any?(fn)
526-list |> empty?(fn)
527-```
528-
529-```elixir
530-[1, 2, 3, 4]
531-|> Enum.reduce(0, fn(x, acc) -> x + acc end)
532-```
533-
534-## Tuple
535-
536-### Tuples
537-
538-```elixir
539-import Tuple
540-```
541-{: .-setup}
542-
543-```elixir
544-t = { :a, :b }
545-```
546-
547-```elixir
548-t |> elem(1) # like tuple[1]
549-t |> put_elem(index, value)
550-t |> tuple_size()
551-```
552-
553-### Keyword lists
554-
555-```elixir
556-list = [{ :name, "John" }, { :age, 15 }]
557-list[:name]
558-```
559-
560-```elixir
561-# For string-keyed keyword lists
562-list = [{"size", 2}, {"type", "shoe"}]
563-List.keyfind(list, "size", 0) # → {"size", 2}
564-```
565-
566-## Functions
567-
568-### Lambdas
569-
570-```elixir
571-square = fn n -> n*n end
572-square.(20)
573-```
574-
575-### & syntax
576-
577-```elixir
578-square = &(&1 * &1)
579-square.(20)
580-
581-square = &Math.square/1
582-```
583-
584-### Running
585-
586-```elixir
587-fun.(args)
588-apply(fun, args)
589-apply(module, fun, args)
590-```
591-
592-### Function heads
593-
594-```elixir
595-def join(a, b \\ nil)
596-def join(a, b) when is_nil(b) do: a
597-def join(a, b) do: a <> b
598-```
599-
600-## Structs
601-
602-### Structs
603-
604-```elixir
605-defmodule User do
606- defstruct name: "", age: nil
607-end
608-
609-%User{name: "John", age: 20}
610-
611-%User{}.struct # → User
612-```
613-
614-See: [Structs](http://elixir-lang.org/getting-started/structs.html)
615-
616-## Protocols
617-
618-### Defining protocols
619-
620-```elixir
621-defprotocol Blank do
622- @doc "Returns true if data is considered blank/empty"
623- def blank?(data)
624-end
625-```
626-
627-```elixir
628-defimpl Blank, for: List do
629- def blank?([]), do: true
630- def blank?(_), do: false
631-end
632-
633-Blank.blank?([]) # → true
634-```
635-
636-### Any
637-
638-```elixir
639-defimpl Blank, for: Any do ... end
640-
641-defmodule User do
642- @derive Blank # Falls back to Any
643- defstruct name: ""
644-end
645-```
646-
647-### Examples
648-
649-- `Enumerable` and `Enum.map()`
650-- `Inspect` and `inspect()`
651-
652-## Comprehensions
653-
654-### For
655-
656-```elixir
657-for n <- [1, 2, 3, 4], do: n * n
658-for n <- 1..4, do: n * n
659-```
660-
661-```elixir
662-for {key, val} <- %{a: 10, b: 20}, do: val
663-# → [10, 20]
664-```
665-
666-```elixir
667-for {key, val} <- %{a: 10, b: 20}, into: %{}, do: {key, val*val}
668-```
669-
670-### Conditions
671-
672-```elixir
673-for n <- 1..10, rem(n, 2) == 0, do: n
674-# → [2, 4, 6, 8, 10]
675-```
676-
677-### Complex
678-
679-```elixir
680-for dir <- dirs,
681- file <- File.ls!(dir), # nested comprehension
682- path = Path.join(dir, file), # invoked
683- File.regular?(path) do # condition
684- IO.puts(file)
685-end
686-```
687-
688-## Misc
689-
690-### Metaprogramming
691-
692-```elixir
693-__MODULE__
694-__MODULE__.__info__
695-
696-@after_compile __MODULE__
697-def __before_compile__(env)
698-def __after_compile__(env, _bytecode)
699-def __using__(opts) # invoked on `use`
700-
701-@on_definition {__MODULE__, :on_def}
702-def on_def(_env, kind, name, args, guards, body)
703-
704-@on_load :load_check
705-def load_check
706-```
707-
708-### Regexp
709-
710-```elixir
711-exp = ~r/hello/
712-exp = ~r/hello/i
713-"hello world" =~ exp
714-```
715-
716-### Sigils
717-
718-```elixir
719-~r/regexp/
720-~w(list of strings)
721-~s|strings with #{interpolation} and \x20 escape codes|
722-~S|no interpolation and no escapes|
723-~c(charlist)
724-```
725-
726-Allowed chars: `/` `|` `"` `'` `(` `[` `{` `<` `"""`.
727-See: [Sigils](http://elixir-lang.org/getting-started/sigils.html)
728-
729-### Type specs
730-
731-```elixir
732-@spec round(number) :: integer
733-
734-@type number_with_remark :: {number, String.t}
735-@spec add(number, number) :: number_with_remark
736-```
737-
738-Useful for [dialyzer](http://www.erlang.org/doc/man/dialyzer.html).
739-See: [Typespecs](http://elixir-lang.org/getting-started/typespecs-and-behaviours.html)
740-
741-### Behaviours
742-
743-```elixir
744-defmodule Parser do
745- @callback parse(String.t) :: any
746- @callback extensions() :: [String.t]
747-end
748-```
749-
750-```elixir
751-defmodule JSONParser do
752- @behaviour Parser
753-
754- def parse(str), do: # ... parse JSON
755- def extensions, do: ["json"]
756-end
757-```
758-
759-See: [Module](http://elixir-lang.org/docs/stable/elixir/Module.html)
760-
761-## References
762-{: .-one-column}
763-
764-- [Learn Elixir in Y minutes](https://learnxinyminutes.com/docs/elixir/)
765-
766-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
767-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,582 +0,0 @@
2----
3-title: ES2015+
4-category: JavaScript
5-layout: 2017/sheet
6-tags: [Featured]
7-updated: 2019-11-14
8-weight: -10
9-intro: |
10- A quick overview of new JavaScript features in ES2015, ES2016, ES2017, ES2018 and beyond.
11----
12-
13-### Block scoping
14-
15-#### Let
16-
17-```js
18-function fn () {
19- let x = 0
20- if (true) {
21- let x = 1 // only inside this `if`
22- }
23-}
24-```
25-{: data-line="2,4"}
26-
27-#### Const
28-
29-```js
30-const a = 1
31-```
32-
33-`let` is the new `var`. Constants work just like `let`, but can't be reassigned.
34-See: [Let and const](https://babeljs.io/learn-es2015/#let--const)
35-
36-### Backtick strings
37-
38-#### Interpolation
39-
40-```js
41-const message = `Hello ${name}`
42-```
43-
44-#### Multiline strings
45-
46-```js
47-const str = `
48-hello
49-world
50-`
51-```
52-
53-Templates and multiline strings.
54-See: [Template strings](https://babeljs.io/learn-es2015/#template-strings)
55-
56-### Binary and octal literals
57-
58-```js
59-let bin = 0b1010010
60-let oct = 0o755
61-```
62-
63-See: [Binary and octal literals](https://babeljs.io/learn-es2015/#binary-and-octal-literals)
64-
65-### New methods
66-
67-#### New string methods
68-
69-```js
70-"hello".repeat(3)
71-"hello".includes("ll")
72-"hello".startsWith("he")
73-"hello".padStart(8) // " hello"
74-"hello".padEnd(8) // "hello "
75-"hello".padEnd(8, '!') // hello!!!
76-"\u1E9B\u0323".normalize("NFC")
77-```
78-
79-See: [New methods](https://babeljs.io/learn-es2015/#math--number--string--object-apis)
80-
81-### Classes
82-
83-```js
84-class Circle extends Shape {
85-```
86-
87-#### Constructor
88-
89-```js
90- constructor (radius) {
91- this.radius = radius
92- }
93-```
94-{: data-line="1"}
95-
96-#### Methods
97-
98-```js
99- getArea () {
100- return Math.PI * 2 * this.radius
101- }
102-```
103-{: data-line="1"}
104-
105-#### Calling superclass methods
106-
107-```js
108- expand (n) {
109- return super.expand(n) * Math.PI
110- }
111-```
112-{: data-line="2"}
113-
114-#### Static methods
115-
116-```js
117- static createFromDiameter(diameter) {
118- return new Circle(diameter / 2)
119- }
120-}
121-```
122-{: data-line="1"}
123-
124-Syntactic sugar for prototypes.
125-See: [Classes](https://babeljs.io/learn-es2015/#classes)
126-
127-### Exponent operator
128-
129-```js
130-const byte = 2 ** 8
131-// Same as: Math.pow(2, 8)
132-```
133-{: data-line="1"}
134-
135-Promises
136---------
137-{: .-three-column}
138-
139-### Making promises
140-
141-```js
142-new Promise((resolve, reject) => {
143- if (ok) { resolve(result) }
144- else { reject(error) }
145-})
146-```
147-{: data-line="1"}
148-
149-For asynchronous programming.
150-See: [Promises](https://babeljs.io/learn-es2015/#promises)
151-
152-### Using promises
153-
154-```js
155-promise
156- .then((result) => { ··· })
157- .catch((error) => { ··· })
158-```
159-{: data-line="2,3"}
160-
161-
162-### Using promises with finally
163-
164-```js
165-promise
166- .then((result) => { ··· })
167- .catch((error) => { ··· })
168- .finally(() => { // logic independent of success/error })
169-```
170-{: data-line="4"}
171-
172-The handler is called when the promise is fulfilled or rejected.
173-
174-
175-### Promise functions
176-
177-```js
178-Promise.all(···)
179-Promise.race(···)
180-Promise.reject(···)
181-Promise.resolve(···)
182-```
183-
184-### Async-await
185-
186-```js
187-async function run () {
188- const user = await getUser()
189- const tweets = await getTweets(user)
190- return [user, tweets]
191-}
192-```
193-{: data-line="2,3"}
194-
195-`async` functions are another way of using functions.
196-
197-See: [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)
198-
199-Destructuring
200--------------
201-{: .-three-column}
202-
203-### Destructuring assignment
204-
205-#### Arrays
206-
207-```js
208-const [first, last] = ['Nikola', 'Tesla']
209-```
210-{: data-line="1"}
211-
212-#### Objects
213-
214-```js
215-let {title, author} = {
216- title: 'The Silkworm',
217- author: 'R. Galbraith'
218-}
219-```
220-{: data-line="1"}
221-
222-Supports for matching arrays and objects.
223-See: [Destructuring](https://babeljs.io/learn-es2015/#destructuring)
224-
225-### Default values
226-
227-```js
228-const scores = [22, 33]
229-const [math = 50, sci = 50, arts = 50] = scores
230-```
231-
232-```js
233-// Result:
234-// math === 22, sci === 33, arts === 50
235-```
236-
237-Default values can be assigned while destructuring arrays or objects.
238-
239-### Function arguments
240-
241-```js
242-function greet({ name, greeting }) {
243- console.log(`${greeting}, ${name}!`)
244-}
245-```
246-{: data-line="1"}
247-
248-```js
249-greet({ name: 'Larry', greeting: 'Ahoy' })
250-```
251-
252-Destructuring of objects and arrays can also be done in function arguments.
253-
254-### Default values
255-
256-```js
257-function greet({ name = 'Rauno' } = {}) {
258- console.log(`Hi ${name}!`);
259-}
260-```
261-{: data-line="1"}
262-
263-```js
264-greet() // Hi Rauno!
265-greet({ name: 'Larry' }) // Hi Larry!
266-```
267-
268-### Reassigning keys
269-
270-```js
271-function printCoordinates({ left: x, top: y }) {
272- console.log(`x: ${x}, y: ${y}`)
273-}
274-```
275-{: data-line="1"}
276-
277-```js
278-printCoordinates({ left: 25, top: 90 })
279-```
280-
281-This example assigns `x` to the value of the `left` key.
282-
283-### Loops
284-
285-```js
286-for (let {title, artist} of songs) {
287- ···
288-}
289-```
290-{: data-line="1"}
291-
292-The assignment expressions work in loops, too.
293-
294-
295-### Object destructuring
296-
297-```js
298-const { id, ...detail } = song;
299-```
300-{: data-line="1"}
301-
302-Extract some keys individually and remaining keys in the object using rest (...) operator
303-
304-
305-Spread
306-------
307-
308-### Object spread
309-
310-#### with Object spread
311-
312-```js
313-const options = {
314- ...defaults,
315- visible: true
316-}
317-```
318-{: data-line="2"}
319-
320-#### without Object spread
321-
322-```js
323-const options = Object.assign(
324- {}, defaults,
325- { visible: true })
326-```
327-
328-The Object spread operator lets you build new objects from other objects.
329-
330-See: [Object spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator)
331-
332-### Array spread
333-
334-#### with Array spread
335-
336-```js
337-const users = [
338- ...admins,
339- ...editors,
340- 'rstacruz'
341-]
342-```
343-{: data-line="2,3"}
344-
345-#### without Array spread
346-
347-```js
348-const users = admins
349- .concat(editors)
350- .concat([ 'rstacruz' ])
351-```
352-
353-The spread operator lets you build new arrays in the same way.
354-
355-See: [Spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator)
356-
357-Functions
358----------
359-
360-### Function arguments
361-
362-#### Default arguments
363-
364-```js
365-function greet (name = 'Jerry') {
366- return `Hello ${name}`
367-}
368-```
369-{: data-line="1"}
370-
371-#### Rest arguments
372-
373-```js
374-function fn(x, ...y) {
375- // y is an Array
376- return x * y.length
377-}
378-```
379-{: data-line="1"}
380-
381-#### Spread
382-
383-```js
384-fn(...[1, 2, 3])
385-// same as fn(1, 2, 3)
386-```
387-{: data-line="1"}
388-
389-Default, rest, spread.
390-See: [Function arguments](https://babeljs.io/learn-es2015/#default--rest--spread)
391-
392-### Fat arrows
393-
394-#### Fat arrows
395-
396-```js
397-setTimeout(() => {
398- ···
399-})
400-```
401-{: data-line="1"}
402-
403-#### With arguments
404-
405-```js
406-readFile('text.txt', (err, data) => {
407- ...
408-})
409-```
410-{: data-line="1"}
411-
412-#### Implicit return
413-```js
414-numbers.map(n => n * 2)
415-// No curly braces = implicit return
416-// Same as: numbers.map(function (n) { return n * 2 })
417-numbers.map(n => ({
418- result: n * 2
419-}))
420-// Implicitly returning objects requires parentheses around the object
421-```
422-{: data-line="1,4,5,6"}
423-
424-Like functions but with `this` preserved.
425-See: [Fat arrows](https://babeljs.io/learn-es2015/#arrows-and-lexical-this)
426-
427-Objects
428--------
429-
430-### Shorthand syntax
431-
432-```js
433-module.exports = { hello, bye }
434-// Same as: module.exports = { hello: hello, bye: bye }
435-```
436-
437-See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals)
438-
439-### Methods
440-
441-```js
442-const App = {
443- start () {
444- console.log('running')
445- }
446-}
447-// Same as: App = { start: function () {···} }
448-```
449-{: data-line="2"}
450-
451-See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals)
452-
453-### Getters and setters
454-
455-```js
456-const App = {
457- get closed () {
458- return this.status === 'closed'
459- },
460- set closed (value) {
461- this.status = value ? 'closed' : 'open'
462- }
463-}
464-```
465-{: data-line="2,5"}
466-
467-See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals)
468-
469-### Computed property names
470-
471-```js
472-let event = 'click'
473-let handlers = {
474- [`on${event}`]: true
475-}
476-// Same as: handlers = { 'onclick': true }
477-```
478-{: data-line="3"}
479-
480-See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals)
481-
482-
483-### Extract values
484-
485-```js
486-const fatherJS = { age: 57, name: "Brendan Eich" }
487-
488-Object.values(fatherJS)
489-// [57, "Brendan Eich"]
490-Object.entries(fatherJS)
491-// [["age", 57], ["name", "Brendan Eich"]]
492-```
493-{: data-line="3,5"}
494-
495-
496-Modules
497--------
498-
499-### Imports
500-
501-```js
502-import 'helpers'
503-// aka: require('···')
504-```
505-
506-```js
507-import Express from 'express'
508-// aka: const Express = require('···').default || require('···')
509-```
510-
511-```js
512-import { indent } from 'helpers'
513-// aka: const indent = require('···').indent
514-```
515-
516-```js
517-import * as Helpers from 'helpers'
518-// aka: const Helpers = require('···')
519-```
520-
521-```js
522-import { indentSpaces as indent } from 'helpers'
523-// aka: const indent = require('···').indentSpaces
524-```
525-
526-`import` is the new `require()`.
527-See: [Module imports](https://babeljs.io/learn-es2015/#modules)
528-
529-### Exports
530-
531-```js
532-export default function () { ··· }
533-// aka: module.exports.default = ···
534-```
535-
536-```js
537-export function mymethod () { ··· }
538-// aka: module.exports.mymethod = ···
539-```
540-
541-```js
542-export const pi = 3.14159
543-// aka: module.exports.pi = ···
544-```
545-
546-`export` is the new `module.exports`.
547-See: [Module exports](https://babeljs.io/learn-es2015/#modules)
548-
549-Generators
550-----------
551-
552-### Generators
553-
554-```js
555-function* idMaker () {
556- let id = 0
557- while (true) { yield id++ }
558-}
559-```
560-
561-```js
562-let gen = idMaker()
563-gen.next().value // → 0
564-gen.next().value // → 1
565-gen.next().value // → 2
566-```
567-
568-It's complicated.
569-See: [Generators](https://babeljs.io/learn-es2015/#generators)
570-
571-### For..of iteration
572-
573-```js
574-for (let i of iterable) {
575- ···
576-}
577-```
578-
579-For iterating through generators and arrays.
580-See: [For..of iteration](https://babeljs.io/learn-es2015/#iterators--forof)
581-
582-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
583-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,658 +0,0 @@
2----
3-title: Go
4-layout: 2017/sheet
5-prism_languages: [go, bash]
6-weight: -3
7-tags: [Featured]
8-category: C-like
9-updated: 2020-06-21
10----
11-
12-## Getting started
13-{: .-three-column}
14-
15-### Introduction
16-{: .-intro}
17-
18-- [A tour of Go](https://tour.golang.org/welcome/1) _(tour.golang.org)_
19-- [Go repl](https://repl.it/languages/go) _(repl.it)_
20-- [Golang wiki](https://github.com/golang/go/wiki/) _(github.com)_
21-
22-### Hello world
23-{: .-prime}
24-
25-#### hello.go
26-{: .-file}
27-
28-```go
29-package main
30-
31-import "fmt"
32-
33-func main() {
34- message := greetMe("world")
35- fmt.Println(message)
36-}
37-
38-func greetMe(name string) string {
39- return "Hello, " + name + "!"
40-}
41-```
42-
43-```bash
44-$ go build
45-```
46-
47-Or try it out in the [Go repl](https://repl.it/languages/go), or [A Tour of Go](https://tour.golang.org/welcome/1).
48-
49-### Variables
50-
51-#### Variable declaration
52-
53-```go
54-var msg string
55-msg = "Hello"
56-```
57-
58-#### Shortcut of above (Infers type)
59-
60-```go
61-msg := "Hello"
62-```
63-
64-### Constants
65-
66-```go
67-const Phi = 1.618
68-```
69-
70-Constants can be character, string, boolean, or numeric values.
71-
72-See: [Constants](https://tour.golang.org/basics/15)
73-
74-## Basic types
75-{: .-three-column}
76-
77-### Strings
78-
79-```go
80-str := "Hello"
81-```
82-
83-```go
84-str := `Multiline
85-string`
86-```
87-
88-Strings are of type `string`.
89-
90-### Numbers
91-
92-#### Typical types
93-
94-```go
95-num := 3 // int
96-num := 3. // float64
97-num := 3 + 4i // complex128
98-num := byte('a') // byte (alias for uint8)
99-```
100-
101-#### Other types
102-
103-```go
104-var u uint = 7 // uint (unsigned)
105-var p float32 = 22.7 // 32-bit float
106-```
107-
108-### Arrays
109-
110-```go
111-// var numbers [5]int
112-numbers := [...]int{0, 0, 0, 0, 0}
113-```
114-
115-Arrays have a fixed size.
116-
117-### Slices
118-
119-```go
120-slice := []int{2, 3, 4}
121-```
122-
123-```go
124-slice := []byte("Hello")
125-```
126-
127-Slices have a dynamic size, unlike arrays.
128-
129-### Pointers
130-
131-```go
132-func main () {
133- b := *getPointer()
134- fmt.Println("Value is", b)
135-}
136-```
137-{: data-line="2"}
138-
139-```go
140-func getPointer () (myPointer *int) {
141- a := 234
142- return &a
143-}
144-```
145-{: data-line="3"}
146-
147-```go
148-a := new(int)
149-*a = 234
150-```
151-{: data-line="2"}
152-
153-Pointers point to a memory location of a variable. Go is fully garbage-collected.
154-
155-See: [Pointers](https://tour.golang.org/moretypes/1)
156-
157-### Type conversions
158-
159-```go
160-i := 2
161-f := float64(i)
162-u := uint(i)
163-```
164-
165-See: [Type conversions](https://tour.golang.org/basics/13)
166-
167-## Flow control
168-{: .-three-column}
169-
170-### Conditional
171-
172-```go
173-if day == "sunday" || day == "saturday" {
174- rest()
175-} else if day == "monday" && isTired() {
176- groan()
177-} else {
178- work()
179-}
180-```
181-{: data-line="1,3,5"}
182-
183-See: [If](https://tour.golang.org/flowcontrol/5)
184-
185-### Statements in if
186-
187-```go
188-if _, err := doThing(); err != nil {
189- fmt.Println("Uh oh")
190-}
191-```
192-{: data-line="1"}
193-
194-A condition in an `if` statement can be preceded with a statement before a `;`. Variables declared by the statement are only in scope until the end of the `if`.
195-
196-See: [If with a short statement](https://tour.golang.org/flowcontrol/6)
197-
198-### Switch
199-
200-```go
201-switch day {
202- case "sunday":
203- // cases don't "fall through" by default!
204- fallthrough
205-
206- case "saturday":
207- rest()
208-
209- default:
210- work()
211-}
212-```
213-
214-See: [Switch](https://github.com/golang/go/wiki/Switch)
215-
216-### For loop
217-
218-```go
219-for count := 0; count <= 10; count++ {
220- fmt.Println("My counter is at", count)
221-}
222-```
223-
224-See: [For loops](https://tour.golang.org/flowcontrol/1)
225-
226-### For-Range loop
227-
228-```go
229-entry := []string{"Jack","John","Jones"}
230-for i, val := range entry {
231- fmt.Printf("At position %d, the character %s is present\n", i, val)
232-}
233-```
234-
235-See: [For-Range loops](https://gobyexample.com/range)
236-
237-### While loop
238-
239-```go
240-n := 0
241-x := 42
242-for n != x {
243- n := guess()
244-}
245-```
246-
247-See: [Go's "while"](https://tour.golang.org/flowcontrol/3)
248-
249-## Functions
250-{: .-three-column}
251-
252-### Lambdas
253-
254-```go
255-myfunc := func() bool {
256- return x > 10000
257-}
258-```
259-{: data-line="1"}
260-
261-Functions are first class objects.
262-
263-### Multiple return types
264-
265-```go
266-a, b := getMessage()
267-```
268-
269-```go
270-func getMessage() (a string, b string) {
271- return "Hello", "World"
272-}
273-```
274-{: data-line="2"}
275-
276-
277-### Named return values
278-
279-```go
280-func split(sum int) (x, y int) {
281- x = sum * 4 / 9
282- y = sum - x
283- return
284-}
285-```
286-{: data-line="4"}
287-
288-By defining the return value names in the signature, a `return` (no args) will return variables with those names.
289-
290-See: [Named return values](https://tour.golang.org/basics/7)
291-
292-## Packages
293-{: .-three-column}
294-
295-### Importing
296-
297-```go
298-import "fmt"
299-import "math/rand"
300-```
301-
302-```go
303-import (
304- "fmt" // gives fmt.Println
305- "math/rand" // gives rand.Intn
306-)
307-```
308-
309-Both are the same.
310-
311-See: [Importing](https://tour.golang.org/basics/1)
312-
313-### Aliases
314-
315-```go
316-import r "math/rand"
317-```
318-{: data-line="1"}
319-
320-```go
321-r.Intn()
322-```
323-
324-### Exporting names
325-
326-```go
327-func Hello () {
328- ···
329-}
330-```
331-
332-Exported names begin with capital letters.
333-
334-See: [Exported names](https://tour.golang.org/basics/3)
335-
336-### Packages
337-
338-```go
339-package hello
340-```
341-
342-Every package file has to start with `package`.
343-
344-## Concurrency
345-{: .-three-column}
346-
347-### Goroutines
348-
349-```go
350-func main() {
351- // A "channel"
352- ch := make(chan string)
353-
354- // Start concurrent routines
355- go push("Moe", ch)
356- go push("Larry", ch)
357- go push("Curly", ch)
358-
359- // Read 3 results
360- // (Since our goroutines are concurrent,
361- // the order isn't guaranteed!)
362- fmt.Println(<-ch, <-ch, <-ch)
363-}
364-```
365-{: data-line="3,6,7,8,13"}
366-
367-```go
368-func push(name string, ch chan string) {
369- msg := "Hey, " + name
370- ch <- msg
371-}
372-```
373-{: data-line="3"}
374-
375-Channels are concurrency-safe communication objects, used in goroutines.
376-
377-See: [Goroutines](https://tour.golang.org/concurrency/1), [Channels](https://tour.golang.org/concurrency/2)
378-
379-### Buffered channels
380-
381-```go
382-ch := make(chan int, 2)
383-ch <- 1
384-ch <- 2
385-ch <- 3
386-// fatal error:
387-// all goroutines are asleep - deadlock!
388-```
389-{: data-line="1"}
390-
391-Buffered channels limit the amount of messages it can keep.
392-
393-See: [Buffered channels](https://tour.golang.org/concurrency/3)
394-
395-### Closing channels
396-
397-#### Closes a channel
398-
399-```go
400-ch <- 1
401-ch <- 2
402-ch <- 3
403-close(ch)
404-```
405-{: data-line="4"}
406-
407-#### Iterates across a channel until its closed
408-
409-```go
410-for i := range ch {
411- ···
412-}
413-```
414-{: data-line="1"}
415-
416-#### Closed if `ok == false`
417-
418-```go
419-v, ok := <- ch
420-```
421-
422-See: [Range and close](https://tour.golang.org/concurrency/4)
423-
424-### WaitGroup
425-
426-```go
427-import "sync"
428-
429-func main() {
430- var wg sync.WaitGroup
431-
432- for _, item := range itemList {
433- // Increment WaitGroup Counter
434- wg.Add(1)
435- go doOperation(&wg, item)
436- }
437- // Wait for goroutines to finish
438- wg.Wait()
439-
440-}
441-```
442-{: data-line="1,4,8,12"}
443-
444-```go
445-func doOperation(wg *sync.WaitGroup, item string) {
446- defer wg.Done()
447- // do operation on item
448- // ...
449-}
450-```
451-{: data-line="2"}
452-
453-A WaitGroup waits for a collection of goroutines to finish. The main goroutine calls Add to set the number of goroutines to wait for. The goroutine calls `wg.Done()` when it finishes.
454-See: [WaitGroup](https://golang.org/pkg/sync/#WaitGroup)
455-
456-
457-## Error control
458-
459-### Defer
460-
461-```go
462-func main() {
463- defer fmt.Println("Done")
464- fmt.Println("Working...")
465-}
466-```
467-{: data-line="2"}
468-
469-Defers running a function until the surrounding function returns.
470-The arguments are evaluated immediately, but the function call is not ran until later.
471-
472-See: [Defer, panic and recover](https://blog.golang.org/defer-panic-and-recover)
473-
474-### Deferring functions
475-
476-```go
477-func main() {
478- defer func() {
479- fmt.Println("Done")
480- }()
481- fmt.Println("Working...")
482-}
483-```
484-{: data-line="2,3,4"}
485-
486-Lambdas are better suited for defer blocks.
487-
488-```go
489-func main() {
490- var d = int64(0)
491- defer func(d *int64) {
492- fmt.Printf("& %v Unix Sec\n", *d)
493- }(&d)
494- fmt.Print("Done ")
495- d = time.Now().Unix()
496-}
497-```
498-{: data-line="3,4,5"}
499-The defer func uses current value of d, unless we use a pointer to get final value at end of main.
500-
501-## Structs
502-{: .-three-column}
503-
504-### Defining
505-
506-```go
507-type Vertex struct {
508- X int
509- Y int
510-}
511-```
512-{: data-line="1,2,3,4"}
513-
514-```go
515-func main() {
516- v := Vertex{1, 2}
517- v.X = 4
518- fmt.Println(v.X, v.Y)
519-}
520-```
521-
522-See: [Structs](https://tour.golang.org/moretypes/2)
523-
524-### Literals
525-
526-```go
527-v := Vertex{X: 1, Y: 2}
528-```
529-
530-```go
531-// Field names can be omitted
532-v := Vertex{1, 2}
533-```
534-
535-```go
536-// Y is implicit
537-v := Vertex{X: 1}
538-```
539-
540-You can also put field names.
541-
542-### Pointers to structs
543-
544-```go
545-v := &Vertex{1, 2}
546-v.X = 2
547-```
548-
549-Doing `v.X` is the same as doing `(*v).X`, when `v` is a pointer.
550-
551-## Methods
552-
553-### Receivers
554-
555-```go
556-type Vertex struct {
557- X, Y float64
558-}
559-```
560-
561-```go
562-func (v Vertex) Abs() float64 {
563- return math.Sqrt(v.X * v.X + v.Y * v.Y)
564-}
565-```
566-{: data-line="1"}
567-
568-```go
569-v := Vertex{1, 2}
570-v.Abs()
571-```
572-
573-There are no classes, but you can define functions with _receivers_.
574-
575-See: [Methods](https://tour.golang.org/methods/1)
576-
577-### Mutation
578-
579-```go
580-func (v *Vertex) Scale(f float64) {
581- v.X = v.X * f
582- v.Y = v.Y * f
583-}
584-```
585-{: data-line="1"}
586-
587-```go
588-v := Vertex{6, 12}
589-v.Scale(0.5)
590-// `v` is updated
591-```
592-
593-By defining your receiver as a pointer (`*Vertex`), you can do mutations.
594-
595-See: [Pointer receivers](https://tour.golang.org/methods/4)
596-
597-## Interfaces
598-
599-### A basic interface
600-
601-```go
602-type Shape interface {
603- Area() float64
604- Perimeter() float64
605-}
606-```
607-
608-### Struct
609-
610-```go
611-type Rectangle struct {
612- Length, Width float64
613-}
614-```
615-
616-Struct `Rectangle` implicitly implements interface `Shape` by implementing all of its methods.
617-
618-### Methods
619-
620-```go
621-func (r Rectangle) Area() float64 {
622- return r.Length * r.Width
623-}
624-
625-func (r Rectangle) Perimeter() float64 {
626- return 2 * (r.Length + r.Width)
627-}
628-```
629-
630-The methods defined in `Shape` are implemented in `Rectangle`.
631-
632-### Interface example
633-
634-```go
635-func main() {
636- var r Shape = Rectangle{Length: 3, Width: 4}
637- fmt.Printf("Type of r: %T, Area: %v, Perimeter: %v.", r, r.Area(), r.Perimeter())
638-}
639-```
640-
641-## References
642-
643-### Official resources
644-{: .-intro}
645-
646-- [A tour of Go](https://tour.golang.org/welcome/1) _(tour.golang.org)_
647-- [Golang wiki](https://github.com/golang/go/wiki/) _(github.com)_
648-- [Effective Go](https://golang.org/doc/effective_go.html) _(golang.org)_
649-
650-### Other links
651-{: .-intro}
652-
653-- [Go by Example](https://gobyexample.com/) _(gobyexample.com)_
654-- [Awesome Go](https://awesome-go.com/) _(awesome-go.com)_
655-- [JustForFunc Youtube](https://www.youtube.com/channel/UC_BzFbxG2za3bp5NRRRXJSw) _(youtube.com)_
656-- [Style Guide](https://github.com/golang/go/wiki/CodeReviewComments) _(github.com)_
657-
658-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
659-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,1277 +0,0 @@
2----
3-title: Goby
4-layout: 2017/sheet
5-prism_languages: [ruby]
6-weight: -3
7-updated: 2018-12-06
8-category: Ruby
9-intro: |
10- Goby's language design is based on Ruby language's, slim and shaped up. Differences in syntax between them is very small.
11----
12-
13-
14-## Getting started
15-
16-### Hello world
17-{: .-prime}
18-
19-#### hello.gb
20-{: .-file}
21-
22-```ruby
23-class Greet
24- attr_accessor :audience, :head, :tail
25-
26- def initialize
27- @head = "Hello, "
28- @tail = "!"
29- end
30-
31- def name
32- audience.name
33- end
34-
35- def say
36- puts head + name + tail
37- end
38-end
39-
40-module MyName
41- attr_reader :name
42-
43- def initialize
44- @name = self.class.to_s
45- end
46-end
47-
48-class World
49- include MyName
50-end
51-
52-greet = Greet.new
53-greet.audience = World.new
54-greet.say
55-```
56-
57-Then run:
58-
59-```bash
60-$ goby hello.gb
61-#=> Hello, World!
62-```
63-
64-### REPL (igb)
65-
66-```bash
67-$ goby -i
68-```
69-
70-* `reset`: reset the VM
71-* `exit`: exit REPL
72-* `help`: show help
73-* ctrl-c: cancel the block entered, or exit (on top level)
74-
75-See [igb manual & test script](https://github.com/goby-lang/goby/blob/master/igb/manual_test.md). You can use `readline` features such as command history by arrow keys.
76-
77-## Variables
78-{: .-three-column}
79-
80-### Local variable
81-
82-```ruby
83-zip101 = "233-7383"
84-magic_number = 42
85-```
86-
87-Should be "`[a-z][a-z0-9_]+`"(snake_case).
88-
89-### Instance variable
90-
91-```ruby
92-module State
93- def initialize(state)
94- @state = state # declaring an instance variable by assignment
95- end
96- def show
97- @state # accessible from other instance methods
98- end
99-end
100-
101-state = State.new "success"
102-state.show
103-#=> success
104-```
105-
106-Should be "`@[a-z][a-z0-9_]+`"(snake_case).
107-
108-### Multiple assignment
109-
110-```ruby
111-# array literal
112-a, b, c = [1, 2, 3]
113-
114-# array with '*'
115-a = [1, 2, 3]
116-x, y, z = *a
117-
118-# array literal with '*'
119-a, b, c = *[1, 2, 3]
120-
121-# bare assignment: unsupported
122-a, b, c = 1, 2, 3 #=> unexpected 3 Line: 0
123-```
124-
125-### Black hole variable
126-
127-```ruby
128-# '_' is write-only
129-a, _ = [1, 2]
130-```
131-
132-### Class variable
133-
134-Unsupported.
135-
136-### Global variable
137-
138-Unsupported.
139-
140-## Method definition
141-
142-### Method definition and calling
143-
144-```ruby
145-def foo_bar?(baz)
146- if baz == "Hi, Goby!"
147- true
148- else
149- false
150- end
151-end
152-
153-foo_bar? "Hi, Goby!" #=> true
154-```
155-
156-Method name should be "`[a-z][a-z0-9_]+\??`" (snake_case). You can omit the trailing "`()`" only if no parameters are taken. Trailing using "`!`" is **unsupported**.
157-
158-### Order of method parameter
159-
160-```ruby
161-def foo(normal, default="value", hash={}, ary=[], keyword:, keyword_default:"key", *sprat)
162-end
163-```
164-
165-If a default value is provided to a parameter, the parameter can be omitted when calling. `()` can be omitted. The order of parameters in method definition is restricted as follows:
166-
167-1. **normal parameters** (like `a`)
168-2. **normal parameters with default value** (like `a=1`)
169-3. **optional parameters** (array or hash, like `ary=[]` or `hs={}`)
170-4. **keyword parameters** (like `kwd:`)
171-5. **keyword parameters with default value** (like `kwd: 1` or `ary: [1,2,3]` or `hsh: {key: "value"}`)
172-6. **splat parameters** (like `*sp`)
173-
174-Or you will receive an error.
175-
176-### Keyword parameter (WIP)
177-
178-```ruby
179-def foo(process:, verb: :GET, opt:{ csp: :enabled }, ary: [1, 2, 3])
180-end
181-```
182-
183-### Returning value
184-
185-```ruby
186-PI = 3.14
187-def area(radius)
188- radius * PI # returns the result of evaluation
189-end
190-
191-area 6 #=> 18.84
192-```
193-
194-### Returning multiple value
195-
196-```ruby
197-def my_array
198- [1, 2, 3]
199-end
200-
201-my_array #=> [1, 2, 3]
202-```
203-
204-### Instance method
205-
206-```ruby
207-module Foo
208- def bar # defining instance method
209- puts "bar"
210- end
211-
212- def baz(count, email: "goby@example.com")
213- count.times do
214- puts email
215- end
216- end
217-end
218-
219-foo = Foo.new
220-foo.bar #=> bar
221-foo.baz(3) #↓
222-goby@example.com
223-goby@example.com
224-goby@example.com
225-```
226-
227-### Singleton method #1
228-
229-```ruby
230-str = "Goby"
231-def str.foo #1 singleton method on the object
232- self * 2
233-end
234-
235-str.foo
236-#=> GobyGoby
237-```
238-
239-### Singleton method #2
240-
241-```ruby
242-module Foo
243- def self.bar #2 singleton method with `self.`
244- 92
245- end
246-end
247-```
248-
249-### Singleton method #3
250-
251-```ruby
252-module Foo
253- def Foo.bar #3 singleton method with a class name (unrecommended)
254- 88
255- end
256-end
257-```
258-
259-### Singleton method #4
260-
261-```ruby
262-module Foo end
263-
264-def Foo.bar #4 singleton methods outside the Foo
265- 9999
266-end
267-
268-Foo.bar #=> 9999
269-```
270-
271-### Attribute accessor method
272-
273-```ruby
274-class Foo
275- attr_accessor :bar, :baz
276-
277- def initialize
278- @bar = 42
279- @baz = 99
280- end
281-end
282-
283-foo = Foo.new
284-
285-foo.bar = 77
286-foo.baz = 88
287-```
288-
289-You can use the following shorthands to declare attribute accessor methods in classes/modules:
290-
291-* `attr_accessor`
292-* `attr_reader`
293-* `attr_writer`
294-
295-### Private method (to be implemented)
296-
297-```ruby
298-class Foo
299- def bar
300- 42
301- end
302-
303- def _baz # leading '_' means private method
304- 99
305- end
306-end
307-```
308-
309-## Module/Class definition
310-{: .-three-column}
311-
312-### Module definition and `include`
313-
314-```ruby
315-module Foo
316- def foo
317- "Foo's instance method"
318- end
319-end
320-
321-class Bar
322- include Foo # to include Foo
323-end
324-
325-Bar.new.foo #=> Foo's instance method
326-```
327-
328-Module names should be "`[A-Z][A-Za-z0-9_]+`" (UpperCamelCase). Modules cannot be inherited.
329-
330-### Module definition and `extend`
331-
332-```ruby
333-module Foo
334- def foo
335- "Foo's instance method will be a singleton method"
336- end
337-end
338-
339-class Bar
340- extend Foo # to extend Foo
341-end
342-
343-Bar.foo #=> Foo's instance method will be a singleton method
344-```
345-
346-`extend` is to use the instance methods in the specified modules as **singleton methods** in your class or module.
347-
348-### Module instantiation
349-
350-```ruby
351-module Foo #module definition
352- def foo
353- 99
354- end
355-end
356-
357-Foo.new.foo #=> 99
358-```
359-
360-Actually, Goby's module can be even **instantiated** via "`new`" like "`Foo.new`".
361-
362-### Class definition and inheritance
363-
364-```ruby
365-class Foo # class definition
366- def bar
367- 99
368- end
369-end
370-
371-class Baz < Foo # inheritance
372-end
373-
374-Baz.new.bar #=> 99
375-```
376-
377-Class names should be "`[A-Z][A-Za-z0-9]+`" (UpperCamelCase). Inheritance with "`<`" is supported.
378-
379-### Constants
380-
381-```ruby
382-HTTP_ERROR_404 = 404
383-HTTP_ERROR_404 = 500 # error
384-```
385-
386-Constants should be "`[A-Z][A-Za-z0-9_]+`" (UPPER_SNAKECASE). Constants are **not reentrant** and the scope is **global**.
387-
388-### Redefining class/modules
389-
390-```ruby
391-class Foo
392- def bar
393- 99
394- end
395-end
396-
397-class Foo
398- def bar # redefining is possible
399- 77
400- end
401-end
402-```
403-
404-### Namespaces
405-
406-```ruby
407-class Foo
408- module Bar
409- MAGIC = 99
410- def baz
411- 99
412- end
413- end
414-end
415-
416-Foo::Bar.new.baz # Use '::' for namespacing
417-Foo::Bar::MAGIC # Use '::' for namespacing
418-```
419-
420-## Load library
421-
422-### `require`
423-
424-```ruby
425-require("uri") # to activate URL class
426-
427-u = URI.parse("http://example.com")
428-u.scheme #=> "http"
429-```
430-
431-### `require_relative`
432-
433-```ruby
434-require_relative("bar") # loading the local bar.gb
435-
436-class Foo
437- def self.bar(x)
438- Bar.foo do |ten|
439- x * ten
440- end
441- end
442-
443- def self.baz
444- yield(100)
445- end
446-end
447-```
448-
449-## Literal
450-{: .-three-column}
451-
452-### Keyword
453-
454-`def`, `true`, `false`, `nil`, `if`, `elsif`, `else`, `case`, `when`, `return`, `self`, `end`, `while`, `do`, `yield`, `get_block`, `next`, `class`, `module`, `break`
455-
456-### String literal
457-
458-```ruby
459-"double quote"
460-'single quote'
461-```
462-
463-Double and single quotation can be used.
464-
465-### Symbol literal
466-
467-```ruby
468-:symbol # equivalent to "symbol"
469-{ symbol: "value" }
470-```
471-
472-Goby's symbol (using `:`) is always `String` class.
473-
474-### Numeric literal
475-
476-```ruby
477-year = 2018 # Integer
478-offset = -42 # Integer
479-PI = 3.14 # Float
480-G = -9.8 # Float
481-```
482-
483-### Array literal
484-
485-```ruby
486-[1, 2, 3, "hello", :goby, { key: "value"}]
487-[1, 2, [3, 4], 5, 6]
488-```
489-
490-### Hash literal
491-
492-```ruby
493-h = { key: "value", key2: "value2" }
494-h[:key2] #=> value2
495-```
496-
497-Hash literal's keys should always be **symbol literals**.
498-
499-### Range literal
500-
501-```ruby
502-(1..10).each do |x| # '..' represents a range
503- puts x*x
504-end
505-```
506-
507-### Boolean and `nil`
508-
509-```ruby
510-true # Boolean class
511-false # Boolean class
512-nil # Null class
513-
514-!nil #=> true
515-```
516-
517-Any objects except `nil` and `false` will be treated as `true` on conditionals.
518-
519-## Operator
520-
521-### Arithmetic/logical/assignment operators
522-
523-```ruby
524-+ # unary
525-** # power
526-- # unary
527-* / % # multiplication, division, modulus
528-+ - # addition, subtraction
529-! # logical inversion
530-> >= < <= # inequality comparison
531-== != # equality comparison, negative comparison
532-&& # logical AND
533-|| # logical OR
534-+= -= # shorthand of addition/subtraction
535-= # assignment
536-```
537-
538-*Priority of operators are TBD
539-
540-### Other operators
541-
542-```ruby
543-() # chaning priority of interpretation
544-[] # array literal
545-* # multiple assignment
546-.. # range
547-```
548-
549-*Priority of operators are TBD
550-
551-### Delimiter
552-
553-```ruby
554-class Foo; end # ';' to delimit
555-
556-class Bar end # recommended
557-```
558-
559-### String interpolation (to be implemented)
560-
561-```ruby
562-puts "Error: #{error_message}" # double quotation is required
563-```
564-
565-### Comment
566-
567-```ruby
568-puts "Goby" # comments
569-```
570-
571-Use the annotations to keep the comments concise.
572-
573-- `TODO`
574-- `FIXME`
575-- `OPTIMIZE`
576-- `HACK`
577-- `REVIEW`
578-
579-### I/O
580-
581-* `#puts`
582-
583-* special constants: `ARGV`, `STDIN`, `STDOUT`, `STDERR`, `ENV`
584-
585-## Flow control
586-{: .-three-column}
587-
588-### `if`, `else`, `elsif`
589-
590-```ruby
591-def foo(str)
592- if str.size > 10
593- puts "too big!"
594- elsif str.size < 3
595- puts "too short!"
596- else
597- puts "moderate"
598- end
599-end
600-```
601-
602-`then` is **not** supported.
603-
604-### Break
605-
606-```ruby
607-def foo(tail)
608- (5..tail).each do |t|
609- if t % 2 == 0 && t % 5 == 0
610- puts "ouch!"
611- break # finish the block
612- else
613- puts t
614- end
615- end
616- puts "out of the block"
617-end
618-
619-foo 20
620-#=> 5 6 7 8 9
621-#=> ouch!
622-#=> out of the block
623-```
624-
625-### Case
626-
627-```ruby
628-def foo(str)
629- case str
630- when "Elf"
631- puts "You might be Aragorn II!"
632- when "Aragorn"
633- puts "Long time no see, Aragorn!"
634- when "Frodo", "Sam", "Gandalf"
635- puts "One of us!"
636- else
637- puts "You're not yourself"
638- end
639-end
640-```
641-
642-### While
643-
644-```ruby
645-decr = 10
646-while decr do
647- if decr < 1
648- break
649- end
650- puts decr
651- decr -= 1
652-end
653-```
654-
655-`while`, conditional and a `do`/`end` block can be used for a loop.
656-
657-### Rescue
658-
659-Under construction. Join [#605](https://github.com/goby-lang/goby/issues/605).
660-
661-## Block
662-{: .-three-column}
663-
664-### Block
665-
666-```ruby
667-def foo(ary: [1, 2, 3])
668- ary.each do |s| # start of the block with |block variable|
669- puts s
670- end # end of the block
671-end
672-```
673-
674-`{ }` cannot be used for forming a block.
675-
676-### `yield`
677-
678-```ruby
679-def foo
680- yield(10) # executes the block given
681-end
682-
683-foo do |ten|
684- ten + 20
685-end
686-```
687-
688-### Block object and `call`
689-
690-```ruby
691-b = Block.new do
692- 100
693-end
694-
695-b.call #=> 100
696-```
697-
698-`Block.new` can take a block and then `call`.
699-
700-### Passing a block
701-
702-```ruby
703-def baz
704- 1000
705-end
706-
707-class Foo
708- def exec_block(block)
709- block.call
710- end
711-
712- def baz
713- 100
714- end
715-end
716-
717-b = Block.new do
718- baz
719-end
720-
721-f = Foo.new
722-f.exec_block(b)
723-```
724-
725-### Passing a block with block arguments
726-
727-```ruby
728-b = Block.new do |arg, offset|
729- arg + 1000 - offset
730-end
731-
732-b.call(49, 500) #=> 549
733-```
734-
735-### Special `get_block` keyword
736-
737-```ruby
738-def bar(block)
739- # runs the block object and the block arg simultaneously
740- block.call + get_block.call
741-end
742-
743-def foo
744- bar(get_block) do # passes two blocks to `bar`
745- 20
746- end
747-end
748-
749-foo do
750- 10
751-end
752-```
753-
754-`get_block` is not a method but a **keyword** to retrive a given block argument as a block object. By this, you can pass around or `call` the given block arguments as block objects.
755-
756-### Closure
757-
758-```ruby
759-count = 0 # the declaration is used
760-b = Block.new do
761- count += 1 # the block looks preserving the `count`
762-end
763-
764-class Foo
765- def bar(blk)
766- count = 9 # (does not affect)
767- puts blk.call # local variable is resolved to the one above
768- end
769-end
770-
771-Foo.new.bar b #=> 1
772-Foo.new.bar b #=> 2
773-Foo.new.bar b #=> 3
774-```
775-
776-## Native class (Primary)
777-{: .-three-column}
778-
779-Goby's most "native" classes cannot instantiate with `new` in principle.
780-
781-### `Object`
782-
783-```ruby
784-Bar.ancestors
785-#» [Bar, Foo, Object]
786-Bar.singleton_class.ancestors
787-#» [#<Class:Bar>, #<Class:Object>, Class, Object]
788-```
789-
790-`Object` is actually just for creating singleton classes. See `Class`.
791-
792-* **`Object.methods`**: `!`, `!=`, `==`, `block_given?`, `class`, `exit`, `instance_eval`, `instance_variable_get`, `instance_variable_set`, `is_a?`, `methods`, `nil?`, `object_id`, `puts`, `raise`, `require`, `require_relative`, `send`, `singleton_class`, `sleep`, `thread`, `to_s`, `<`, `<=`, `>`, `>=`, `ancestors`, `attr_accessor`, `attr_reader`, `attr_writer`, `extend`, `include`, `name`, `new`, `superclass`
793-
794-* **`Object.new.methods`**: `!`, `!=`, `==`, `block_given?`, `class`, `exit`, `instance_eval`, `instance_variable_get`, `instance_variable_set`, `is_a?`, `methods`, `nil?`, `object_id`, `puts`, `raise`, `require`, `require_relative`, `send`, `singleton_class`, `sleep`, `thread`, `to_s`
795-
796-### `Class`
797-
798-```ruby
799-String.ancestors #=> [String, Object]
800-```
801-
802-`Class` and `Object`can actually be regarded as the same and you don't need to distinguish them in almost all the cases.
803-
804-* **`Class.methods`**: `<`, `<=`, `>`, `>=`, `ancestors`, `attr_accessor`, `attr_reader`, `attr_writer`, `extend`, `include`, `name`, `new`, `superclass`, `!`, `!=`, `==`, `block_given?`, `class`, `exit`, `instance_eval`, `instance_variable_get`, `instance_variable_set`, `is_a?`, `methods`, `nil?`, `object_id`, `puts`, `raise`, `require`, `require_relative`, `send`, `singleton_class`, `sleep`, `thread`, `to_s`
805-
806-### `String`
807-
808-```ruby
809-puts "Hello" + ' ' + 'world' #=> Hello world
810-```
811-
812-Fixed to **UTF-8** with mb4 support.
813-
814-* **`String.methods`**: `fmt`,
815- * the rest: `Class.methods`
816-* **`"a".methods`**: `!=`, `*`, `+`, `<`, `<=>`, `==`, `=~`, `>`, `[]`, `[]=`, `capitalize`, `chop`, `concat`, `count`, `delete`, `downcase`, `each_byte`, `each_char`, `each_line`, `empty?`, `end_with?`, `eql?`, `fmt`, `include?`, `insert`, `length`, `ljust`, `match`, `new`, `replace`, `replace_once`, `reverse`, `rjust`, `size`, `slice`, `split`, `start_with`, `strip`, `to_a`, `to_bytes`, `to_d`, `to_f`, `to_i`, `to_s`, `upcase`,
817- * the rest: `Object.new.methods`
818-
819-### `Integer`
820-
821-```ruby
822-37037 * 27 #=> 999999
823-```
824-
825-* **`Integer.methods`**: the same as `Class.methods`
826-* **`1.methods`**: `!=`, `%`, `*`, `**`, `+`, `-`, `/`, `<`, `<=`, `<=>`, `==`, `>`, `>=`, `even?`, `new`, `next`, `odd?`, `pred`, `ptr`, `times`, `to_f`, `to_float32`, `to_float64`, `to_i`, `to_int`, `to_int16`, `to_int32`, `to_int64`, `to_int8`, `to_s`, `to_uint`, `to_uint16`, `to_uint32`, `to_uint64`, `to_uint8`
827- * the rest: `Object.new.methods`
828-
829-### `Array`
830-
831-```ruby
832-[1, "2", :card, [4, 5], { john: "doe" }]
833-```
834-
835-* **`Array.methods`**: the same as `Class.methods`
836-* **`[1].methods`**: `*`, `+`, `[]`, `[]=`, `any?`, `at`, `clear`, `concat`, `count`, `delete_at`, `dig`, `each`, `each_index`, `empty?`, `first`, `flatten`, `include?`, `join`, `last`, `lazy`, `length`, `map`, `new`, `pop`, `push`, `reduce`, `reverse`, `reverse_each`, `rotate`, `select`, `shift`, `to_enum`, `unshift`, `values_at`
837- * the rest: `Object.new.methods`
838-
839-### `Hash`
840-
841-```ruby
842-h = { key: "value" }
843-h = { "key": "value" } #=> error
844-
845-h["key"] #=> value
846-h[:key] #=> value
847-```
848-
849-Keys in hash literals should be **symbol literals**, while Hash index can be either string or symbol literals.
850-
851-* **`Hash.methods`**: the same as `Class.methods`
852-* **`{ key: "value" }.methods`**: `[]`, `[]=`, `any?`, `clear`, `default`, `default=`, `delete`, `delete_if`, `dig`, `each`, `each_key`, `each_value`, `empty?`, `eql?`, `fetch`, `fetch_values`, `has_key?`, `has_value?`, `keys`, `length`, `map_values`, `merge`, `new`, `select`, `sorted_keys`, `to_a`, `to_json`, `to_s`, `transform_values`, `values`, `values_at`
853- * the rest: `Object.new.methods`
854-
855-### `Range`
856-
857-```ruby
858-(1..10).each do |i|
859- puts i ** 2
860-end
861-```
862-
863-* **`Range.methods`**: the same as `Class.methods`
864-* **`(1..10).methods`**: `!=`, `==`, `bsearch`, `each`, `first`, `include?`, `last`, `lazy`, `map`, `new`, `size`, `step`, `to_a`, `to_enum`
865- * the rest: `Object.new.methods`
866-
867-### `Block`
868-
869-```ruby
870-b = Block.new do
871- 100
872-end
873-
874-b.call #=> 100
875-```
876-
877-* **`Block.methods`**: the same as `Class.methods`
878-* **`(Block.new do end).methods`**: `call`
879- * the rest: `Object.new.methods`
880-
881-## Native class (secondary)
882-{: .-three-column}
883-
884-### `Float`
885-
886-```ruby
887-1.1 + 1.1 # => -2.2
888-2.1 * -2.1 # => -4.41
889-```
890-
891-Float literals like `3.14` or `-273.15`. `Float` class is based on Golang's `float64` type.
892-
893-* **`Float.methods`**: the same as `Class.methods`
894-* **`3.14.methods`**: `!=`, `%`, `*`, `**`, `+`, `-`, `/`, `<`, `<=`, `<=>`, `==`, `>`, `>=`, `new`, `ptr`, `to_d`, `to_i`
895- * the rest: `Object.new.methods`
896-
897-### `Decimal`
898-
899-```ruby
900-"3.14".to_d # => 3.14
901-"-0.7238943".to_d # => -0.7238943
902-"355/113".to_d
903-# => 3.1415929203539823008849557522123893805309734513274336283185840
904-
905-a = "16.1".to_d
906-b = "1.1".to_d
907-e = "17.2".to_d
908-a + b # => 0.1
909-a + b == e # => true
910-
911-('16.1'.to_d + "1.1".to_d).to_s #=> 17.2
912-('16.1'.to_f + "1.1".to_f).to_s #=> 17.200000000000003
913-```
914-
915-Experimental: the size is arbitrary and internally a fraction from Golang's `big.Rat` type. Decimal literal is TBD for now and you can get `Decimal` number via `to_d` method from `Integer`/`Float`/`String`.
916-
917-* **`Decimal.methods`**: the same as `Class.methods`
918-* **`(1.1).to_d.methods`**: `!=`, `*`, `**`, `+`, `-`, `/`, `<`, `<=`, `<=>`, `==`, `>`, `>=`, `denominator`, `fraction`, `inverse`
919- * the rest: `Object.new.methods`
920-
921-### `Regexp`
922-
923-```ruby
924-a = Regexp.new("orl")
925-a.match?("Hello World") #=> true
926-a.match?("Hello Regexp") #=> false
927-
928-b = Regexp.new("😏")
929-b.match?("🤡 😏 😐") #=> true
930-b.match?("😝 😍 😊") #=> false
931-
932-c = Regexp.new("居(ら(?=れ)|さ(?=せ)|る|ろ|れ(?=[ばる])|よ|(?=な[いかくけそ]|ま[しすせ]|そう|た|て))")
933-c.match?("居られればいいのに") #=> true
934-c.match?("居ずまいを正す") #=> false
935-```
936-
937-Using `/ /` is to be implemented.
938-
939-* **`Regexp.methods`**: the same as `Class.methods`
940-* **`Regexp.new("^aa$").methods`**: `==`, `match?`
941- * the rest: `Object.new.methods`
942-
943-### `MatchData`
944-
945-```ruby
946-# numbered capture
947-'abcd'.match(Regexp.new('(b.)'))
948-#=> #<MatchData 0:"bc" 1:"bc">
949-
950-# named capture
951-'abcd'.match(Regexp.new('a(?<first>b)(?<second>c)'))
952-#=> #<MatchData 0:"abc" first:"b" second:"c">
953-
954-# converting to hash
955-» 'abcd'.match(Regexp.new('a(?<first>b)(?<second>c)')).to_h
956-#» { 0: "abc", first: "b", second: "c" }
957-```
958-
959-The number keys in the captures are actually `String` class.The key `0` is the mached string.
960-
961-* **`MatchData.methods`**: the same as `Class.methods`
962-* **`'abcd'.match(Regexp.new('(b.)')).methods`**: `captures`, `length`, `new`, `to_a`, `to_h`
963- * the rest: `Object.new.methods`
964-
965-### `File`
966-
967-```ruby
968-f = File.new("../test_fixtures/file_test/size.gb")
969-f.name #=> "../test_fixtures/file_test/size.gb"
970-```
971-
972-* **`File.methods`**: `basename`, `chmod`, `delete`, `exist?`, `extname`, `join`
973- * the rest: `Class.methods`
974-* **`File.new.methods`**: `basename`, `chmod`, `close`, `delete`, `exist?`, `extname`, `join`, `name`
975- * the rest: `Object.new.methods`
976-
977-## Native class (Golang-oriented)
978-{: .-three-column}
979-
980-### `GoMap`
981-
982-```ruby
983-h = { foo: "bar" }
984-m = GoMap.new(h) # to pass values to Golang's code
985-h2 = m.to_hash
986-h2[:foo] #=> "bar"
987-```
988-
989-* **`GoMap.methods`**: the same as `Class.methods`
990-* **`GoMap.new.methods`**: `get`, `set`, `to_hash`
991- * the rest: `Object.new.methods`
992-
993-### `Channel`
994-
995-```ruby
996-c = Channel.new
997-
998-1001.times do |i| # i start from 0 to 1000
999- thread do
1000- c.deliver(i)
1001- end
1002-end
1003-
1004-r = 0
1005-1001.times do
1006- r = r + c.receive
1007-end
1008-
1009-r #=> 500500
1010-```
1011-
1012-`Channel` class is to hold channels to work with `#thread`. See `thread`.
1013-
1014-* **`Channel.methods`**: the same as `Class.methods`
1015-* **`Channel.new.methods`**: `close`, `deliver`, `new`, `receive`
1016- * the rest: `Object.new.methods`
1017-
1018-## Enumerator & lazy
1019-
1020-Pretty new experimental library.
1021-
1022-### `LazyEnumerator`
1023-
1024-```ruby
1025-# creating a lazy enumerator
1026-enumerator = LazyEnumerator.new(ArrayEnumerator.new([1, 2, 3])) do |value|
1027- 2 * value
1028-end
1029-result = []
1030-
1031-enumerator.each do |value|
1032- result.push(value)
1033-end
1034-
1035-result #=> [2, 4, 6]
1036-```
1037-
1038-A shorthand `#lazy` method is also provided in `Array` and `Range` by now. See "Tips & tricks" below.
1039-
1040-* **`LazyEnumerator.methods`**: the same as `Class.methods`
1041-* **`[1, 2].lazy`**: `each`, `first`, `has_next?`, `initialize`, `map`, `next`
1042- * the rest: `Object.new.methods`
1043-
1044-### `ArrayEnumerator`
1045-
1046-```ruby
1047-iterated_values = []
1048-
1049-enumerator = ArrayEnumerator.new([1, 2, 4])
1050-
1051-while enumerator.has_next? do
1052- iterated_values.push(enumerator.next)
1053-end
1054-
1055-iterated_values #=> [1, 2, 4]
1056-```
1057-
1058-* **`ArrayEnumerator.methods`**: the same as `Class.methods`
1059-* **`ArrayEnumerator.new([1, 2, 3]).methods`**: `has_next?`, `initialize`, `next`
1060- * the rest: `Object.new.methods`
1061-
1062-### `RangeEnumerator`
1063-
1064-```ruby
1065-iterated_values = []
1066-
1067-enumerator = RangeEnumerator.new((1..4))
1068-
1069-while enumerator.has_next? do
1070- iterated_values.push(enumerator.next)
1071-end
1072-
1073-iterated_values #=> [1, 2, 3, 4]
1074-```
1075-
1076-* **`RangeEnumerator.methods`**: the same as `Class.methods`
1077-* **`RangeEnumerator.new(1..2).methods`**: `has_next?`, `initialize`, `next`
1078- * the rest: `Object.new.methods`
1079-
1080-## Special class
1081-
1082-### `Boolean`
1083-
1084-```ruby
1085-true.class #=> Boolean
1086-false.class #=> Boolean
1087-```
1088-
1089-A special class that just to hold `true` and `false`. Cannot be instantiate.
1090-
1091-### `Null`
1092-
1093-```ruby
1094-nil.class #=> Null
1095-```
1096-
1097-A special class that just to hold `nil`. Cannot be instantiate.
1098-
1099-### `Method`
1100-
1101-(A special dummy class that just holds methods defined by Goby code.)
1102-
1103-### `Diggable`
1104-
1105-Provides `#dig` method. Currently. `Array` and `Hash` classes' instance can be `Diggable`.
1106-
1107-```ruby
1108-[1, 2].dig(0, 1) #=> TypeError: Expect target to be Diggable, got Integer
1109-```
1110-
1111-## Testing framework
1112-
1113-### `Spec`
1114-
1115-```ruby
1116-require "spec"
1117-
1118-Spec.describe Spec do
1119- it "fails and exit with code 1" do
1120- expect(1).to eq(2)
1121- end
1122-end
1123-
1124-Spec.run
1125-```
1126-
1127-* **`Spec.methods`**: `describe`, `describes`, `instance`, `run`
1128- * the rest: `Object.methods`
1129-* **`Spec.new.methods`**: `describes`, `initialize`, `run`, `session_successful`, `session_successful=`
1130- * the rest: `Hash.new.methods`
1131-
1132-## Tips & tricks
1133-
1134-### Showing methods
1135-
1136-```ruby
1137-» "string".methods
1138-#» ["!=", "*", "+", "<", "<=>", "==", "=~", ">", "[]", "[]=", "capitalize", "chop", "concat", "count", "delete", "downcase", "each_byte", "each_char", "each_line", "empty?", "end_with?", "eql?", "fmt", "include?", "insert", "length", "ljust", "match", "new", "replace", "replace_once", "reverse", "rjust", "size", "slice", "split", "start_with", "strip", "to_a", "to_bytes", "to_d", "to_f", "to_i", "to_s", "upcase", "!", "block_given?", "class", "exit", "instance_eval", "instance_variable_get", "instance_variable_set", "is_a?", "methods", "nil?", "object_id", "puts", "raise", "require", "require_relative", "send", "singleton_class", "sleep", "thread"]
1139-```
1140-
1141-### Showing class
1142-
1143-```ruby
1144-» "string".class
1145-#» String
1146-```
1147-
1148-### Showing singleton class
1149-
1150-```ruby
1151-» "moji".singleton_class
1152-#» #<Class:#<String:842352325152>>
1153-
1154-» "moji".class.singleton_class
1155-#» #<Class:String>
1156-```
1157-
1158-### Showing ancestors
1159-
1160-```ruby
1161-» Integer.ancestors
1162-#» [Integer, Object]
1163-
1164-» "moji".class.ancestors
1165-#» [String, Object]
1166-```
1167-
1168-### Showing singleton classes' ancestors
1169-
1170-```ruby
1171-» "moji".class.singleton_class.ancestors
1172-#» [#<Class:String>, #<Class:Object>, Class, Object]
1173-```
1174-
1175-### Showing object's id
1176-
1177-```ruby
1178-» "moji".object_id
1179-#» 842352977920
1180-```
1181-
1182-### `#to_json`
1183-
1184-```ruby
1185-h = { a: 1, b: [1, "2", [4, 5, nil]]}
1186-h.to_json # converts hash to JSON
1187-#=> {"a":1, "b":[1, "2", [4, 5, null]]}
1188-```
1189-
1190-### Customize `#to_json`
1191-
1192-Overwrite the `#to_json` in your class:
1193-
1194-```ruby
1195-class JobTitle
1196- def initialize(name)
1197- @name = name
1198- end
1199-
1200- def to_json
1201- { title: @name }.to_json
1202- end
1203-end
1204-
1205-class Person
1206- def initialize(name, age)
1207- @name = name
1208- @age = age
1209- @job = JobTitle.new("software engineer")
1210- end
1211-
1212- def to_json
1213- { name: @name, age: @age, job: @job }.to_json
1214- end
1215-end
1216-
1217-stan = Person.new("Stan", 23)
1218-h = { person: stan }
1219-h.to_json #=> {"person":{"name":"Stan","job":{"title":"software engineer"},"age":23}}
1220-```
1221-
1222-### Lazy enumeration
1223-
1224-To avoid N + 1 query.
1225-
1226-```ruby
1227-enumerator = [1, 2, 3].lazy.map do |value|
1228- 2 * value
1229-end
1230-result = []
1231-
1232-enumerator.each do |value|
1233- result.push(value)
1234-end
1235-
1236-result #=> [2, 4, 6]
1237-```
1238-
1239-You can call `#lazy.map` on `Array`, `Range`, or `JSON` objects.
1240-
1241-## Styling
1242-
1243-### Quick style guide
1244-
1245-* UTF-8 should be used.
1246-* Only two spaces ` ` should be used for one indentation.
1247- * Tab cannot be used for indentation.
1248-* For more, follow [RuboCop's style guide](https://github.com/bbatsov/ruby-style-guide) in principle.
1249-
1250-### Document notation
1251-
1252-* `Class#instance_method` -- use `#` to represent instance methods in documents
1253-* `Class.class_method`
1254-* `Module.module_method`
1255-
1256-### Syntax highlighting
1257-
1258-Ready for Vim and Sublime text. You can also use Ruby's syntax highlighting so far.
1259-
1260-## References
1261-
1262-### Official
1263-
1264-* Official site: [https://goby-lang.org/](https://goby-lang.org/)
1265-* Repository: [https://github.com/goby-lang/goby/](https://github.com/goby-lang/goby/)
1266-* DevHints: [https://devhints.io/goby](https://devhints.io/goby) (this page)
1267-
1268-### Readings for Goby developers
1269-
1270-* [Write an Interpreter in Go](https://interpreterbook.com/)
1271-* [Nand2Tetris II](https://www.coursera.org/learn/nand2tetris2/home/welcome)
1272-* [Ruby under a microscope](http://patshaughnessy.net/ruby-under-a-microscope)
1273-* [YARV's instruction table](http://www.atdot.net/yarv/insnstbl.html)
1274-
1275-### JP resource
1276-
1277-* [Goby: Rubyライクな言語(1)Gobyを動かしてみる](https://techracho.bpsinc.jp/hachi8833/2017_11_10/47787)
1278-* [Gobyの組み込みクラスにメソッドを追加する方法](https://qiita.com/hanachin_/items/efc1c976a4f5749514ef)
1@@ -1,273 +0,0 @@
2----
3-title: GraphQL
4-layout: 2017/sheet
5-updated: 2019-07-07
6-category: API
7----
8-
9-## Intro
10-
11-## Queries
12-{: .-three-column}
13-
14-### Basic query
15-
16-```js
17-{ status }
18-```
19-
20-#### ↓
21-
22-```js
23-{ status: 'available' }
24-```
25-{: .-setup}
26-
27-### Nesting
28-
29-```js
30-{ hero { name height } }
31-```
32-
33-#### ↓
34-
35-```js
36-{ hero:
37- { name: "Luke Skywalker",
38- height: 1.74 } }
39-```
40-{: .-setup}
41-
42-### Lists
43-
44-```js
45-{ friends { name } }
46-```
47-
48-#### ↓
49-
50-```js
51-{ friends:
52- [ { name: "Luke Skywalker" },
53- { name: "Han Solo" },
54- { name: "R2D2" } ] }
55-```
56-{: .-setup}
57-
58-GraphQL queries look the same for both single items or lists of items.
59-
60-### Lookups
61-
62-```js
63-{
64- hero(id: "1000") { id name }
65-}
66-```
67-
68-#### ↓
69-
70-```js
71-{ hero:
72- { id: "1000",
73- { name: "Luke Skywalker" } }
74-```
75-{: .-setup}
76-
77-### Aliases
78-
79-```js
80-{
81- luke: hero(id: "1000") { name }
82- han: hero(id: "1001") { name }
83-}
84-```
85-
86-#### ↓
87-
88-```js
89-{ luke:
90- { name: "Luke Skywalker" },
91- han:
92- { name: "Han Solo" } }
93-```
94-{: .-setup}
95-
96-### Operation names and variables
97-
98-#### Query
99-```js
100-query FindHero($id: String!) {
101- hero(id: $id) { name }
102-}
103-```
104-
105-Just to make things less ambiguous. Also, to use variables, you need an operation name.
106-
107-#### Variables
108-
109-```js
110-{ id: '1000' }
111-```
112-
113-### Mutations
114-
115-#### Query
116-
117-```js
118-{ createReview($review) { id } }
119-```
120-
121-#### Variables
122-
123-```js
124-{ review: { stars: 5 } }
125-```
126-
127-#### ↓
128-
129-```js
130-{ createReview: { id: 5291 } }
131-```
132-
133-Mutations are just fields that do something when queried.
134-
135-### Multiple types
136-
137-```js
138-{
139- search(q: "john") {
140- id
141- ... on User { name }
142- ... on Comment { body author { name } }
143- }
144-}
145-```
146-
147-Great for searching.
148-
149-
150-Over HTTP
151----------
152-
153-#### GET
154-
155-```js
156-fetch('http://myapi/graphql?query={ me { name } }')
157-```
158-
159-#### POST
160-
161-```js
162-fetch('http://myapi/graphql', {
163- body: JSON.stringify({
164- query: '...',
165- operationName: '...',
166- variables: { ... }
167- })
168-})
169-```
170-
171-Schema
172-------
173-{: .-three-column}
174-
175-### Basic schemas
176-
177-```js
178-type Query {
179- me: User
180- users(limit: Int): [User]
181-}
182-
183-type User {
184- id: ID!
185- name: String
186-}
187-```
188-
189-See: [sogko/graphql-shorthand-notation-cheat-sheet](https://raw.githubusercontent.com/sogko/graphql-shorthand-notation-cheat-sheet/master/graphql-shorthand-notation-cheat-sheet.png)
190-
191-### Built in types
192-
193-#### Scalar types
194-
195-| `Int` | Integer |
196-| `Float` | Float |
197-| `String` | String |
198-| `Boolean` | Boolean |
199-| `ID` | ID |
200-
201-#### Type definitions
202-
203-| `scalar` | Scalar type |
204-| `type` | Object type |
205-| `interface` | Interface type |
206-| `union` | Union type |
207-| `enum` | Enumerable type |
208-| `input` | Input object type |
209-
210-#### Type modifiers
211-
212-| `String` | Nullable string |
213-| `String!` | Required string |
214-| `[String]` | List of strings |
215-| `[String]!` | Required list of strings |
216-| `[String!]!` | Required list of required strings |
217-
218-### Mutations
219-
220-```js
221-type Mutation {
222- users(params: ListUsersInput) [User]!
223-}
224-```
225-
226-### Interfaces
227-
228-```js
229-interface Entity {
230- id: ID!
231-}
232-
233-type User implements Entity {
234- id: ID!
235- name: String
236-}
237-```
238-
239-### Enums
240-
241-```js
242-enum DIRECTION {
243- LEFT
244- RIGHT
245-}
246-
247-type Root {
248- direction: DIRECTION!
249-}
250-```
251-{: data-line="1,2,3,4"}
252-
253-### Unions
254-
255-```js
256-type Artist { ··· }
257-type Album { ··· }
258-
259-union Result = Artist | Album
260-
261-type Query {
262- search(q: String) [Result]
263-}
264-```
265-{: data-line="4"}
266-
267-References
268-----------
269-
270-- <http://graphql.org/learn/queries/>
271-- <http://graphql.org/learn/serving-over-http/>
272-
273-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
274-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,56 +0,0 @@
2----
3-title: Haml
4-category: Markup
5-layout: 2017/sheet
6-prism_languages: [haml]
7----
8-
9-### Doctype
10-
11-```haml
12-!!! 5
13-```
14-
15-### Tags
16-
17-```haml
18-%html
19- %head
20- %title
21- %body
22- %h1 Hello World
23- %br/
24-```
25-
26-### Classes and ID's
27-
28-```haml
29-%p.class-example
30-.no-tag-defaults-to-div
31-%div#butItCanBeIncluded
32-```
33-
34-### Inline Attributes
35-
36-Either hash syntax works
37-
38-```haml
39-%meta{ name: "viewport", content: "width=device-width, initial-scale=1.0" }
40-%input{ :type => "text", :required => true }
41-```
42-
43-### Ruby
44-
45-```haml
46--# This is a comment
47--# Anything starting with a hyphen signals to Haml that Ruby is coming
48-- @arr = [1, 2, 3]
49-- @str = "test"
50--# Equal signals output
51-= render partial: "shared/header"
52-= yield
53-= link_to page_url
54-```
55-
56-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
57-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,110 +0,0 @@
2----
3-title: HTML
4-category: HTML
5-layout: 2017/sheet
6----
7-
8-### Head stuff
9-
10- <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
11- <link rel="shortcut icon" type="image/png" href="/favicon.png">
12- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
13-
14-### iPhone viewport
15-
16- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0">
17- <meta name="viewport" content="width=device-width">
18- <meta name="viewport" content="width=320, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> <!-- full example -->
19-
20-### Default OpenGraph meta tags
21-
22- <meta content="..." name="description">
23- <meta content="..." property="og:description">
24- <meta content="http://.../preview.jpg" property="og:image">
25- <meta content="Hello There" property="og:title">
26- <meta content="Hello There" property="og:site_name">
27- <meta content="hellothere" property="fb:admins">
28- <meta content="website" property="og:type">
29-
30-### Webfonts
31-
32- <script>WebFontConfig={ },function(a,b){var c=a.createElement(b);c.src="//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js",c.async=1;var d=a.getElementsByTagName(b)[0];d.parentNode.insertBefore(c,d)}(document,"script")</script>
33-
34- // {typekit{id:"..."}}
35- // {google:{families:['Exo:400']}}
36-
37-### Google Analytics
38-
39- <script>location.hostname.match(/helloworld\.com/)&&(_gaq=[["_setAccount","UA-XXXXX-1"],["_trackPageview"]],function(a,b){var c=a.createElement(b),d=a.getElementsByTagName(b)[0];c.async=1,c.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js",d.parentNode.insertBefore(c,d)}(document,"script"))</script>
40-
41-### FB/Twitter
42-
43- <div id="fb-root"></div><script>fbAsyncInit=function(){FB.init({"appId":"___APPIDGOESHERE___","status":true,"cookie":true,"xfbml":true})};!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=1;js.src='//connect.facebook.net/en_US/all.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','facebook-jssdk');</script>
44-
45- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=1;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
46-
47-### HTML5 Shiv for IE8
48-
49- <!--[if lte IE 8]><script src='//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js'></script><![endif]-->
50-
51-### H5BP HTML tag (IE8 and IE9 only)
52-
53- <!--[if lte IE 8]><html class="ie8"><![endif]--><!--[if IE 9]><html class="ie9"><![endif]--><!--[if gt IE 9]><!-->
54- <html><!--<![endif]-->
55-
56-### Touch icons
57-
58- * apple-touch-icon-precomposed.png
59- * apple-touch-icon-57x57-precomposed.png
60- * apple-touch-icon-72x72-precomposed.png
61- * apple-touch-icon-114x114-precomposed.png
62- * apple-touch-icon-144x144-precomposed.png
63-
64-### Icons
65-
66- <link rel="shortcut icon" type="image/png" href="favicon.png">
67- <link href="apple-touch-icon-precomposed.png" rel="apple-touch-icon">
68- <link href="apple-touch-icon-57x57-precomposed.png" size="57x57" rel="apple-touch-icon">
69- <link href="apple-touch-icon-72x72-precomposed.png" size="72x72" rel="apple-touch-icon">
70- <link href="apple-touch-icon-114x114-precomposed.png" size="114x114" rel="apple-touch-icon">
71- <link href="apple-touch-icon-144x144-precomposed.png" size="144x144" rel="apple-touch-icon">
72-
73-Only do this if you're not placing the site in the root!
74-
75-### H5BP HTML tag
76-
77- <!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
78- <!--[if IE 7 ]> <html class="ie7"> <![endif]-->
79- <!--[if IE 8 ]> <html class="ie8"> <![endif]-->
80- <!--[if IE 9 ]> <html class="ie9"> <![endif]-->
81- <!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
82-
83-### Google jQuery
84-
85- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
86-
87-### Unsupported message
88-
89- <!--[if lt IE 8]>
90- <div class="unsupported-browser">
91- <strong>
92- You are using an outdated browser.
93- </strong>
94- <span>
95- Please <a class="upgrade-browser"
96- href="http://browsehappy.com/">
97- upgrade your browser</a> or <a class="chrome-frame"
98- href="http://www.google.com/chromeframe/?redirect=true">activate Google
99- Chrome Frame</a> to improve your experience.
100- </span>
101- </div>
102- <![endif]-->
103-
104-### HTML Compatibility inspector
105-
106- <script src="http://ie.microsoft.com/testdrive/HTML5/CompatInspector/inspector.js"></script>
107-
108-More info here: [microsoft.com](http://ie.microsoft.com/testdrive/HTML5/CompatInspector/)
109-
110-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
111-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,582 +0,0 @@
2----
3-title: ES2015+
4-category: JavaScript
5-layout: 2017/sheet
6-tags: [Featured]
7-updated: 2019-11-14
8-weight: -10
9-intro: |
10- A quick overview of new JavaScript features in ES2015, ES2016, ES2017, ES2018 and beyond.
11----
12-
13-### Block scoping
14-
15-#### Let
16-
17-```js
18-function fn () {
19- let x = 0
20- if (true) {
21- let x = 1 // only inside this `if`
22- }
23-}
24-```
25-{: data-line="2,4"}
26-
27-#### Const
28-
29-```js
30-const a = 1
31-```
32-
33-`let` is the new `var`. Constants work just like `let`, but can't be reassigned.
34-See: [Let and const](https://babeljs.io/learn-es2015/#let--const)
35-
36-### Backtick strings
37-
38-#### Interpolation
39-
40-```js
41-const message = `Hello ${name}`
42-```
43-
44-#### Multiline strings
45-
46-```js
47-const str = `
48-hello
49-world
50-`
51-```
52-
53-Templates and multiline strings.
54-See: [Template strings](https://babeljs.io/learn-es2015/#template-strings)
55-
56-### Binary and octal literals
57-
58-```js
59-let bin = 0b1010010
60-let oct = 0o755
61-```
62-
63-See: [Binary and octal literals](https://babeljs.io/learn-es2015/#binary-and-octal-literals)
64-
65-### New methods
66-
67-#### New string methods
68-
69-```js
70-"hello".repeat(3)
71-"hello".includes("ll")
72-"hello".startsWith("he")
73-"hello".padStart(8) // " hello"
74-"hello".padEnd(8) // "hello "
75-"hello".padEnd(8, '!') // hello!!!
76-"\u1E9B\u0323".normalize("NFC")
77-```
78-
79-See: [New methods](https://babeljs.io/learn-es2015/#math--number--string--object-apis)
80-
81-### Classes
82-
83-```js
84-class Circle extends Shape {
85-```
86-
87-#### Constructor
88-
89-```js
90- constructor (radius) {
91- this.radius = radius
92- }
93-```
94-{: data-line="1"}
95-
96-#### Methods
97-
98-```js
99- getArea () {
100- return Math.PI * 2 * this.radius
101- }
102-```
103-{: data-line="1"}
104-
105-#### Calling superclass methods
106-
107-```js
108- expand (n) {
109- return super.expand(n) * Math.PI
110- }
111-```
112-{: data-line="2"}
113-
114-#### Static methods
115-
116-```js
117- static createFromDiameter(diameter) {
118- return new Circle(diameter / 2)
119- }
120-}
121-```
122-{: data-line="1"}
123-
124-Syntactic sugar for prototypes.
125-See: [Classes](https://babeljs.io/learn-es2015/#classes)
126-
127-### Exponent operator
128-
129-```js
130-const byte = 2 ** 8
131-// Same as: Math.pow(2, 8)
132-```
133-{: data-line="1"}
134-
135-Promises
136---------
137-{: .-three-column}
138-
139-### Making promises
140-
141-```js
142-new Promise((resolve, reject) => {
143- if (ok) { resolve(result) }
144- else { reject(error) }
145-})
146-```
147-{: data-line="1"}
148-
149-For asynchronous programming.
150-See: [Promises](https://babeljs.io/learn-es2015/#promises)
151-
152-### Using promises
153-
154-```js
155-promise
156- .then((result) => { ··· })
157- .catch((error) => { ··· })
158-```
159-{: data-line="2,3"}
160-
161-
162-### Using promises with finally
163-
164-```js
165-promise
166- .then((result) => { ··· })
167- .catch((error) => { ··· })
168- .finally(() => { // logic independent of success/error })
169-```
170-{: data-line="4"}
171-
172-The handler is called when the promise is fulfilled or rejected.
173-
174-
175-### Promise functions
176-
177-```js
178-Promise.all(···)
179-Promise.race(···)
180-Promise.reject(···)
181-Promise.resolve(···)
182-```
183-
184-### Async-await
185-
186-```js
187-async function run () {
188- const user = await getUser()
189- const tweets = await getTweets(user)
190- return [user, tweets]
191-}
192-```
193-{: data-line="2,3"}
194-
195-`async` functions are another way of using functions.
196-
197-See: [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)
198-
199-Destructuring
200--------------
201-{: .-three-column}
202-
203-### Destructuring assignment
204-
205-#### Arrays
206-
207-```js
208-const [first, last] = ['Nikola', 'Tesla']
209-```
210-{: data-line="1"}
211-
212-#### Objects
213-
214-```js
215-let {title, author} = {
216- title: 'The Silkworm',
217- author: 'R. Galbraith'
218-}
219-```
220-{: data-line="1"}
221-
222-Supports for matching arrays and objects.
223-See: [Destructuring](https://babeljs.io/learn-es2015/#destructuring)
224-
225-### Default values
226-
227-```js
228-const scores = [22, 33]
229-const [math = 50, sci = 50, arts = 50] = scores
230-```
231-
232-```js
233-// Result:
234-// math === 22, sci === 33, arts === 50
235-```
236-
237-Default values can be assigned while destructuring arrays or objects.
238-
239-### Function arguments
240-
241-```js
242-function greet({ name, greeting }) {
243- console.log(`${greeting}, ${name}!`)
244-}
245-```
246-{: data-line="1"}
247-
248-```js
249-greet({ name: 'Larry', greeting: 'Ahoy' })
250-```
251-
252-Destructuring of objects and arrays can also be done in function arguments.
253-
254-### Default values
255-
256-```js
257-function greet({ name = 'Rauno' } = {}) {
258- console.log(`Hi ${name}!`);
259-}
260-```
261-{: data-line="1"}
262-
263-```js
264-greet() // Hi Rauno!
265-greet({ name: 'Larry' }) // Hi Larry!
266-```
267-
268-### Reassigning keys
269-
270-```js
271-function printCoordinates({ left: x, top: y }) {
272- console.log(`x: ${x}, y: ${y}`)
273-}
274-```
275-{: data-line="1"}
276-
277-```js
278-printCoordinates({ left: 25, top: 90 })
279-```
280-
281-This example assigns `x` to the value of the `left` key.
282-
283-### Loops
284-
285-```js
286-for (let {title, artist} of songs) {
287- ···
288-}
289-```
290-{: data-line="1"}
291-
292-The assignment expressions work in loops, too.
293-
294-
295-### Object destructuring
296-
297-```js
298-const { id, ...detail } = song;
299-```
300-{: data-line="1"}
301-
302-Extract some keys individually and remaining keys in the object using rest (...) operator
303-
304-
305-Spread
306-------
307-
308-### Object spread
309-
310-#### with Object spread
311-
312-```js
313-const options = {
314- ...defaults,
315- visible: true
316-}
317-```
318-{: data-line="2"}
319-
320-#### without Object spread
321-
322-```js
323-const options = Object.assign(
324- {}, defaults,
325- { visible: true })
326-```
327-
328-The Object spread operator lets you build new objects from other objects.
329-
330-See: [Object spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator)
331-
332-### Array spread
333-
334-#### with Array spread
335-
336-```js
337-const users = [
338- ...admins,
339- ...editors,
340- 'rstacruz'
341-]
342-```
343-{: data-line="2,3"}
344-
345-#### without Array spread
346-
347-```js
348-const users = admins
349- .concat(editors)
350- .concat([ 'rstacruz' ])
351-```
352-
353-The spread operator lets you build new arrays in the same way.
354-
355-See: [Spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator)
356-
357-Functions
358----------
359-
360-### Function arguments
361-
362-#### Default arguments
363-
364-```js
365-function greet (name = 'Jerry') {
366- return `Hello ${name}`
367-}
368-```
369-{: data-line="1"}
370-
371-#### Rest arguments
372-
373-```js
374-function fn(x, ...y) {
375- // y is an Array
376- return x * y.length
377-}
378-```
379-{: data-line="1"}
380-
381-#### Spread
382-
383-```js
384-fn(...[1, 2, 3])
385-// same as fn(1, 2, 3)
386-```
387-{: data-line="1"}
388-
389-Default, rest, spread.
390-See: [Function arguments](https://babeljs.io/learn-es2015/#default--rest--spread)
391-
392-### Fat arrows
393-
394-#### Fat arrows
395-
396-```js
397-setTimeout(() => {
398- ···
399-})
400-```
401-{: data-line="1"}
402-
403-#### With arguments
404-
405-```js
406-readFile('text.txt', (err, data) => {
407- ...
408-})
409-```
410-{: data-line="1"}
411-
412-#### Implicit return
413-```js
414-numbers.map(n => n * 2)
415-// No curly braces = implicit return
416-// Same as: numbers.map(function (n) { return n * 2 })
417-numbers.map(n => ({
418- result: n * 2
419-}))
420-// Implicitly returning objects requires parentheses around the object
421-```
422-{: data-line="1,4,5,6"}
423-
424-Like functions but with `this` preserved.
425-See: [Fat arrows](https://babeljs.io/learn-es2015/#arrows-and-lexical-this)
426-
427-Objects
428--------
429-
430-### Shorthand syntax
431-
432-```js
433-module.exports = { hello, bye }
434-// Same as: module.exports = { hello: hello, bye: bye }
435-```
436-
437-See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals)
438-
439-### Methods
440-
441-```js
442-const App = {
443- start () {
444- console.log('running')
445- }
446-}
447-// Same as: App = { start: function () {···} }
448-```
449-{: data-line="2"}
450-
451-See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals)
452-
453-### Getters and setters
454-
455-```js
456-const App = {
457- get closed () {
458- return this.status === 'closed'
459- },
460- set closed (value) {
461- this.status = value ? 'closed' : 'open'
462- }
463-}
464-```
465-{: data-line="2,5"}
466-
467-See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals)
468-
469-### Computed property names
470-
471-```js
472-let event = 'click'
473-let handlers = {
474- [`on${event}`]: true
475-}
476-// Same as: handlers = { 'onclick': true }
477-```
478-{: data-line="3"}
479-
480-See: [Object literal enhancements](https://babeljs.io/learn-es2015/#enhanced-object-literals)
481-
482-
483-### Extract values
484-
485-```js
486-const fatherJS = { age: 57, name: "Brendan Eich" }
487-
488-Object.values(fatherJS)
489-// [57, "Brendan Eich"]
490-Object.entries(fatherJS)
491-// [["age", 57], ["name", "Brendan Eich"]]
492-```
493-{: data-line="3,5"}
494-
495-
496-Modules
497--------
498-
499-### Imports
500-
501-```js
502-import 'helpers'
503-// aka: require('···')
504-```
505-
506-```js
507-import Express from 'express'
508-// aka: const Express = require('···').default || require('···')
509-```
510-
511-```js
512-import { indent } from 'helpers'
513-// aka: const indent = require('···').indent
514-```
515-
516-```js
517-import * as Helpers from 'helpers'
518-// aka: const Helpers = require('···')
519-```
520-
521-```js
522-import { indentSpaces as indent } from 'helpers'
523-// aka: const indent = require('···').indentSpaces
524-```
525-
526-`import` is the new `require()`.
527-See: [Module imports](https://babeljs.io/learn-es2015/#modules)
528-
529-### Exports
530-
531-```js
532-export default function () { ··· }
533-// aka: module.exports.default = ···
534-```
535-
536-```js
537-export function mymethod () { ··· }
538-// aka: module.exports.mymethod = ···
539-```
540-
541-```js
542-export const pi = 3.14159
543-// aka: module.exports.pi = ···
544-```
545-
546-`export` is the new `module.exports`.
547-See: [Module exports](https://babeljs.io/learn-es2015/#modules)
548-
549-Generators
550-----------
551-
552-### Generators
553-
554-```js
555-function* idMaker () {
556- let id = 0
557- while (true) { yield id++ }
558-}
559-```
560-
561-```js
562-let gen = idMaker()
563-gen.next().value // → 0
564-gen.next().value // → 1
565-gen.next().value // → 2
566-```
567-
568-It's complicated.
569-See: [Generators](https://babeljs.io/learn-es2015/#generators)
570-
571-### For..of iteration
572-
573-```js
574-for (let i of iterable) {
575- ···
576-}
577-```
578-
579-For iterating through generators and arrays.
580-See: [For..of iteration](https://babeljs.io/learn-es2015/#iterators--forof)
581-
582-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
583-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,104 +0,0 @@
2----
3-title: Jinja
4-category: Python
5-layout: 2017/sheet
6----
7-
8-{% raw %}
9-### Basic usage
10-
11-```
12-- variable x has content: {{ x }}
13-- expression: {{ x + 1 }}
14-- escaped for HTML: {{ x | e }}
15-```
16-
17-### Control structures
18-
19-```
20-{% for x in range(5) %}
21- {% if x % 2 == 0 %}
22- {{ x }} is even!
23- {% else %}
24- {{ x }} is odd!
25- {% endif %}
26-{% endfor %}
27-```
28-
29-### Whitespace trimming
30-
31-```
32-these are
33-{{ "three" }}
34-lines.
35-
36-this is conc
37-{{- "at" -}}
38-enated.
39-```
40-
41-### Special blocks
42-
43-```
44-{% filter e %}{% endraw %}
45-{ {%- if 0 -%}{%- endif -%} % raw %}
46-{%- raw -%}
47- This is a raw block where {{nothing is evaluated}}
48- {% not even this %}
49- and <html is escaped> too with "e" filter
50-{% endraw %}
51-{ {%- if 0 -%}{%- endif -%} % endraw %}{% raw %}
52-{% endfilter %}
53-
54-{% macro myfunc(x) %}
55- this is a reusable macro, with arguments: {{x}}
56-{% endmacro %}
57-
58-{{ myfunc(42) }}
59-
60-{#
61-this is a comment
62-#}
63-```
64-
65-
66-### Inheritance
67-
68-#### shared.html
69-
70-```
71-<html>
72- <head>
73- <title>{%block title %}{% endblock %}</title>
74- </head>
75- <body>
76- <header><h1>{% block title %}{% endblock %}</h1></header>
77- <main>{% block content %}{% endblock %}</main>
78- </body>
79-</html>
80-```
81-
82-#### home.html
83-
84-```
85-{% extends "shared.html" %}
86-{% block title %}Welcome to my site{% endblock %}
87-{% block content %}
88-This is the body
89-{% endblock %}
90-```
91-
92-## Library
93-
94-### Basic usage
95-
96-```python
97-from jinja2 import Template
98-template = Template('Hello {{ name }}!')
99-template.render(name='John Doe') == u'Hello John Doe!'
100-```
101-
102-{% endraw %}
103-
104-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
105-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,8 +0,0 @@
2----
3-title: jinja
4-category: python
5-redirect_to: /jinja
6----
7-
8-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
9-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,407 +0,0 @@
2----
3-title: Kotlin
4-layout: 2017/sheet
5-updated: 2018-12-06
6-category: Java & JVM
7-prism_languages: [kotlin]
8-intro: |
9- [Kotlin](http://kotlinlang.org/) is a statically typed programming language for modern multiplatform applications.
10----
11-
12-Variables
13----------
14-{: .-three-column}
15-
16-### Mutability
17-
18-```kotlin
19-var mutableString: String = "Adam"
20-val immutableString: String = "Adam"
21-val inferredString = "Adam"
22-```
23-
24-### Strings
25-
26-```kotlin
27-val name = "Adam"
28-val greeting = "Hello, " + name
29-val greetingTemplate = "Hello, $name"
30-val interpolated = "Hello, ${name.toUpperCase()}"
31-```
32-
33-### Numbers
34-
35-```kotlin
36-val intNum = 10
37-val doubleNum = 10.0
38-val longNum = 10L
39-val floatNum = 10.0F
40-```
41-
42-### Booleans
43-
44-```kotlin
45-val trueBoolean = true
46-val falseBoolean = false
47-val andCondition = trueBoolean && falseBoolean
48-val orCondition = trueBoolean || falseBoolean
49-```
50-
51-### Static Fields
52-
53-```kotlin
54-class Person {
55- companion object {
56- val NAME_KEY = "name_key"
57- }
58-}
59-
60-val key = Person.NAME_KEY
61-```
62-
63-Null Safety
64------------
65-{: .-two-column}
66-
67-### Nullable properties
68-
69-```kotlin
70-val cannotBeNull: String = null // Invalid
71-val canBeNull: String? = null // Valid
72-
73-val cannotBeNull: Int = null // Invalid
74-val canBeNull: Int? = null // Valid
75-```
76-
77-### Checking for null
78-
79-```kotlin
80-val name: String? = "Adam"
81-
82-if (name != null && name.length > 0) {
83- print("String length is ${name.length}")
84-} else {
85- print("String is empty.")
86-}
87-```
88-
89-### Safe Operator
90-
91-```kotlin
92-val nullableStringLength: Int? = nullableString?.length
93-val nullableDepartmentHead: String? = person?.department?.head?.name
94-```
95-
96-### Elvis Operator
97-
98-```kotlin
99-val nonNullStringLength: Int = nullableString?.length ?: 0
100-val nonNullDepartmentHead: String = person?.department?.head?.name ?: ""
101-val nonNullDepartmentHead: String = person?.department?.head?.name.orEmpty()
102-```
103-
104-### Safe Casts
105-```kotlin
106-// Will not throw ClassCastException
107-val nullableCar: Car? = (input as? Car)
108-```
109-
110-Collections
111------------
112-{: .-two-column}
113-
114-### Creation
115-
116-```kotlin
117-val numArray = arrayOf(1, 2, 3)
118-val numList = listOf(1, 2, 3)
119-val mutableNumList = mutableListOf(1, 2, 3)
120-```
121-
122-### Accessing
123-
124-```kotlin
125-val firstItem = numList[0]
126-val firstItem = numList.first()
127-val firstItem = numList.firstOrNull()
128-```
129-
130-### Maps
131-
132-```kotlin
133-val faceCards = mutableMapOf("Jack" to 11, "Queen" to 12, "King" to 13)
134-val jackValue = faceCards["Jack"] // 11
135-faceCards["Ace"] = 1
136-```
137-
138-### Mutability
139-
140-```kotlin
141-val immutableList = listOf(1, 2, 3)
142-val mutableList = immutableList.toMutableList()
143-
144-val immutableMap = mapOf("Jack" to 11, "Queen" to 12, "King" to 13)
145-val mutableMap = immutableMap.toMutableMap()
146-```
147-
148-### Iterating
149-
150-```kotlin
151-for (item in myList) {
152- print(item)
153-}
154-
155-myList.forEach {
156- print(it)
157-}
158-
159-myList.forEachIndexed { index, item ->
160- print("Item at $index is: $item")
161-}
162-```
163-
164-### Filtering & Searching
165-
166-```kotlin
167-val evenNumbers = numList.filter { it % 2 == 0 }
168-val containsEven = numList.any { it % 2 == 0 }
169-val containsNoEvens = numList.none { it % 2 == 0 }
170-val containsNoEvens = numList.all { it % 2 == 1 }
171-val firstEvenNumber: Int = numList.first { it % 2 == 0 }
172-val firstEvenOrNull: Int? = numList.firstOrNull { it % 2 == 0 }
173-val fullMenu = objList.map { "${it.name} - $${it.detail}" }
174-```
175-
176-Note: `it` is the [implicit name for a single parameter](https://kotlinlang.org/docs/reference/lambdas.html#it-implicit-name-of-a-single-parameter).
177-
178-Functions
179----------
180-{: .-two-column}
181-
182-### Parameters & Return Types
183-
184-```kotlin
185-fun printName() {
186- print("Adam")
187-}
188-
189-fun printName(person: Person) {
190- print(person.name)
191-}
192-
193-fun getGreeting(person: Person): String {
194- return "Hello, ${person.name}"
195-}
196-
197-fun getGreeting(person: Person): String = "Hello, ${person.name}"
198-fun getGreeting(person: Person) = "Hello, ${person.name}"
199-```
200-
201-### Higher Order Functions
202-
203-```kotlin
204-fun callbackIfTrue(condition: Boolean, callback: () -> Unit) {
205- if (condition) {
206- callback()
207- }
208-}
209-
210-callbackIfTrue(someBoolean) {
211- print("Condition was true")
212-}
213-```
214-
215-### Extension Functions
216-
217-```kotlin
218-fun Int.timesTwo(): Int {
219- return this * 2
220-}
221-
222-val four = 2.timesTwo()
223-```
224-
225-### Default Parameters
226-
227-```kotlin
228-fun getGreeting(person: Person, intro: String = "Hello,") {
229- return "$intro ${person.name}"
230-}
231-
232-// Returns "Hello, Adam"
233-val hello = getGreeting(Person("Adam"))
234-
235-// Returns "Welcome, Adam"
236-val welcome = getGreeting(Person("Adam"), "Welcome,")
237-```
238-
239-### Named Parameters
240-
241-```kotlin
242-class Person(val name: String = "", age: Int = 0)
243-
244-// All valid
245-val person = Person()
246-val person = Person("Adam", 100)
247-val person = Person(name = "Adam", age = 100)
248-val person = Person(age = 100)
249-val person = Person(age = 100, name = "Adam")
250-```
251-
252-### Static Functions
253-
254-```kotlin
255-class Fragment(val args: Bundle) {
256- companion object {
257- fun newInstance(args: Bundle): Fragment {
258- return Fragment(args)
259- }
260- }
261-}
262-
263-val fragment = Fragment.newInstance(args)
264-```
265-
266-* [Companion Objects](https://kotlinlang.org/docs/reference/object-declarations.html#companion-objects)
267-
268-Classes
269--------
270-{: .-two-column}
271-
272-### Primary Constructor
273-
274-```kotlin
275-class Person(val name: String, val age: Int)
276-val adam = Person("Adam", 100)
277-```
278-
279-### Secondary Constructors
280-
281-```kotlin
282-class Person(val name: String) {
283- private var age: Int? = null
284-
285- constructor(name: String, age: Int) : this(name) {
286- this.age = age
287- }
288-}
289-
290-// Above can be replaced with default params
291-class Person(val name: String, val age: Int? = null)
292-```
293-
294-### Inheritance & Implementation
295-
296-```kotlin
297-open class Vehicle
298-class Car : Vehicle()
299-
300-interface Runner {
301- fun run()
302-}
303-
304-class Machine : Runner {
305- override fun run() {
306- // ...
307- }
308-}
309-```
310-
311-Control Flow
312-------------
313-{: .-two-column}
314-
315-### If Statements
316-
317-```kotlin
318-if (someBoolean) {
319- doThing()
320-} else {
321- doOtherThing()
322-}
323-```
324-
325-### For Loops
326-
327-```kotlin
328-for (i in 0..10) { } // 1 - 10
329-for (i in 0 until 10) // 1 - 9
330-(0..10).forEach { }
331-for (i in 0 until 10 step 2) // 0, 2, 4, 6, 8
332-```
333-
334-### When Statements
335-
336-```kotlin
337-when (direction) {
338- NORTH -> {
339- print("North")
340- }
341- SOUTH -> print("South")
342- EAST, WEST -> print("East or West")
343- "N/A" -> print("Unavailable")
344- else -> print("Invalid Direction")
345-}
346-```
347-
348-### While Loops
349-
350-```kotlin
351-while (x > 0) {
352- x--
353-}
354-
355-do {
356- x--
357-} while (x > 0)
358-```
359-
360-Destructuring Declarations
361---------------------------
362-{: .-two-column}
363-
364-### Objects & Lists
365-
366-```kotlin
367-val person = Person("Adam", 100)
368-val (name, age) = person
369-
370-val pair = Pair(1, 2)
371-val (first, second) = pair
372-
373-val coordinates = arrayOf(1, 2, 3)
374-val (x, y, z) = coordinates
375-```
376-
377-### ComponentN Functions
378-
379-```kotlin
380-class Person(val name: String, val age: Int) {
381- operator fun component1(): String {
382- return name
383- }
384-
385- operator fun component2(): Int {
386- return age
387- }
388-}
389-```
390-
391-References
392-----------
393-{: .-one-column}
394-
395-* [Defining Variables](https://kotlinlang.org/docs/reference/basic-syntax.html#defining-variables) _(kotlinlang.org)_
396-* [Strings Documentation](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) _(kotlinlang.org)_
397-* [String Templates](https://kotlinlang.org/docs/reference/basic-types.html#string-templates) _(kotlinlang.org)_
398-* [Basic Types](https://kotlinlang.org/docs/reference/basic-types.html) _(kotlinlang.org)_
399-* [Companion Objects](https://kotlinlang.org/docs/reference/object-declarations.html#companion-objects) _(kotlinlang.org)_
400-* [Null Safety](https://kotlinlang.org/docs/reference/null-safety.html) _(kotlinlang.org)_
401-* [Collections Overview](https://kotlinlang.org/docs/reference/collections.html) _(kotlinlang.org)_
402-* [Collections Documentation](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/index.html) _(kotlinlang.org)_
403-* [Functions Documentation](https://kotlinlang.org/docs/reference/functions.html) _(kotlinlang.org)_
404-* [Classes Documentation](https://kotlinlang.org/docs/reference/classes.html) _(kotlinlang.org)_
405-* [Destructuring Declarations](https://kotlinlang.org/docs/reference/multi-declarations.html) _(kotlinlang.org)_
406-
407-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
408-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,308 +0,0 @@
2----
3-title: Ledger CLI
4-category: Ledger
5-layout: 2017/sheet
6-updated: 2020-05-23
7-weight: -5
8----
9-
10-### Basic usage
11-
12-```bash
13-$ ledger bal
14-$ ledger reg
15-```
16-
17-```bash
18-$ ledger reg grocery # show entries for 'grocery'
19-$ ledger bal assets # check if i'm broke
20-```
21-
22-```bash
23- -b 01/01 # --begin
24- -e 01/31 # --end
25- -S date # --sort
26- -S amount
27-```
28-
29-### Examples
30-
31-```bash
32-# any/all matches
33- ledger bal Rent Transportation # any
34- ledger bal Income and Job # all
35- ledger bal Expenses and not (Drinks or Food)
36-```
37-
38-```bash
39-# what did I spend on most? (--sorted)
40- ledger reg Expenses -S amount
41-```
42-
43-```bash
44-# how much did I have at this date? (--end)
45- ledger bal -e 01/15 ^Assets ^Liabilities
46-```
47-
48-```bash
49-# how much did I spend and earn this month?
50- ledger bal ^Expenses ^Income --invert
51-```
52-
53-```bash
54-# how much was spent over the course of 3 days? (totalled)
55- ledger reg -b 01/25 -e 01/27 --subtotal
56- ledger reg -b 01/25 -e 01/27 --subtotal grocery
57-```
58-
59-Format
60-------
61-
62-### Basic format
63-
64-```
65-2013/01/03 * Rent for January
66- Expenses:Rent $600.00
67- Assets:Savings
68-```
69-
70-`*` = cleared, `!` = pending
71-
72-### Secondary dates
73-
74-```
75-2008/01/01=2008/01/14 Client invoice
76-```
77-
78-It can mean anything you want, eg, for the estimated date you'll be paid.
79-
80-### Balance assertions
81-
82-```
83-2008/01/01 * KFC
84- Expenses:Food $20
85- Assets:Cash $-20 = $500
86-```
87-{: data-line="3"}
88-
89-`Cash $X = $500` ensures Cash is at $500 after the transaction.
90-
91-### Balance assignment
92-
93-```bash
94-2008/01/01 * Cash balance
95- Assets:Cash = $500
96- Equity:Adjustments
97-
98-2008/01/01 * KFC
99- Expenses:Food $20
100- Assets:Cash = $500
101-```
102-{: data-line="2,7"}
103-
104-`ACCOUNT = $500` figures out what's needed to make it $500.
105-
106-### Payables
107-
108-```bash
109-2008/04/25 * Rent
110- (Assets:Checking) -$200
111- Expenses:Rent
112-```
113-{: data-line="2"}
114-
115-### Commodities
116-
117-```bash
118-; cost per item
119-2010/05/31 * Market
120- Assets:Fridge 35 apples @ $0.42
121- Assets:Cash
122-```
123-{: data-line="3"}
124-
125-```bash
126-; total cost
127-2010/05/31 * Market
128- Assets:Fridge 35 apples @@ $14.70
129- Assets:Cash
130-```
131-{: data-line="3"}
132-
133-```bash
134-; fixed lot prices
135-2010/05/31 * Gas
136- Expenses:Gasoline 11 GAL {=$2.299}
137- Assets:Cash
138-```
139-{: data-line="3"}
140-
141-### Commodity definitions
142-
143-```
144-commodity $
145- note American Dollars
146- format $1,000.00
147- nomarket
148- default
149-```
150-
151-### Budgeting
152-
153-```
154-~ Monthly
155- Expenses:Rent $500
156- Expenses:Food $100
157- Expenses $40 ; everything else
158- Assets
159-
160-~ Yearly
161-```
162-
163-```bash
164-ledger bal --budget Expenses
165-ledger bal --unbudgeted Expenses
166-```
167-{: .-setup}
168-
169-### Comments
170-
171- ; line comment
172- # also line comment
173- % also line comment
174- | also line comment
175- * also line comment
176-
177-Querying
178---------
179-
180-### Periods
181-
182-```
183-[interval] [begin] [end]
184-```
185-
186-```
187-interval:
188- every day|week|month|quarter|year
189- every N days|weeks|...
190- daily|weekly|...
191-```
192-
193-```
194-begin:
195- from <spec>
196-end:
197- to <spec>
198-```
199-
200-```
201-spec:
202- 2004
203- 2004/10/1
204-```
205-
206-```bash
207-$ ledger bal|reg --period "until aug"
208-$ ledger bal|reg --period "last oct"
209-$ ledger bal|reg --period "every week"
210-```
211-{: .-setup}
212-
213-### Register
214-
215-```bash
216-$ ledger reg
217-```
218-{: .-setup}
219-
220-```bash
221- -D, --daily
222- -W, --weekly
223- -M, --monthly
224- --quarterly
225- -Y, --yearly
226- -s, --subtotal
227- --start-of-week monday
228-```
229-
230-```bash
231- -S, --sort date
232- -S, --sort amount
233-```
234-
235-### Filters
236-
237-```bash
238--b, --begin DATE
239--e, --end DATE
240-
241--d payee =~ /pioneer/
242-
243--C, --cleared # (with *)
244--U, --uncleared # (no *)
245- --pending # (with !)
246-
247--R, --real # ignore virtual postings (eg: "(Cash) $-400")
248--L, --actual # no automated postings (eg: "= /^Income/")
249-
250--r, --related # show the other side
251- # "reg -r savings" shows where it comes from)
252-```
253-
254-### Queries
255-
256- ^regex$
257- @payee
258- %tag
259- %tag=value
260- =note
261- #code
262- term and term
263- term or term
264- not term
265- \( term \)
266-
267-Example:
268-
269- ledger r ^expenses and @Denny's
270- ledger r food and @Starbucks and not dining
271-
272-### Display
273-
274-```bash
275--n, --collapse # [register] collapse entries
276- # [balance] no grand total
277--s, --subtotal # [balance] show sub-accounts
278- # [other] show subtotals
279---flat
280-```
281-
282-### Effective dates
283-
284-```bash
285-2008/01/01=2008/01/14 Client invoice ; estimated date you'll be paid
286- Assets:Accounts Receivable $100.00
287- Income: Client name
288-```
289-{: data-line="1"}
290-
291-Say you're in business. If you bill a customer, you can enter something like above.
292-Then, when you receive the payment, you change it to:
293-
294-```bash
295-2008/01/01=2008/01/15 Client invoice ; actual date money received
296- Assets:Accounts Receivable $100.00
297- Income: Client name
298-```
299-{: data-line="1"}
300-
301-## References
302-{: .-one-column}
303-
304-* <http://ledger-cli.org/3.0/doc/ledger3.html>
305-* <https://gist.github.com/agaviria/3317397>
306-{: .-also-see}
307-
308-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
309-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,45 +0,0 @@
2----
3-title: Less.js
4----
5-
6-### Functions
7-
8- unit(30px / 5px) #=> 6
9- unit(5, px) #=> 5px
10-
11- e("ms:stuff()") #=> ms:stuff() (unquote)
12-
13- %("count: %d", 1+2) #=> "count: 3"
14-
15- iscolor(@x)
16- isstring(@x)
17- isnumber(@x)
18- iskeyword(@x)
19- isurl(url(...))
20- ispixel()
21- isem()
22- ispercentage()
23- isunit()
24-
25- hue(@color)
26- saturation(@color)
27- lightness(@color)
28- luma(@color)
29- luminance(@color)
30-
31- fade(@color, amount)
32- fadein(@color, amount)
33- fadeout(@color, amount)
34- spin(@color, degrees)
35- mix(@a, @b, amount)
36-
37-### Conditionals
38-
39- .image when (luma(@color) > 50%) { }
40- .image when (not(...)) { }
41- .image when (default()) {}
42- .image when (e(@shape) = 'circle') { }
43-
44-
45-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
46-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,303 +0,0 @@
2----
3-title: Lua
4----
5-
6-## Comments
7-
8- -- comment
9- --[[ Multiline
10- comment ]]
11-
12-## Invoking functions
13-
14- print()
15- print("Hi")
16-
17- -- You can omit parentheses if the argument is one string or table literal
18- print "Hello World" <--> print("Hello World")
19- dofile 'a.lua' <--> dofile ('a.lua')
20- print [[a multi-line <--> print([[a multi-line
21- message]] message]])
22- f{x=10, y=20} <--> f({x=10, y=20})
23- type{} <--> type({})
24-
25-## Tables / arrays
26-
27- t = {}
28- t = { a = 1, b = 2 }
29- t.a = function() ... end
30-
31- t = { ["hello"] = 200 }
32- t.hello
33-
34- -- Remember, arrays are also tables
35- array = { "a", "b", "c", "d" }
36- print(array[2]) -- "b" (one-indexed)
37- print(#array) -- 4 (length)
38-
39-## Loops
40-
41- while condition do
42- end
43-
44- for i = 1,5 do
45- end
46-
47- for i = start,finish,delta do
48- end
49-
50- for k,v in pairs(tab) do
51- end
52-
53- repeat
54- until condition
55-
56- -- Breaking out:
57- while x do
58- if condition then break end
59- end
60-
61-## Conditionals
62-
63- if condition then
64- print("yes")
65- elseif condition then
66- print("maybe")
67- else
68- print("no")
69- end
70-
71-## Variables
72-
73- local x = 2
74- two, four = 2, 4
75-
76-## Functions
77-
78- function myFunction()
79- return 1
80- end
81-
82- function myFunctionWithArgs(a, b)
83- -- ...
84- end
85-
86- myFunction()
87-
88- anonymousFunctions(function()
89- -- ...
90- end)
91-
92- -- Not exported in the module
93- local function myPrivateFunction()
94- end
95-
96- -- Splats
97- function doAction(action, ...)
98- print("Doing '"..action.."' to", ...)
99- --> print("Doing 'write' to", "Shirley", "Abed")
100- end
101-
102- doAction('write', "Shirley", "Abed")
103-
104-## Lookups
105-
106- mytable = { x = 2, y = function() .. end }
107-
108- -- The same:
109- mytable.x
110- mytable['x']
111-
112- -- Syntactic sugar, these are equivalent:
113- mytable.y(mytable)
114- mytable:y()
115-
116- mytable.y(mytable, a, b)
117- mytable:y(a, b)
118-
119- function X:y(z) .. end
120- function X.y(self, z) .. end
121-
122-## Metatables
123-
124-
125- mt = {}
126-
127- -- A metatable is simply a table with functions in it.
128- mt.__tostring = function() return "lol" end
129- mt.__add = function(b) ... end -- a + b
130- mt.__mul = function(b) ... end -- a * b
131- mt.__index = function(k) ... end -- Lookups (a[k] or a.k)
132- mt.__newindex = function(k, v) ... end -- Setters (a[k] = v)
133-
134- -- Metatables allow you to override behavior of another table.
135- mytable = {}
136- setmetatable(mytable, mt)
137-
138- print(myobject)
139-
140-## Classes
141-
142- Account = {}
143-
144- function Account:new(balance)
145- local t = setmetatable({}, { __index = Account })
146-
147- -- Your constructor stuff
148- t.balance = (balance or 0)
149- return t
150- end
151-
152- function Account:withdraw(amount)
153- print("Withdrawing "..amount.."...")
154- self.balance = self.balance - amount
155- self:report()
156- end
157-
158- function Account:report()
159- print("Your current balance is: "..self.balance)
160- end
161-
162- a = Account:new(9000)
163- a:withdraw(200) -- method call
164-
165-## Constants
166-
167- nil
168- false
169- true
170-
171-## Operators (and their metatable names)
172-
173- -- Relational (binary)
174- -- __eq __lt __gt __le __ge
175- == < > <= >=
176- ~= -- Not equal, just like !=
177-
178- -- Arithmetic (binary)
179- -- __add __sub __muv __div __mod __pow
180- + - * / % ^
181-
182- -- Arithmetic (unary)
183- -- __unm (unary minus)
184- -
185-
186- -- Logic (and/or)
187- nil and false --> nil
188- false and nil --> false
189- 0 and 20 --> 20
190- 10 and 20 --> 20
191-
192-
193- -- Length
194- -- __len(array)
195- #array
196-
197-
198- -- Indexing
199- -- __index(table, key)
200- t[key]
201- t.key
202-
203- -- __newindex(table, key, value)
204- t[key]=value
205-
206- -- String concat
207- -- __concat(left, right)
208- "hello, "..name
209-
210- -- Call
211- -- __call(func, ...)
212-
213-
214-## API: Global functions [(ref)](http://lua.gts-stolberg.de/en/Basis.php)
215-
216- dofile("hello.lua")
217- loadfile("hello.lua")
218-
219- assert(x) -- x or (raise an error)
220- assert(x, "failed")
221-
222- type(var) -- "nil" | "number" | "string" | "boolean" | "table" | "function" | "thread" | "userdata"
223-
224- -- Does /not/ invoke meta methods (__index and __newindex)
225- rawset(t, index, value) -- Like t[index] = value
226- rawget(t, index) -- Like t[index]
227-
228- _G -- Global context
229- setfenv(1, {}) -- 1: current function, 2: caller, and so on -- {}: the new _G
230-
231- pairs(t) -- iterable list of {key, value}
232- ipairs(t) -- iterable list of {index, value}
233-
234- tonumber("34")
235- tonumber("8f", 16)
236-
237-## API: Strings
238-
239- 'string'..'concatenation'
240-
241- s = "Hello"
242- s:upper()
243- s:lower()
244- s:len() -- Just like #s
245-
246- s:find()
247- s:gfind()
248-
249- s:match()
250- s:gmatch()
251-
252- s:sub()
253- s:gsub()
254-
255- s:rep()
256- s:char()
257- s:dump()
258- s:reverse()
259- s:byte()
260- s:format()
261-
262-## API: Tables
263-
264- table.foreach(t, function(row) ... end)
265- table.setn
266- table.insert(t, 21) -- append (--> t[#t+1] = 21)
267- table.insert(t, 4, 99)
268- table.getn
269- table.concat
270- table.sort
271- table.remove(t, 4)
272-
273-## API: Math [(ref)](http://lua-users.org/wiki/MathLibraryTutorial)
274-
275- math.abs math.acos math.asin math.atan math.atan2
276- math.ceil math.cos math.cosh math.deg math.exp
277- math.floor math.fmod math.frexp math.ldexp math.log
278- math.log10 math.max math.min math.modf math.pow
279- math.rad math.random math.randomseed math.sin math.sinh
280- math.sqrt math.tan math.tanh
281-
282- math.sqrt(144)
283- math
284-
285-## API: Misc
286-
287- io.output(io.open("file.txt", "w"))
288- io.write(x)
289- io.close()
290-
291- for line in io.lines("file.txt")
292-
293- file = assert(io.open("file.txt", "r"))
294- file:read()
295- file:lines()
296- file:close()
297-
298-## Reference
299-
300- https://www.lua.org/pil/13.html
301- http://lua-users.org/wiki/ObjectOrientedProgramming
302-
303-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
304-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,132 +0,0 @@
2----
3-title: Makefile
4-prism_languages: [makefile]
5-layout: 2017/sheet
6-category: CLI
7----
8-
9-## Var assignment
10-
11-```makefile
12-foo = "bar"
13-bar = $(foo) foo # dynamic (renewing) assignment
14-foo := "boo" # one time assignment, $(bar) now is "boo foo"
15-foo ?= /usr/local # safe assignment, $(foo) and $(bar) still the same
16-bar += world # append, "boo foo world"
17-foo != echo fooo # exec shell command and assign to foo
18-# $(bar) now is "fooo foo world"
19-```
20-
21-`=` expressions are only evaluated when they're being used.
22-
23-## Magic variables
24-
25-```makefile
26-out.o: src.c src.h
27- $@ # "out.o" (target)
28- $< # "src.c" (first prerequisite)
29- $^ # "src.c src.h" (all prerequisites)
30-
31-%.o: %.c
32- $* # the 'stem' with which an implicit rule matches ("foo" in "foo.c")
33-
34-also:
35- $+ # prerequisites (all, with duplication)
36- $? # prerequisites (new ones)
37- $| # prerequisites (order-only?)
38-
39- $(@D) # target directory
40-```
41-
42-## Command prefixes
43-
44-| Prefix | Description |
45-| ------ | ------------------------------------------- |
46-| `-` | Ignore errors |
47-| `@` | Don't print command |
48-| `+` | Run even if Make is in 'don't execute' mode |
49-
50-```makefile
51-build:
52- @echo "compiling"
53- -gcc $< $@
54-
55--include .depend
56-```
57-
58-## Find files
59-
60-```makefile
61-js_files := $(wildcard test/*.js)
62-all_files := $(shell find images -name "*")
63-```
64-
65-## Substitutions
66-
67-```makefile
68-file = $(SOURCE:.cpp=.o) # foo.cpp => foo.o
69-outputs = $(files:src/%.coffee=lib/%.js)
70-
71-outputs = $(patsubst %.c, %.o, $(wildcard *.c))
72-assets = $(patsubst images/%, assets/%, $(wildcard images/*))
73-```
74-
75-## More functions
76-
77-```makefile
78-$(strip $(string_var))
79-
80-$(filter %.less, $(files))
81-$(filter-out %.less, $(files))
82-```
83-
84-## Building files
85-
86-```makefile
87-%.o: %.c
88- ffmpeg -i $< > $@ # Input and output
89- foo $^
90-```
91-
92-## Includes
93-
94-```makefile
95--include foo.make
96-```
97-
98-## Options
99-
100-```sh
101-make
102- -e, --environment-overrides
103- -B, --always-make
104- -s, --silent
105- -j, --jobs=N # parallel processing
106-```
107-
108-## Conditionals
109-
110-```makefile
111-foo: $(objects)
112-ifeq ($(CC),gcc)
113- $(CC) -o foo $(objects) $(libs_for_gcc)
114-else
115- $(CC) -o foo $(objects) $(normal_libs)
116-endif
117-```
118-
119-## Recursive
120-
121-```makefile
122-deploy:
123- $(MAKE) deploy2
124-```
125-
126-## Further reading
127-
128-- [isaacs's Makefile](https://gist.github.com/isaacs/62a2d1825d04437c6f08)
129-- [Your Makefiles are wrong](https://tech.davis-hansson.com/p/make/)
130-- [Manual](https://www.gnu.org/software/make/manual/html_node/index.html)
131-
132-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
133-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,21 +0,0 @@
2----
3-title: Man
4-category: CLI
5-layout: 2017/sheet
6----
7-
8-### Man paths
9-
10-| `1` | General User Commands |
11-| `2` | System Calls |
12-| `3` | Library Routines |
13-| `4` | Special Files and Sockets |
14-| `5` | File formats and Conventions |
15-| `6` | Games and Fun Stuff |
16-| `7` | Miscellaneous Documentation |
17-| `8` | System Administration |
18-| `9` | Kernel and Programming Style |
19-| `n` | Tcl/Tk |
20-
21-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
22-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,167 +0,0 @@
2----
3-title: Markdown
4-category: Markup
5-layout: 2017/sheet
6-prism_languages: [markdown]
7-updated: 2020-07-01
8-weight: -1
9----
10-
11-## Reference
12-{:.-three-column}
13-
14-### Headers
15-
16-```markdown
17-# h1
18-## h2
19-### h3
20-#### h4
21-##### h5
22-###### h6
23-```
24-
25-```markdown
26-Header 1
27-========
28-```
29-
30-```markdown
31-Header 2
32---------
33-```
34-
35-### Emphasis
36-
37-```markdown
38-*italic*
39-_italic_
40-```
41-
42-```markdown
43-**bold**
44-__bold__
45-```
46-
47-```markdown
48-***bold italic***
49-___bold italic___
50-```
51-
52-```markdown
53-~~strikethrough~~
54-```
55-
56-```markdown
57-`code`
58-```
59-
60-### Lists
61-
62-```markdown
63-* Item 1
64-* Item 2
65-```
66-
67-```markdown
68-- Item 1
69-- Item 2
70-```
71-
72-```markdown
73-- [ ] Checkbox off
74-- [x] Checkbox on
75-```
76-
77-```markdown
78-1. Item 1
79-2. Item 2
80-```
81-
82-### Links
83-
84-```markdown
85-[link](http://google.com)
86-```
87-
88-```markdown
89-[link][google]
90-[google]: http://google.com
91-```
92-
93-```markdown
94-<http://google.com>
95-```
96-
97-### Images
98-
99-```markdown
100-
101-
102-![Image alt text][img]
103-```
104-
105-```markdown
106-[img]: http://foo.com/img.jpg
107-```
108-
109-### Code
110-
111-```markdown
112-`inline code`
113-```
114-
115-```
116- 4 space indent
117- makes a code block
118-```
119-
120-~~~markdown
121-```
122-code fences
123-```
124-~~~
125-
126-
127-~~~markdown
128-```js
129-codeFences.withLanguage()
130-```
131-~~~
132-
133-### Blockquotes
134-
135-```markdown
136-> This is
137-> a blockquote
138->
139-> > Nested
140-> > Blockquote
141-```
142-
143-### Horizontal line
144-
145-```markdown
146-----
147-```
148-
149-```markdown
150-****
151-```
152-
153-### Tables
154-
155-```markdown
156-| Column 1 Heading | Column 2 Heading |
157-| ---------------- | ---------------- |
158-| Some content | Other content |
159-```
160-
161-```markdown
162-Column 1 Heading | Column 2 Heading
163---- | ---
164-Some content | Other content
165-```
166-
167-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
168-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,271 +0,0 @@
2----
3-title: MySQL
4-updated: 2020-07-05
5-layout: 2017/sheet
6-category: Databases
7----
8-
9-### Browsing
10-
11-```sql
12-SHOW DATABASES;
13-SHOW TABLES;
14-SHOW FIELDS FROM table / DESCRIBE table;
15-SHOW CREATE TABLE table;
16-SHOW PROCESSLIST;
17-KILL process_number;
18-```
19-
20-### Select
21-
22-```sql
23-SELECT * FROM table;
24-SELECT * FROM table1, table2;
25-SELECT field1, field2 FROM table1, table2;
26-SELECT ... FROM ... WHERE condition
27-SELECT ... FROM ... WHERE condition GROUP BY field;
28-SELECT ... FROM ... WHERE condition GROUP BY field HAVING condition2;
29-SELECT ... FROM ... WHERE condition ORDER BY field1, field2;
30-SELECT ... FROM ... WHERE condition ORDER BY field1, field2 DESC;
31-SELECT ... FROM ... WHERE condition LIMIT 10;
32-SELECT DISTINCT field1 FROM ...
33-SELECT DISTINCT field1, field2 FROM ...
34-```
35-
36-### Select - Join
37-
38-```sql
39-SELECT ... FROM t1 JOIN t2 ON t1.id1 = t2.id2 WHERE condition;
40-SELECT ... FROM t1 LEFT JOIN t2 ON t1.id1 = t2.id2 WHERE condition;
41-SELECT ... FROM t1 JOIN (t2 JOIN t3 ON ...) ON ...
42-```
43-
44-### Conditions
45-
46-```sql
47-field1 = value1
48-field1 <> value1
49-field1 LIKE 'value _ %'
50-field1 IS NULL
51-field1 IS NOT NULL
52-field1 IS IN (value1, value2)
53-field1 IS NOT IN (value1, value2)
54-condition1 AND condition2
55-condition1 OR condition2
56-```
57-
58-### Create / Open / Delete Database
59-
60-```sql
61-CREATE DATABASE DatabaseName;
62-CREATE DATABASE DatabaseName CHARACTER SET utf8;
63-USE DatabaseName;
64-DROP DATABASE DatabaseName;
65-ALTER DATABASE DatabaseName CHARACTER SET utf8;
66-```
67-
68-### Backup Database to SQL File
69-
70-```bash
71-mysqldump -u Username -p dbNameYouWant > databasename_backup.sql
72-```
73-
74-### Restore from backup SQL File
75-
76-```bash
77-mysql -u Username -p dbNameYouWant < databasename_backup.sql;
78-```
79-
80-### Repair Tables After Unclean Shutdown
81-
82-```bash
83-mysqlcheck --all-databases;
84-mysqlcheck --all-databases --fast;
85-```
86-
87-### Insert
88-
89-```sql
90-INSERT INTO table1 (field1, field2) VALUES (value1, value2);
91-```
92-
93-### Delete
94-
95-```sql
96-DELETE FROM table1 / TRUNCATE table1
97-DELETE FROM table1 WHERE condition
98-DELETE FROM table1, table2 WHERE table1.id1 =
99- table2.id2 AND condition
100-```
101-
102-### Update
103-
104-```sql
105-UPDATE table1 SET field1=new_value1 WHERE condition;
106-UPDATE table1, table2 SET field1=new_value1, field2=new_value2, ... WHERE
107- table1.id1 = table2.id2 AND condition;
108-```
109-
110-### Create / Delete / Modify Table
111-
112-#### Create
113-
114-```sql
115-CREATE TABLE table (field1 type1, field2 type2);
116-CREATE TABLE table (field1 type1, field2 type2, INDEX (field));
117-CREATE TABLE table (field1 type1, field2 type2, PRIMARY KEY (field1));
118-CREATE TABLE table (field1 type1, field2 type2, PRIMARY KEY (field1,field2));
119-```
120-
121-```sql
122-CREATE TABLE table1 (fk_field1 type1, field2 type2, ...,
123- FOREIGN KEY (fk_field1) REFERENCES table2 (t2_fieldA))
124- [ON UPDATE|ON DELETE] [CASCADE|SET NULL]
125-```
126-
127-```sql
128-CREATE TABLE table1 (fk_field1 type1, fk_field2 type2, ...,
129- FOREIGN KEY (fk_field1, fk_field2) REFERENCES table2 (t2_fieldA, t2_fieldB))
130-```
131-
132-```sql
133-CREATE TABLE table IF NOT EXISTS;
134-```
135-
136-```sql
137-CREATE TEMPORARY TABLE table;
138-```
139-
140-#### Drop
141-
142-```sql
143-DROP TABLE table;
144-DROP TABLE IF EXISTS table;
145-DROP TABLE table1, table2, ...
146-```
147-
148-#### Alter
149-
150-```sql
151-ALTER TABLE table MODIFY field1 type1
152-ALTER TABLE table MODIFY field1 type1 NOT NULL ...
153-ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1
154-ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1 NOT NULL ...
155-ALTER TABLE table ALTER field1 SET DEFAULT ...
156-ALTER TABLE table ALTER field1 DROP DEFAULT
157-ALTER TABLE table ADD new_name_field1 type1
158-ALTER TABLE table ADD new_name_field1 type1 FIRST
159-ALTER TABLE table ADD new_name_field1 type1 AFTER another_field
160-ALTER TABLE table DROP field1
161-ALTER TABLE table ADD INDEX (field);
162-```
163-
164-#### Change field order
165-
166-```sql
167-ALTER TABLE table MODIFY field1 type1 FIRST
168-ALTER TABLE table MODIFY field1 type1 AFTER another_field
169-ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1 FIRST
170-ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1 AFTER
171- another_field
172-```
173-
174-### Keys
175-
176-```sql
177-CREATE TABLE table (..., PRIMARY KEY (field1, field2))
178-CREATE TABLE table (..., FOREIGN KEY (field1, field2) REFERENCES table2
179-(t2_field1, t2_field2))
180-```
181-
182-### Users and Privileges
183-
184-```sql
185-CREATE USER 'user'@'localhost';
186-GRANT ALL PRIVILEGES ON base.* TO 'user'@'localhost' IDENTIFIED BY 'password';
187-GRANT SELECT, INSERT, DELETE ON base.* TO 'user'@'localhost' IDENTIFIED BY 'password';
188-REVOKE ALL PRIVILEGES ON base.* FROM 'user'@'host'; -- one permission only
189-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'host'; -- all permissions
190-FLUSH PRIVILEGES;
191-```
192-
193-```sql
194-SET PASSWORD = PASSWORD('new_pass');
195-SET PASSWORD FOR 'user'@'host' = PASSWORD('new_pass');
196-SET PASSWORD = OLD_PASSWORD('new_pass');
197-```
198-
199-```sql
200-DROP USER 'user'@'host';
201-```
202-
203-Host ‘%’ indicates any host.
204-
205-### Main Data Types
206-
207-```sql
208-TINYINT (1o: -128 to +127)
209-SMALLINT (2o: +-65 000)
210-MEDIUMINT (3o: +-16 000 000)
211-INT (4o: +- 2 000 000 000)
212-BIGINT (8o: +-9.10^18)
213-```
214-
215-```sql
216-Precise interval: -(2^(8*N-1)) -> (2^8*N)-1
217-```
218-
219-⚠ INT(2) = "2 digits displayed" -- NOT "number with 2 digits max"
220-
221-```sql
222-FLOAT(M,D)
223-DOUBLE(M,D)
224-FLOAT(D=0->53)
225-```
226-
227-⚠ 8,3 -> 12345,678 -- NOT 12345678,123!
228-
229-```sql
230-TIME (HH:MM)
231-YEAR (AAAA)
232-DATE (AAAA-MM-JJ)
233-DATETIME (AAAA-MM-JJ HH:MM; années 1000->9999)
234-TIMESTAMP (like DATETIME, but 1970->2038, compatible with Unix)
235-```
236-
237-```sql
238-VARCHAR (single-line; explicit size)
239-TEXT (multi-lines; max size=65535)
240-BLOB (binary; max size=65535)
241-```
242-
243-Variants for TEXT&BLOB: `TINY` (max=255), `MEDIUM` (max=~16000), and `LONG` (max=4Go). Ex: `VARCHAR(32)`, `TINYTEXT`, `LONGBLOB`, `MEDIUMTEXT`
244-
245-```sql
246-ENUM ('value1', 'value2', ...) -- (default NULL, or '' if NOT NULL)
247-```
248-
249-### Reset Root Password
250-
251-```bash
252-$ /etc/init.d/mysql stop
253-```
254-
255-```bash
256-$ mysqld_safe --skip-grant-tables
257-```
258-
259-```bash
260-$ mysql # on another terminal
261-mysql> UPDATE mysql.user SET password=PASSWORD('new_pass') WHERE user='root';
262-```
263-
264-```bash
265-## Switch back to the mysqld_safe terminal and kill the process using Control + \
266-$ /etc/init.d/mysql start
267-```
268-
269-Your commands may vary depending on your OS.
270-
271-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
272-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,116 +0,0 @@
2----
3-title: Org Mode
4-layout: 2017/sheet
5-tags: [WIP]
6-category: Apps
7-updated: 2018-02-19
8-intro: |
9- [Org mode](https://orgmode.org/) is for keeping hierarchal notes (and more) in Emacs.
10----
11-
12-## Syntax
13-{: .-three-column}
14-
15-### Headings
16-
17-```org
18-* Welcome to Org mode
19-
20- Lines starting with * are headings.
21- These lines without are notes.
22-
23-** Sub-heading
24-
25- Two stars mark a 2nd-level subheading (h2).
26-```
27-
28-### Lists
29-
30-```org
31-* Lists
32-
33-To buy:
34-1. Milk
35-2. Eggs
36- - Organic
37-3. Cheese
38- + Parmesan
39- + Mozarella
40-```
41-
42-### Inline styles
43-
44-```org
45-*bold*
46-/italic/
47-_underline_
48-=verbatim=
49-~code~
50-+strike-through+
51-```
52-
53-### To do
54-
55-```org
56-* TODO buy airplane
57-```
58-
59-Cycle by using `S-LEFT` / `S-RIGHT`. List all TODO's via `C-c C-v`.
60-
61-## Shortcuts
62-{: .-three-column}
63-
64-### Basic shortcuts
65-
66-| Description | Shortcut |
67-| --- | --- |
68-| (Un) fold | `TAB` / `S-TAB` |
69-| Move up | `M-UP` / `M-DOWN` |
70-| New headline | `M-RET` |
71-| Cycle workflow | `S-LEFT` / `S-RIGHT` |
72-| Cycle priority | `S-UP` / `S-DOWN` |
73-{:.-shortcuts-right}
74-
75-### Timer
76-
77-| Description | Shortcut |
78-| --- | --- |
79-| Start timer | `C-c` `C-x` `0` |
80-| Stop timer | `C-c` `C-x` `_` |
81-| Pause timer | `C-c` `C-x` `,` |
82-| --- | --- |
83-| Start countdown | `C-c` `C-x` `;` |
84-{:.-shortcuts-right}
85-
86-You can use this for Pomodoro!
87-
88-### Agenda
89-
90-| Description | Shortcut |
91-| --- | --- |
92-| Agenda menu | `C-c` `a` |
93-| --- | --- |
94-| Add document | `C-c` `[` |
95-| Remove document | `C-c` `]` |
96-| --- | --- |
97-| Add date | `C-c` `.` |
98-| Add time & date | `C-u` `C-c` `.` |
99-{:.-shortcuts-right}
100-
101-Start by adding the current file to the agenda (`C-c [`), then use the agenda menu to navigate.
102-
103-### Export
104-
105-| Description | Shortcut |
106-| --- | --- |
107-| Export menu | `C-c` `C-e` |
108-
109-Lets you export the document as Markdown, HTML, and others.
110-
111-## References
112-
113-- [Org for beginners](https://orgmode.org/worg/org-tutorials/org4beginners.html) _(orgmode.org)_
114-- [Org mode website](https://orgmode.org/) _(orgmode.org)_
115-
116-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
117-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,27 +0,0 @@
2----
3-title: PostgreSQL
4-category: Databases
5----
6-
7-Replace anything within `<placeholder>` accordingly
8-
9-### Console
10-
11- $ psql #logs in to default database & default user
12- $ sudo -u <rolename:postgres> psql #logs in with a particular user
13-
14-### Commands
15-
16- * Show roles: `\du`
17- * Show tables: `\dt`
18- * Show databases: `\l`
19- * Connect to a database: `\c <database>`
20- * Show columns of a table: `\d <table>` or `\d+ <table>`
21- * Quit: `\q`
22-
23-### Creating database
24-
25- $ createdb databasename
26-
27-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
28-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,170 +0,0 @@
2----
3-title: Python
4-category: Python
5----
6-
7-### Tuples (immutable)
8-
9- tuple = ()
10-
11-### Lists (mutable)
12-
13- list = []
14- list[i:j] # returns list subset
15- list[-1] # returns last element
16- list[:-1] # returns all but the last element
17- *list # expands all elements in place
18-
19- list[i] = val
20- list[i:j] = otherlist # replace ith to jth-1 elements with otherlist
21- del list[i:j]
22-
23- list.append(item)
24- list.extend(another_list)
25- list.insert(index, item)
26- list.pop() # returns and removes last element from the list
27- list.pop(i) # returns and removes i-th element from the list
28- list.remove(i) # removes the first item from the list whose value is i
29- list1 + list2 # combine two list
30- set(list) # remove duplicate elements from a list
31-
32- list.reverse() # reverses the elements of the list in-place
33- list.count(item)
34- sum(list)
35-
36- zip(list1, list2) # returns list of tuples with n-th element of both list1 and list2
37- list.sort() # sorts in-place, returns None
38- sorted(list) # returns sorted copy of list
39- ",".join(list) # returns a string with list elements seperated by comma
40-
41-### Dict
42-
43- dict = {}
44- dict.keys()
45- dict.values()
46- "key" in dict # let's say this returns False, then...
47- dict["key"] # ...this raises KeyError
48- dict.get("key") # ...this returns None
49- dict.setdefault("key", 1)
50- **dict # expands all k/v pairs in place
51-
52-### Iteration
53-
54- for item in ["a", "b", "c"]:
55- for i in range(4): # 0 to 3
56- for i in range(4, 8): # 4 to 7
57- for i in range(1, 9, 2): # 1, 3, 5, 7
58- for key, val in dict.items():
59- for index, item in enumerate(list):
60-
61-### [String](https://docs.python.org/2/library/stdtypes.html#string-methods)
62-
63- str[0:4]
64- len(str)
65-
66- string.replace("-", " ")
67- ",".join(list)
68- "hi {0}".format('j')
69- f"hi {name}" # same as "hi {}".format('name')
70- str.find(",")
71- str.index(",") # same, but raises IndexError
72- str.count(",")
73- str.split(",")
74-
75- str.lower()
76- str.upper()
77- str.title()
78-
79- str.lstrip()
80- str.rstrip()
81- str.strip()
82-
83- str.islower()
84-
85- /* escape characters */
86- >>> 'doesn\'t' # use \' to escape the single quote...
87- "doesn't"
88- >>> "doesn't" # ...or use double quotes instead
89- "doesn't"
90- >>> '"Yes," they said.'
91- '"Yes," they said.'
92- >>> "\"Yes,\" they said."
93- '"Yes," they said.'
94- >>> '"Isn\'t," they said.'
95- '"Isn\'t," they said.'
96-
97-### Casting
98-
99- int(str)
100- float(str)
101- str(int)
102- str(float)
103- 'string'.encode()
104-
105-### Comprehensions
106-
107- [fn(i) for i in list] # .map
108- map(fn, list) # .map, returns iterator
109-
110- filter(fn, list) # .filter, returns iterator
111- [fn(i) for i in list if i > 0] # .filter.map
112-
113-### Regex
114-
115- import re
116-
117- re.match(r'^[aeiou]', str)
118- re.sub(r'^[aeiou]', '?', str)
119- re.sub(r'(xyz)', r'\1', str)
120-
121- expr = re.compile(r'^...$')
122- expr.match(...)
123- expr.sub(...)
124-
125-## File manipulation
126-
127-### Reading
128-
129-```py
130-file = open("hello.txt", "r") # open in read mode 'r'
131-file.close()
132-```
133-
134-```py
135-print(file.read()) # read the entire file and set the cursor at the end of file
136-print file.readline() # Reading one line
137-file.seek(0, 0) # place the cursor at the beginning of the file
138-```
139-
140-### Writing (overwrite)
141-
142-```py
143-file = open("hello.txt", "w") # open in write mode 'w'
144-file.write("Hello World")
145-
146-text_lines = ["First line", "Second line", "Last line"]
147-file.writelines(text_lines)
148-
149-file.close()
150-```
151-
152-### Writing (append)
153-
154-```py
155-file = open("Hello.txt", "a") # open in append mode
156-file.write("Hello World again")
157-file.close()
158-```
159-
160-### Context manager
161-
162-```py
163-with open("welcome.txt", "r") as file:
164- # 'file' refers directly to "welcome.txt"
165- data = file.read()
166-
167-# It closes the file automatically at the end of scope, no need for `file.close()`.
168-```
169-
170-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
171-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,38 +0,0 @@
2----
3-title: Rake
4-category: Ruby
5-layout: 2017/sheet
6----
7-
8-### Basic syntax
9-
10-```rb
11-namespace :foo do
12- desc "Description"
13- task :bar do
14- ...
15- end
16-
17- task :baz => :dependency do
18- end
19-
20- task :baz => [:dep1, :dep2, :dep3] do
21- end
22-end
23-
24-# rake foo:bar
25-```
26-
27-### Rake task with arguments
28-
29-```rb
30-desc "Do something"
31-task :workit, [:id] => :environment do |_, args|
32- id = args[:id]
33-end
34-
35-# rake workit[234]
36-```
37-
38-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
39-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,34 +0,0 @@
2----
3-title: Ruby
4-category: Ruby
5-tags: [WIP]
6-layout: 2017/sheet
7-intro: |
8- Quick reference to some features of the Ruby programming language.
9----
10-
11-### Reference
12-
13-{:.-one-column}
14-
15-| Code | Description |
16-| ----------------------- | --------------------------------------------------------- |
17-| `$!` | latest error message |
18-| `$@` | location of error |
19-| `$_` | string last read by gets |
20-| `$.` | line number last read by interpreter |
21-| `$&` | string last matched by regexp |
22-| `$~` | the last regexp match, as an array of subexpressions |
23-| `$n` | the nth subexpression in the last match (same as `$~[n]`) |
24-| `$=` | case-insensitivity flag |
25-| `$/` | input record separator |
26-| `$\` | output record separator |
27-| `$0` | the name of the ruby script file |
28-| `$*` (or `ARGV`) | the command line arguments |
29-| `$$` | interpreter's process ID |
30-| `$?` | exit status of last executed child process |
31-| `$-i` `$-l` `$-p` `$-v` | Command line switches |
32-| `$-v` (or `$VERBOSE`) | verbose mode |
33-
34-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
35-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,59 +0,0 @@
2----
3-title: sed
4-category: CLI
5-layout: 2017/sheet
6-intro: |
7- Here's some hints on using sed.
8----
9-
10-## In place replacements
11-
12-### In-place replacement (GNU)
13-
14-```bash
15-sed -i -e 's/foo/bar/' example.md
16-```
17-
18-In GNU sed: use `-i` without arg.
19-
20-#### In-place replacement (BSD)
21-
22-```bash
23-sed -i '' -e 's/foo/bar/' example.md
24-```
25-
26- In OSX, `-i ''` is required.
27-
28-## File regions
29-{:.-three-column}
30-
31-### Print until a certain line is met
32-
33-```bash
34-sed '/begin api/q'
35-```
36-
37-### Print until a certain line is met, but not that line
38-
39-```bash
40-sed '/^# begin/,$d'
41-```
42-
43-### Print everything after a given line
44-
45-```bash
46-sed -n '/end api/,$p'
47-```
48-
49-Print after a given line is found.
50-
51-### Print everything except matching
52-
53-```bash
54-sed -n '/regex/!p'
55-```
56-
57-Print everything except lines matching regex. Useful for printing files with comments.
58-
59-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
60-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,843 +0,0 @@
2----
3-title: Bash scripting
4-category: CLI
5-layout: 2017/sheet
6-tags: [Featured]
7-updated: 2020-07-05
8-keywords:
9- - Variables
10- - Functions
11- - Interpolation
12- - Brace expansions
13- - Loops
14- - Conditional execution
15- - Command substitution
16----
17-
18-Getting started
19----------------
20-{: .-three-column}
21-
22-### Introduction
23-{: .-intro}
24-
25-This is a quick reference to getting started with Bash scripting.
26-
27-- [Learn bash in y minutes](https://learnxinyminutes.com/docs/bash/) _(learnxinyminutes.com)_
28-- [Bash Guide](http://mywiki.wooledge.org/BashGuide) _(mywiki.wooledge.org)_
29-- [Bash Hackers Wiki](https://wiki.bash-hackers.org) _(wiki.bash-hackers.org)_
30-
31-### Example
32-
33-```bash
34-#!/usr/bin/env bash
35-
36-name="John"
37-echo "Hello $name!"
38-```
39-
40-### Variables
41-
42-```bash
43-name="John"
44-echo $name # see below
45-echo "$name"
46-echo "${name}!"
47-```
48-Generally quote your variables unless they contain wildcards to expand or command fragments.
49-
50-```bash
51-wildcard="*.txt"
52-option="iv"
53-cp -$options $wildcard /tmp
54-```
55-
56-### String quotes
57-
58-```bash
59-name="John"
60-echo "Hi $name" #=> Hi John
61-echo 'Hi $name' #=> Hi $name
62-```
63-
64-### Shell execution
65-
66-```bash
67-echo "I'm in $(pwd)"
68-echo "I'm in `pwd`" # obsolescent
69-# Same
70-```
71-
72-See [Command substitution](http://wiki.bash-hackers.org/syntax/expansion/cmdsubst)
73-
74-### Conditional execution
75-
76-```bash
77-git commit && git push
78-git commit || echo "Commit failed"
79-```
80-
81-### Functions
82-{: id='functions-example'}
83-
84-```bash
85-get_name() {
86- echo "John"
87-}
88-
89-echo "You are $(get_name)"
90-```
91-
92-See: [Functions](#functions)
93-
94-### Conditionals
95-{: id='conditionals-example'}
96-
97-```bash
98-if [[ -z "$string" ]]; then
99- echo "String is empty"
100-elif [[ -n "$string" ]]; then
101- echo "String is not empty"
102-fi
103-```
104-
105-See: [Conditionals](#conditionals)
106-
107-### Strict mode
108-
109-```bash
110-set -euo pipefail
111-IFS=$'\n\t'
112-```
113-
114-See: [Unofficial bash strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/)
115-
116-### Brace expansion
117-
118-```bash
119-echo {A,B}.js
120-```
121-
122-| Expression | Description |
123-| ---------- | ------------------- |
124-| `{A,B}` | Same as `A B` |
125-| `{A,B}.js` | Same as `A.js B.js` |
126-| `{1..5}` | Same as `1 2 3 4 5` |
127-
128-See: [Brace expansion](http://wiki.bash-hackers.org/syntax/expansion/brace)
129-
130-
131-Parameter expansions
132---------------------
133-{: .-three-column}
134-
135-### Basics
136-
137-```bash
138-name="John"
139-echo "${name}"
140-echo "${name/J/j}" #=> "john" (substitution)
141-echo "${name:0:2}" #=> "Jo" (slicing)
142-echo "${name::2}" #=> "Jo" (slicing)
143-echo "${name::-1}" #=> "Joh" (slicing)
144-echo "${name:(-1)}" #=> "n" (slicing from right)
145-echo "${name:(-2):1}" #=> "h" (slicing from right)
146-echo "${food:-Cake}" #=> $food or "Cake"
147-```
148-
149-```bash
150-length=2
151-echo "${name:0:length}" #=> "Jo"
152-```
153-
154-See: [Parameter expansion](http://wiki.bash-hackers.org/syntax/pe)
155-
156-```bash
157-str="/path/to/foo.cpp"
158-echo "${str%.cpp}" # /path/to/foo
159-echo "${str%.cpp}.o" # /path/to/foo.o
160-echo "${str%/*}" # /path/to
161-
162-echo "${str##*.}" # cpp (extension)
163-echo "${str##*/}" # foo.cpp (basepath)
164-
165-echo "${str#*/}" # path/to/foo.cpp
166-echo "${str##*/}" # foo.cpp
167-
168-echo "${str/foo/bar}" # /path/to/bar.cpp
169-```
170-
171-```bash
172-str="Hello world"
173-echo "${str:6:5}" # "world"
174-echo "${str: -5:5}" # "world"
175-```
176-
177-```bash
178-src="/path/to/foo.cpp"
179-base=${src##*/} #=> "foo.cpp" (basepath)
180-dir=${src%$base} #=> "/path/to/" (dirpath)
181-```
182-
183-### Substitution
184-
185-| Code | Description |
186-| ----------------- | ------------------- |
187-| `${foo%suffix}` | Remove suffix |
188-| `${foo#prefix}` | Remove prefix |
189-| --- | --- |
190-| `${foo%%suffix}` | Remove long suffix |
191-| `${foo##prefix}` | Remove long prefix |
192-| --- | --- |
193-| `${foo/from/to}` | Replace first match |
194-| `${foo//from/to}` | Replace all |
195-| --- | --- |
196-| `${foo/%from/to}` | Replace suffix |
197-| `${foo/#from/to}` | Replace prefix |
198-
199-### Comments
200-
201-```bash
202-# Single line comment
203-```
204-
205-```bash
206-: '
207-This is a
208-multi line
209-comment
210-'
211-```
212-
213-### Substrings
214-
215-| Expression | Description |
216-| --------------- | ------------------------------ |
217-| `${foo:0:3}` | Substring _(position, length)_ |
218-| `${foo:(-3):3}` | Substring from the right |
219-
220-### Length
221-
222-| Expression | Description |
223-| ---------- | ---------------- |
224-| `${#foo}` | Length of `$foo` |
225-
226-### Manipulation
227-
228-```bash
229-str="HELLO WORLD!"
230-echo "${str,}" #=> "hELLO WORLD!" (lowercase 1st letter)
231-echo "${str,,}" #=> "hello world!" (all lowercase)
232-
233-str="hello world!"
234-echo "${str^}" #=> "Hello world!" (uppercase 1st letter)
235-echo "${str^^}" #=> "HELLO WORLD!" (all uppercase)
236-```
237-
238-### Default values
239-
240-| Expression | Description |
241-| ----------------- | -------------------------------------------------------- |
242-| `${foo:-val}` | `$foo`, or `val` if unset (or null) |
243-| `${foo:=val}` | Set `$foo` to `val` if unset (or null) |
244-| `${foo:+val}` | `val` if `$foo` is set (and not null) |
245-| `${foo:?message}` | Show error message and exit if `$foo` is unset (or null) |
246-
247-Omitting the `:` removes the (non)nullity checks, e.g. `${foo-val}` expands to `val` if unset otherwise `$foo`.
248-
249-Loops
250------
251-{: .-three-column}
252-
253-### Basic for loop
254-
255-```bash
256-for i in /etc/rc.*; do
257- echo "$i"
258-done
259-```
260-
261-### C-like for loop
262-
263-```bash
264-for ((i = 0 ; i < 100 ; i++)); do
265- echo "$i"
266-done
267-```
268-
269-### Ranges
270-
271-```bash
272-for i in {1..5}; do
273- echo "Welcome $i"
274-done
275-```
276-
277-#### With step size
278-
279-```bash
280-for i in {5..50..5}; do
281- echo "Welcome $i"
282-done
283-```
284-
285-### Reading lines
286-
287-```bash
288-while read -r line; do
289- echo "$line"
290-done <file.txt
291-```
292-
293-### Forever
294-
295-```bash
296-while true; do
297- ···
298-done
299-```
300-
301-Functions
302----------
303-{: .-three-column}
304-
305-### Defining functions
306-
307-```bash
308-myfunc() {
309- echo "hello $1"
310-}
311-```
312-
313-```bash
314-# Same as above (alternate syntax)
315-function myfunc() {
316- echo "hello $1"
317-}
318-```
319-
320-```bash
321-myfunc "John"
322-```
323-
324-### Returning values
325-
326-```bash
327-myfunc() {
328- local myresult='some value'
329- echo "$myresult"
330-}
331-```
332-
333-```bash
334-result=$(myfunc)
335-```
336-
337-### Raising errors
338-
339-```bash
340-myfunc() {
341- return 1
342-}
343-```
344-
345-```bash
346-if myfunc; then
347- echo "success"
348-else
349- echo "failure"
350-fi
351-```
352-
353-### Arguments
354-
355-| Expression | Description |
356-| --- | --- |
357-| `$#` | Number of arguments |
358-| `$*` | All positional arguments (as a single word) |
359-| `$@` | All positional arguments (as separate strings) |
360-| `$1` | First argument |
361-| `$_` | Last argument of the previous command |
362-
363-**Note**: `$@` and `$*` must be quoted in order to perform as described.
364-Otherwise, they do exactly the same thing (arguments as separate strings).
365-
366-See [Special parameters](http://wiki.bash-hackers.org/syntax/shellvars#special_parameters_and_shell_variables).
367-
368-Conditionals
369-------------
370-{: .-three-column}
371-
372-### Conditions
373-
374-Note that `[[` is actually a command/program that returns either `0` (true) or `1` (false). Any program that obeys the same logic (like all base utils, such as `grep(1)` or `ping(1)`) can be used as condition, see examples.
375-
376-| Condition | Description |
377-| --- | --- |
378-| `[[ -z STRING ]]` | Empty string |
379-| `[[ -n STRING ]]` | Not empty string |
380-| `[[ STRING == STRING ]]` | Equal |
381-| `[[ STRING != STRING ]]` | Not Equal |
382-| --- | --- |
383-| `[[ NUM -eq NUM ]]` | Equal |
384-| `[[ NUM -ne NUM ]]` | Not equal |
385-| `[[ NUM -lt NUM ]]` | Less than |
386-| `[[ NUM -le NUM ]]` | Less than or equal |
387-| `[[ NUM -gt NUM ]]` | Greater than |
388-| `[[ NUM -ge NUM ]]` | Greater than or equal |
389-| --- | --- |
390-| `[[ STRING =~ STRING ]]` | Regexp |
391-| --- | --- |
392-| `(( NUM < NUM ))` | Numeric conditions |
393-
394-#### More conditions
395-
396-| Condition | Description |
397-| -------------------- | ------------------------ |
398-| `[[ -o noclobber ]]` | If OPTIONNAME is enabled |
399-| --- | --- |
400-| `[[ ! EXPR ]]` | Not |
401-| `[[ X && Y ]]` | And |
402-| `[[ X || Y ]]` | Or |
403-
404-### File conditions
405-
406-| Condition | Description |
407-| --- | --- |
408-| `[[ -e FILE ]]` | Exists |
409-| `[[ -r FILE ]]` | Readable |
410-| `[[ -h FILE ]]` | Symlink |
411-| `[[ -d FILE ]]` | Directory |
412-| `[[ -w FILE ]]` | Writable |
413-| `[[ -s FILE ]]` | Size is > 0 bytes |
414-| `[[ -f FILE ]]` | File |
415-| `[[ -x FILE ]]` | Executable |
416-| --- | --- |
417-| `[[ FILE1 -nt FILE2 ]]` | 1 is more recent than 2 |
418-| `[[ FILE1 -ot FILE2 ]]` | 2 is more recent than 1 |
419-| `[[ FILE1 -ef FILE2 ]]` | Same files |
420-
421-### Example
422-
423-```bash
424-# String
425-if [[ -z "$string" ]]; then
426- echo "String is empty"
427-elif [[ -n "$string" ]]; then
428- echo "String is not empty"
429-else
430- echo "This never happens"
431-fi
432-```
433-
434-```bash
435-# Combinations
436-if [[ X && Y ]]; then
437- ...
438-fi
439-```
440-
441-```bash
442-# Equal
443-if [[ "$A" == "$B" ]]
444-```
445-
446-```bash
447-# Regex
448-if [[ "A" =~ . ]]
449-```
450-
451-```bash
452-if (( $a < $b )); then
453- echo "$a is smaller than $b"
454-fi
455-```
456-
457-```bash
458-if [[ -e "file.txt" ]]; then
459- echo "file exists"
460-fi
461-```
462-
463-Arrays
464-------
465-
466-### Defining arrays
467-
468-```bash
469-Fruits=('Apple' 'Banana' 'Orange')
470-```
471-
472-```bash
473-Fruits[0]="Apple"
474-Fruits[1]="Banana"
475-Fruits[2]="Orange"
476-```
477-
478-### Working with arrays
479-
480-```bash
481-echo "${Fruits[0]}" # Element #0
482-echo "${Fruits[-1]}" # Last element
483-echo "${Fruits[@]}" # All elements, space-separated
484-echo "${#Fruits[@]}" # Number of elements
485-echo "${#Fruits}" # String length of the 1st element
486-echo "${#Fruits[3]}" # String length of the Nth element
487-echo "${Fruits[@]:3:2}" # Range (from position 3, length 2)
488-echo "${!Fruits[@]}" # Keys of all elements, space-separated
489-```
490-
491-### Operations
492-
493-```bash
494-Fruits=("${Fruits[@]}" "Watermelon") # Push
495-Fruits+=('Watermelon') # Also Push
496-Fruits=( "${Fruits[@]/Ap*/}" ) # Remove by regex match
497-unset Fruits[2] # Remove one item
498-Fruits=("${Fruits[@]}") # Duplicate
499-Fruits=("${Fruits[@]}" "${Veggies[@]}") # Concatenate
500-lines=(`cat "logfile"`) # Read from file
501-```
502-
503-### Iteration
504-
505-```bash
506-for i in "${arrayName[@]}"; do
507- echo "$i"
508-done
509-```
510-
511-Dictionaries
512-------------
513-{: .-three-column}
514-
515-### Defining
516-
517-```bash
518-declare -A sounds
519-```
520-
521-```bash
522-sounds[dog]="bark"
523-sounds[cow]="moo"
524-sounds[bird]="tweet"
525-sounds[wolf]="howl"
526-```
527-
528-Declares `sound` as a Dictionary object (aka associative array).
529-
530-### Working with dictionaries
531-
532-```bash
533-echo "${sounds[dog]}" # Dog's sound
534-echo "${sounds[@]}" # All values
535-echo "${!sounds[@]}" # All keys
536-echo "${#sounds[@]}" # Number of elements
537-unset sounds[dog] # Delete dog
538-```
539-
540-### Iteration
541-
542-#### Iterate over values
543-
544-```bash
545-for val in "${sounds[@]}"; do
546- echo "$val"
547-done
548-```
549-
550-#### Iterate over keys
551-
552-```bash
553-for key in "${!sounds[@]}"; do
554- echo "$key"
555-done
556-```
557-
558-Options
559--------
560-
561-### Options
562-
563-```bash
564-set -o noclobber # Avoid overlay files (echo "hi" > foo)
565-set -o errexit # Used to exit upon error, avoiding cascading errors
566-set -o pipefail # Unveils hidden failures
567-set -o nounset # Exposes unset variables
568-```
569-
570-### Glob options
571-
572-```bash
573-shopt -s nullglob # Non-matching globs are removed ('*.foo' => '')
574-shopt -s failglob # Non-matching globs throw errors
575-shopt -s nocaseglob # Case insensitive globs
576-shopt -s dotglob # Wildcards match dotfiles ("*.sh" => ".foo.sh")
577-shopt -s globstar # Allow ** for recursive matches ('lib/**/*.rb' => 'lib/a/b/c.rb')
578-```
579-
580-Set `GLOBIGNORE` as a colon-separated list of patterns to be removed from glob
581-matches.
582-
583-History
584--------
585-
586-### Commands
587-
588-| Command | Description |
589-| --------------------- | ----------------------------------------- |
590-| `history` | Show history |
591-| `shopt -s histverify` | Don't execute expanded result immediately |
592-
593-### Expansions
594-
595-| Expression | Description |
596-| ------------ | ---------------------------------------------------- |
597-| `!$` | Expand last parameter of most recent command |
598-| `!*` | Expand all parameters of most recent command |
599-| `!-n` | Expand `n`th most recent command |
600-| `!n` | Expand `n`th command in history |
601-| `!<command>` | Expand most recent invocation of command `<command>` |
602-
603-### Operations
604-
605-| Code | Description |
606-| -------------------- | --------------------------------------------------------------------- |
607-| `!!` | Execute last command again |
608-| `!!:s/<FROM>/<TO>/` | Replace first occurrence of `<FROM>` to `<TO>` in most recent command |
609-| `!!:gs/<FROM>/<TO>/` | Replace all occurrences of `<FROM>` to `<TO>` in most recent command |
610-| `!$:t` | Expand only basename from last parameter of most recent command |
611-| `!$:h` | Expand only directory from last parameter of most recent command |
612-
613-`!!` and `!$` can be replaced with any valid expansion.
614-
615-### Slices
616-
617-| Code | Description |
618-| -------- | ---------------------------------------------------------------------------------------- |
619-| `!!:n` | Expand only `n`th token from most recent command (command is `0`; first argument is `1`) |
620-| `!^` | Expand first argument from most recent command |
621-| `!$` | Expand last token from most recent command |
622-| `!!:n-m` | Expand range of tokens from most recent command |
623-| `!!:n-$` | Expand `n`th token to last from most recent command |
624-
625-`!!` can be replaced with any valid expansion i.e. `!cat`, `!-2`, `!42`, etc.
626-
627-
628-Miscellaneous
629--------------
630-
631-### Numeric calculations
632-
633-```bash
634-$((a + 200)) # Add 200 to $a
635-```
636-
637-```bash
638-$(($RANDOM%200)) # Random number 0..199
639-```
640-
641-### Subshells
642-
643-```bash
644-(cd somedir; echo "I'm now in $PWD")
645-pwd # still in first directory
646-```
647-
648-### Redirection
649-
650-```bash
651-python hello.py > output.txt # stdout to (file)
652-python hello.py >> output.txt # stdout to (file), append
653-python hello.py 2> error.log # stderr to (file)
654-python hello.py 2>&1 # stderr to stdout
655-python hello.py 2>/dev/null # stderr to (null)
656-python hello.py >output.txt 2>&1 # stdout and stderr to (file), equivalent to &>
657-python hello.py &>/dev/null # stdout and stderr to (null)
658-echo "$0: warning: too many users" >&2 # print diagnostic message to stderr
659-```
660-
661-```bash
662-python hello.py < foo.txt # feed foo.txt to stdin for python
663-diff <(ls -r) <(ls) # Compare two stdout without files
664-```
665-
666-### Inspecting commands
667-
668-```bash
669-command -V cd
670-#=> "cd is a function/alias/whatever"
671-```
672-
673-### Trap errors
674-
675-```bash
676-trap 'echo Error at about $LINENO' ERR
677-```
678-
679-or
680-
681-```bash
682-traperr() {
683- echo "ERROR: ${BASH_SOURCE[1]} at about ${BASH_LINENO[0]}"
684-}
685-
686-set -o errtrace
687-trap traperr ERR
688-```
689-
690-### Case/switch
691-
692-```bash
693-case "$1" in
694- start | up)
695- vagrant up
696- ;;
697-
698- *)
699- echo "Usage: $0 {start|stop|ssh}"
700- ;;
701-esac
702-```
703-
704-### Source relative
705-
706-```bash
707-source "${0%/*}/../share/foo.sh"
708-```
709-
710-### printf
711-
712-```bash
713-printf "Hello %s, I'm %s" Sven Olga
714-#=> "Hello Sven, I'm Olga
715-
716-printf "1 + 1 = %d" 2
717-#=> "1 + 1 = 2"
718-
719-printf "This is how you print a float: %f" 2
720-#=> "This is how you print a float: 2.000000"
721-
722-printf '%s\n' '#!/bin/bash' 'echo hello' >file
723-# format string is applied to each group of arguments
724-printf '%i+%i=%i\n' 1 2 3 4 5 9
725-```
726-
727-### Transform strings
728-
729-| Command option | Description |
730-| ------------------ | --------------------------------------------------- |
731-| `-c` | Operations apply to characters not in the given set |
732-| `-d` | Delete characters |
733-| `-s` | Replaces repeated characters with single occurrence |
734-| `-t` | Truncates |
735-| `[:upper:]` | All upper case letters |
736-| `[:lower:]` | All lower case letters |
737-| `[:digit:]` | All digits |
738-| `[:space:]` | All whitespace |
739-| `[:alpha:]` | All letters |
740-| `[:alnum:]` | All letters and digits |
741-
742-#### Example
743-
744-```bash
745-echo "Welcome To Devhints" | tr '[:lower:]' '[:upper:]'
746-WELCOME TO DEVHINTS
747-```
748-
749-### Directory of script
750-
751-```bash
752-dir=${0%/*}
753-```
754-
755-### Getting options
756-
757-```bash
758-while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
759- -V | --version )
760- echo "$version"
761- exit
762- ;;
763- -s | --string )
764- shift; string=$1
765- ;;
766- -f | --flag )
767- flag=1
768- ;;
769-esac; shift; done
770-if [[ "$1" == '--' ]]; then shift; fi
771-```
772-
773-### Heredoc
774-
775-```sh
776-cat <<END
777-hello world
778-END
779-```
780-
781-### Reading input
782-
783-```bash
784-echo -n "Proceed? [y/n]: "
785-read -r ans
786-echo "$ans"
787-```
788-
789-The `-r` option disables a peculiar legacy behavior with backslashes.
790-
791-```bash
792-read -n 1 ans # Just one character
793-```
794-
795-### Special variables
796-
797-| Expression | Description |
798-| ------------------ | -------------------------------------- |
799-| `$?` | Exit status of last task |
800-| `$!` | PID of last background task |
801-| `$$` | PID of shell |
802-| `$0` | Filename of the shell script |
803-| `$_` | Last argument of the previous command |
804-| `${PIPESTATUS[n]}` | return value of piped commands (array) |
805-
806-See [Special parameters](http://wiki.bash-hackers.org/syntax/shellvars#special_parameters_and_shell_variables).
807-
808-### Go to previous directory
809-
810-```bash
811-pwd # /home/user/foo
812-cd bar/
813-pwd # /home/user/foo/bar
814-cd -
815-pwd # /home/user/foo
816-```
817-
818-### Check for command's result
819-
820-```bash
821-if ping -c 1 google.com; then
822- echo "It appears you have a working internet connection"
823-fi
824-```
825-
826-### Grep check
827-
828-```bash
829-if grep -q 'foo' ~/.bash_history; then
830- echo "You appear to have typed 'foo' in the past"
831-fi
832-```
833-
834-## Also see
835-{: .-one-column}
836-
837-* [Bash-hackers wiki](http://wiki.bash-hackers.org/) _(bash-hackers.org)_
838-* [Shell vars](http://wiki.bash-hackers.org/syntax/shellvars) _(bash-hackers.org)_
839-* [Learn bash in y minutes](https://learnxinyminutes.com/docs/bash/) _(learnxinyminutes.com)_
840-* [Bash Guide](http://mywiki.wooledge.org/BashGuide) _(mywiki.wooledge.org)_
841-* [ShellCheck](https://www.shellcheck.net/) _(shellcheck.net)_
842-
843-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
844-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,27 +0,0 @@
2----
3-title: PostgreSQL
4-category: Databases
5----
6-
7-Replace anything within `<placeholder>` accordingly
8-
9-### Console
10-
11- $ psql #logs in to default database & default user
12- $ sudo -u <rolename:postgres> psql #logs in with a particular user
13-
14-### Commands
15-
16- * Show roles: `\du`
17- * Show tables: `\dt`
18- * Show databases: `\l`
19- * Connect to a database: `\c <database>`
20- * Show columns of a table: `\d <table>` or `\d+ <table>`
21- * Quit: `\q`
22-
23-### Creating database
24-
25- $ createdb databasename
26-
27-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
28-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,287 +0,0 @@
2----
3-title: TypeScript
4-category: JavaScript libraries
5----
6-
7-TypeScript is just like ES2015 with type-checking. All ES2015 (classes, etc) should work.
8-
9-## Basic types
10-
11-```ts
12-any
13-void
14-
15-boolean
16-number
17-string
18-
19-null
20-undefined
21-
22-bigint
23-symbol
24-
25-string[] /* or Array<string> */
26-[string, number] /* tuple */
27-
28-string | null | undefined /* union */
29-
30-never /* unreachable */
31-unknown
32-```
33-
34-```ts
35-enum Color {
36- Red,
37- Green,
38- Blue = 4
39-};
40-
41-let c: Color = Color.Green
42-```
43-
44-## Declarations
45-
46-```ts
47-let isDone: boolean
48-let isDone: boolean = false
49-```
50-
51-```ts
52-function add (a: number, b: number): number {
53- return a + b
54-}
55-
56-// Return type is optional
57-function add (a: number, b: number) { ... }
58-```
59-
60-## Type assertions
61-
62-#### Variables
63-```ts
64-let len: number = (input as string).length
65-let len: number = (<string> input).length /* not allowed in JSX */
66-```
67-
68-#### Functions
69-```ts
70-function object(this: {a: number, b: number}, a: number, b: number) {
71- this.a = a;
72- this.b = b;
73- return this;
74-}
75-
76-// this is used only for type declaration
77-let a = object(1,2);
78-// a has type {a: number, b: number}
79-```
80-
81-
82-## Interfaces
83-
84-### Inline
85-
86-```ts
87-function printLabel (options: { label: string }) {
88- console.log(options.label)
89-}
90-
91-// Note the semicolon
92-function getUser (): { name: string; age?: number } {
93-}
94-```
95-
96-### Explicit
97-
98-```ts
99-interface LabelOptions {
100- label: string
101-}
102-
103-function printLabel(options: LabelOptions) { ... }
104-```
105-
106-### Optional properties
107-
108-```ts
109-interface User {
110- name: string;
111- age?: number;
112-}
113-```
114-
115-### Read only
116-
117-```ts
118-interface User {
119- readonly name: string
120-}
121-```
122-
123-### Dynamic keys
124-
125-```ts
126-{
127- [key: string]: Object[]
128-}
129-```
130-
131-## Type aliases
132-
133-```ts
134-type Name = string | string[]
135-```
136-
137-### Intersection
138-
139-```ts
140-interface Colorful { ... }
141-
142-interface Circle { ... }
143-
144-type ColorfulCircle = Colorful & Circle;
145-```
146-
147-## Function types
148-
149-```ts
150-interface User { ... }
151-
152-function getUser(callback: (user: User) => any) { callback({...}) }
153-
154-getUser(function (user: User) { ... })
155-```
156-
157-## Classes
158-
159-```ts
160-class Point {
161- x: number
162- y: number
163- static instances = 0
164- constructor(x: number, y: number) {
165- this.x = x
166- this.y = y
167- }
168-}
169-```
170-
171-#### Inheritance
172-
173-```ts
174-class Point {...}
175-
176-class Point3D extends Point {...}
177-
178-interface Colored {...}
179-
180-class Pixel extends Point implements Colored {...}
181-```
182-
183-#### Short fields initialisation
184-
185-```ts
186-class Point {
187- static instances = 0;
188- constructor(
189- public x: number,
190- public y: number,
191- ){}
192-}
193-```
194-
195-#### Fields which do not require initialisation
196-```ts
197-class Point {
198- public someUselessValue!: number;
199- ...
200-}
201-```
202-
203-## Generics
204-
205-```ts
206-class Greeter<T> {
207- greeting: T
208- constructor(message: T) {
209- this.greeting = message
210- }
211-}
212-
213-let greeter = new Greeter<string>('Hello, world')
214-```
215-
216-## Modules
217-
218-```ts
219-export interface User { ... }
220-```
221-
222-## Type extraction
223-
224-```ts
225-interface Building {
226- room: {
227- door: string;
228- walls: string[];
229- };
230-}
231-
232-type Walls = Building['room']['walls']; // string[]
233-```
234-
235-## Keyof Type Operator
236-
237-```ts
238-type Point = { x: number; y: number };
239-
240-type P = keyof Point; // x | y
241-```
242-
243-## Conditinal Types
244-
245-```ts
246-// SomeType extends OtherType ? TrueType : FalseType;
247-
248-type ToArray<T> = T extends any ? T[] : never;
249-
250-type StrArrOrNumArr = ToArray<string | number>; // string[] | number[]
251-```
252-
253-### Inferring
254-
255-```ts
256-type GetReturnType<T> = T extends (...args: unknown[]) => infer R
257- ? R
258- : never;
259-
260-type Num = GetReturnType<() => number>; // number
261-```
262-
263-```ts
264-type First<T extends Array<any>> = T extends [infer F, ...infer Rest] ? F : never;
265-
266-type Str = First<['hello', 1, false]>; // 'hello'
267-```
268-
269-## Literal Type
270-
271-```ts
272-const point = { x: 4, y: 2 }; // { x: number, y: number }
273-
274-const literalPoint = { x: 4, y: 2 } as const; // { readonly x: 4, readonly y: 2 };
275-```
276-
277-## Template Literal Types
278-
279-```ts
280-type SpaceChar = ' ' | '\n' | '\t';
281-
282-type TrimLeft<S extends string> = S extends `${SpaceChar}${infer Rest}` ? TrimLeft<Rest> : S;
283-
284-type Str = TrimLeft<' hello'>; // 'hello'
285-```
286-
287-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
288-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,130 +0,0 @@
2----
3-title: Vagrantfile
4-category: Devops
5-layout: 2017/sheet
6----
7-
8-## Vagrantfile
9-{: .-one-column}
10-
11-```rb
12-Vagrant.configure("2") do |config|
13- # All Vagrant configuration is done here. The most common configuration
14- # options are documented and commented below. For a complete reference,
15- # please see the online documentation at vagrantup.com.
16-
17- # Every Vagrant virtual environment requires a box to build off of.
18- config.vm.box = "precise64"
19-
20- # The url from where the 'config.vm.box' box will be fetched if it
21- # doesn't already exist on the user's system.
22- # config.vm.box_url = "http://domain.com/path/to/above.box"
23-
24- # Create a forwarded port mapping which allows access to a specific port
25- # within the machine from a port on the host machine. In the example below,
26- # accessing "localhost:8080" will access port 80 on the guest machine.
27- # config.vm.network :forwarded_port, guest: 80, host: 8080
28-
29- # Create a private network, which allows host-only access to the machine
30- # using a specific IP.
31- # config.vm.network :private_network, ip: "192.168.33.10"
32-
33- # Create a public network, which generally matched to bridged network.
34- # Bridged networks make the machine appear as another physical device on
35- # your network.
36- # config.vm.network :public_network
37-
38- # If true, then any SSH connections made will enable agent forwarding.
39- # Default value: false
40- # config.ssh.forward_agent = true
41-
42- # Share an additional folder to the guest VM. The first argument is
43- # the path on the host to the actual folder. The second argument is
44- # the path on the guest to mount the folder. And the optional third
45- # argument is a set of non-required options.
46- # config.vm.synced_folder "../data", "/vagrant_data"
47-
48- # Provider-specific configuration so you can fine-tune various
49- # backing providers for Vagrant. These expose provider-specific options.
50- # Example for VirtualBox:
51- #
52- # config.vm.provider :virtualbox do |vb|
53- # # Don't boot with headless mode
54- # vb.gui = true
55- #
56- # # Use VBoxManage to customize the VM. For example to change memory:
57- # vb.customize ["modifyvm", :id, "--memory", "1024"]
58- # end
59- #
60- # View the documentation for the provider you're using for more
61- # information on available options.
62-
63- # Enable provisioning with Puppet stand alone. Puppet manifests
64- # are contained in a directory path relative to this Vagrantfile.
65- # You will need to create the manifests directory and a manifest in
66- # the file precise64.pp in the manifests_path directory.
67- #
68- # An example Puppet manifest to provision the message of the day:
69- #
70- # # group { "puppet":
71- # # ensure => "present",
72- # # }
73- # #
74- # # File { owner => 0, group => 0, mode => 0644 }
75- # #
76- # # file { '/etc/motd':
77- # # content => "Welcome to your Vagrant-built virtual machine!
78- # # Managed by Puppet.\n"
79- # # }
80- #
81- # config.vm.provision :puppet do |puppet|
82- # puppet.manifests_path = "manifests"
83- # puppet.manifest_file = "init.pp"
84- # end
85-
86- # Enable provisioning with chef solo, specifying a cookbooks path, roles
87- # path, and data_bags path (all relative to this Vagrantfile), and adding
88- # some recipes and/or roles.
89- #
90- # config.vm.provision :chef_solo do |chef|
91- # chef.cookbooks_path = "../my-recipes/cookbooks"
92- # chef.roles_path = "../my-recipes/roles"
93- # chef.data_bags_path = "../my-recipes/data_bags"
94- # chef.add_recipe "mysql"
95- # chef.add_role "web"
96- #
97- # # You may also specify custom JSON attributes:
98- # chef.json = { :mysql_password => "foo" }
99- # end
100-
101- # Enable provisioning with chef server, specifying the chef server URL,
102- # and the path to the validation key (relative to this Vagrantfile).
103- #
104- # The Opscode Platform uses HTTPS. Substitute your organization for
105- # ORGNAME in the URL and validation key.
106- #
107- # If you have your own Chef Server, use the appropriate URL, which may be
108- # HTTP instead of HTTPS depending on your configuration. Also change the
109- # validation key to validation.pem.
110- #
111- # config.vm.provision :chef_client do |chef|
112- # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
113- # chef.validation_key_path = "ORGNAME-validator.pem"
114- # end
115- #
116- # If you're using the Opscode platform, your validator client is
117- # ORGNAME-validator, replacing ORGNAME with your organization name.
118- #
119- # If you have your own Chef Server, the default validation client name is
120- # chef-validator, unless you changed the configuration.
121- #
122- # chef.validation_client_name = "ORGNAME-validator"
123-end
124-```
125-
126-## Also see
127-
128-* [Vagrant cheatsheet](./vagrant)
129-
130-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
131-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,147 +0,0 @@
2----
3-title: Vainglory
4-layout: 2017/sheet
5----
6-
7-## T3 items by use
8-{: .-one-column}
9-
10-| Use | CP | WP | Util |
11-| --- | --- | --- | --- |
12-| __Anti-armor/shield__ | [Myth][BM] | [Bonesaw][BS], [Tension][TB] | |
13-| __Stacking damage__ | [Myth][BM] | [Break][BP] | |
14-| __Lifesteal__ | [Eve][Eve] | [Serpent][SM], [Shiv][PS] | |
15-| __Raw power__ | [Shatterglass][SG] | [Sorrowblade][SB] | |
16-| __Burst damage__ | [Aftershock][AS] | [Tension][TB] | |
17-| __Attack speed__ | [AC][AC] | [Tornado][TT], [Break][BP] | |
18-| __Critical__ | | [Monocle][TM] | |
19-| __Auto-attack damage__ | [AC][AC], [Aftershock][AS] | _everything_ | [Stormcrown][SC] |
20-| __Cooldown__ | [Clockwork][CW], [Aftershock][AS] | Spellsword | [Stormcrown][SC], [Contraption][Con], [Nullwave][Null], [Halcyon Boots][HBoot] |
21-| __Slow__ | [Frostburn][FB] | | [Shiversteel][SS] |
22-| __Reflex block__ | | | [Aegis][Aegis] (self/shield) <br> [Crucible][Cru] (team/HP) |
23-| __Ability repeat__ | [Echo][Echo] | | |
24-{: .-left-align.-headers}
25-
26-## Tier 3 items
27-{: .-one-column}
28-
29-### Crystal power
30-
31-| Item | Cost | CP | Use |
32-| ---- | --- | --- | --- |
33-| AS: [Aftershock][AS] | 2400 | +35 cp | __Basic dmg, atk speed__ <br> *+basic dmg after ability*, +25% cooldown, +2.5 recharge |
34-| EoH: [Eve of Harvest][Eve] | 2600 | +55 cp | __Lifesteal__ <br> *+10% lifesteal*, +250 energy, +5 recharge |
35-| AC: [Alternating Current][AC] | 2800 | +60 cp | __Basic dmg__ <br> *+basic dmg based on CP*, +65% atk speed |
36-| BM: [Broken Myth][BM] | 2150 | +70 cp | __Stack dmg__ <br> +10% shield pierce, stacking dmg |
37-| FB: [Frostburn][FB] | 2600 | +100 cp | __Slow__ <br> *slow for 1.5s* at (10% + 1% per 10CP) |
38-| SG: [Shatterglass][SG] | 3000 | +150 cp | __Raw power__ <br> - |
39-| CW: [Clockwork][CW] | 2500 | +30% cp | __Cooldown__ <br> *+40% cooldown*, +250 energy, +7.5 recharge |
40-| [Echo][Echo] | 2500? | | __Ability repeat__ <br> +250 energy, +4 recharge |
41-{: .-left-align.-headers}
42-
43-[AS]: http://www.vaingloryfire.com/vainglory/wiki/items/aftershock
44-[AC]: http://www.vaingloryfire.com/vainglory/wiki/items/alternating-current
45-[Eve]: http://www.vaingloryfire.com/vainglory/wiki/items/eve-of-harvest
46-[SG]: http://www.vaingloryfire.com/vainglory/wiki/items/shatterglass
47-[BM]: http://www.vaingloryfire.com/vainglory/wiki/items/broken-myth
48-[CW]: http://www.vaingloryfire.com/vainglory/wiki/items/clockwork
49-[FB]: http://www.vaingloryfire.com/vainglory/wiki/items/frostburn
50-[Echo]: http://www.vaingloryfire.com/vainglory/wiki/items/echo
51-
52-### Weapon power
53-
54-| Item | Cost | WP | Other |
55-| ---- | --- | --- | --- |
56-| TT: [Tornado Trigger][TT] | 2600 | | __Atk speed__ <br> *+75% atk speed*, +20% crit change, +20% crit dmg |
57-| BS: [Bonesaw][BS] | 2700 | +15 wp | __Armor shred__ <br> *stacking armor shred* |
58-| TB: [Tension Bow][TB] | 2300 | +45 wp | __Bonus dmg__ <br> *bonus dmg every 6s*, +8% armor pierce |
59-| TM: [Tyrant's Monocle][TM] | 2750 | +50 wp | __Crit__ <br> *+40% crit chance*, +20% crit dmg |
60-| BP: [Breaking Point][BP] | 2600 | +55 wp | __Stacking dmg__ <br> *stacking weapon dmg*, +35% atk speed |
61-| SM: [Serpent Mask][SM] | 2800 | +85 wp | __Lifesteal__ <br> *stacking lifesteal*, +10% lifesteal |
62-| SB: [Sorrowblade][SB] | 3100 | +150 wp | __Raw power__ <br> - |
63-| PS: [Poisoned Shiv][PS] | 2250 | +30 wp | __Mortal wounds__ <br> *mortal wounds for 2s*, +10% lifesteal, +30% atk speed |
64-| SS: Spellsword | ? | +90 wp | __Cooldown__ <br> ? |
65-{: .-left-align.-headers}
66-
67-[BS]: http://www.vaingloryfire.com/vainglory/wiki/items/bonesaw
68-[BP]: http://www.vaingloryfire.com/vainglory/wiki/items/breaking-point
69-[SM]: http://www.vaingloryfire.com/vainglory/wiki/items/serpent-mask
70-[SB]: http://www.vaingloryfire.com/vainglory/wiki/items/sorrowblade
71-[TB]: http://www.vaingloryfire.com/vainglory/wiki/items/tension-bow
72-[TT]: http://www.vaingloryfire.com/vainglory/wiki/items/tornado-trigger
73-[TM]: http://www.vaingloryfire.com/vainglory/wiki/items/tyrants-monocle
74-[PS]: http://www.vaingloryfire.com/vainglory/wiki/items/poisoned-shiv
75-
76-### Utilities
77-
78-| Item | Cost | HP | Use |
79-| --- | --- | --- | --- |
80-| [Halcyon Chargers][HBoot] | 2300 | +200 hp | 👟 __Boots__ <br> +15% cooldown, +250 energy, +4 recharge |
81-| [Stormcrown][SC] | 2200 | +200 hp | 🔴 __Bonus dmg__ <br> +30% cooldown, +4 recharge, bonus true damage |
82-| [Journey Boots][JBoot] | 1900 | +250 hp | 👟 __Boots__ <br> damaging heroes resets sprint cooldown |
83-| [Nullwave Gauntlet][Null] (2.0) | 2250 | +300 hp | 😶 __Item silence__ <br> +25% cooldown |
84-| [Contraption][Con] | 2100 | +350 hp | 👀 __Vision__ <br> traps/flares, +40% cooldown, +3 recharge |
85-| [Shiversteel][SS] | 1450 | +500 hp | 🐌 __Slow__ <br> active: slow targets |
86-| [War Treads][WBoot] | 2500 | +600 hp | 👟 __Boots__ <br> gives sprint to nearby teammates |
87-{: .-left-align.-headers}
88-
89-### Defense
90-
91-| Item | Cost | HP | Armor | Shield | Use |
92-| --- | --- | --- | --- | --- | --- |
93-| [Aegis][Aegis] | 2250 | | +30 ar | +125 sh | ✊__Reflex block__ (self) |
94-| [Fountain of Renewal][Fountain] | 2300 | +200 hp | +30 ar | +75 sh | ❤ __Heal__ allies |
95-| [Atlas Pauldron][Atlas] | 1900 | | +85 ar | +35 sh | 🐌 __Slow__ target attack speed |
96-| [Metal Jacket][Metal] | 2100 | | +170 ar | +35 sh | |
97-| [Crucible][Cru] | 1850 | +600 hp | | | ✊ __Reflex block__ (team) |
98-| [Slumbering Husk][Husk] (2.0) | 1600 | +400 hp | | | __Fortification__ against burst damage |
99-{: .-left-align.-headers}
100-
101-[Fountain]: http://www.vaingloryfire.com/vainglory/wiki/items/fountain-of-renewal
102-[Cru]: http://www.vaingloryfire.com/vainglory/wiki/items/aegis
103-[Aegis]: http://www.vaingloryfire.com/vainglory/wiki/items/aegis
104-[Atlas]: http://www.vaingloryfire.com/vainglory/wiki/items/atlas-pauldron
105-[Metal]: http://www.vaingloryfire.com/vainglory/wiki/items/metal-jacket
106-[Husk]: http://www.vaingloryfire.com/vainglory/wiki/items/slumbering-husk
107-[Null]: http://www.vaingloryfire.com/vainglory/wiki/items/nullwave-gauntlet
108-
109-### Boots
110-
111-| Item | Movement speed | HP | Sprint | Use |
112-| --- | --- | --- | --- | --- |
113-| [War Treads][WBoot] | +0.4 | +600 hp | 2s (60s cooldown) <br> incl. nearby teammates | __HP, assist__ |
114-| [Halcyon Chargers][HBoot] | +0.5 | | 3s (50s cooldown) | __Energy__ |
115-| [Journey Boots][JBoot] | +0.6 | +250 hp | 2s (60s cooldown) <br> damaging resets cooldown | __Gap close__ |
116-{: .-left-align.-headers}
117-
118-[Con]: http://www.vaingloryfire.com/vainglory/wiki/items/contraption
119-[HBoot]: http://www.vaingloryfire.com/vainglory/wiki/items/halcyon-chargers
120-[WBoot]: http://www.vaingloryfire.com/vainglory/wiki/items/war-treads
121-[JBoot]: http://www.vaingloryfire.com/vainglory/wiki/items/journey-boots
122-[SC]: http://www.vaingloryfire.com/vainglory/wiki/items/stormcrown
123-[SS]: http://www.vaingloryfire.com/vainglory/wiki/items/shiversteel
124-
125-## Skill tier names
126-
127-| Just Beginning | 1 |
128-| Getting There | 2 |
129-| Rock Solid | 3 |
130-| Worthy Foe |4 |
131-| Got Swagger | 5 |
132-| Credible Threat | 6 |
133-| The Hotness | 7 |
134-| Simply Amazing | 8 |
135-| Pinnacle of Awesome | 9 |
136-| Vainglorious | 10 |
137-
138-See: [Skill tier names](http://www.vaingloryfire.com/vainglory/forum/general-discussion/bronze-silver-gold-rankings-5312)
139-
140-## References
141-
142-- Last updated for Vainglory 1.22 with some 2.0 stuff.
143-- [Vaingloryfire.com](http://www.vaingloryfire.com/)
144-- [Version history](http://forums.vainglorygame.com/index.php?threads/41129/) (forums.vainglorygame.com)
145-- [Skill tier points](http://brokenmyth.net/skill-tier-point-far-next-tier/#more-10043) (brokenmyth.net)
146-
147-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
148-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,720 +0,0 @@
2----
3-title: Vim scripting
4-category: Vim
5-prism_languages: [vim]
6-layout: 2017/sheet
7-updated: 2020-07-05
8-weight: -10
9-tags: [Featurable]
10----
11-
12-### Start hacking
13-
14-```vim
15-let name = "John"
16-echo "Hello, " . name
17-```
18-
19-You can either put this in a script (`script.vim`) and run it (`:source script.vim`), or you can type the commands individually in normal mode as `:let` and `:echo`.
20-
21-### Learn by example
22-
23-```vim
24-function! SuperTab()
25- let l:part = strpart(getline('.'),col('.')-2,1)
26- if (l:part =~ '^\W\?$')
27- return "\<Tab>"
28- else
29- return "\<C-n>"
30- endif
31-endfunction
32-
33-imap <Tab> <C-R>=SuperTab()<CR>
34-```
35-
36-[Here](http://www.vimbits.com/bits/46)'s another example with [functions](#functions), [variables](#variables) and [mapping](#mapping).
37-
38-Variables
39----------
40-
41-### Defining
42-{: .-prime}
43-
44-```vim
45-let var = "hello"
46-```
47-
48-### Variable prefixes
49-
50-```vim
51-let g:ack_options = '-s -H' " g: global
52-let s:ack_program = 'ack' " s: local (to script)
53-let l:foo = 'bar' " l: local (to function)
54-```
55-
56-The `s:` prefix is also available in function names. See `:help local-variables`
57-
58-### Other prefixes
59-
60-```vim
61-let w:foo = 'bar' " w: window
62-let b:state = 'on' " b: buffer
63-let t:state = 'off' " t: tab
64-echo v:var " v: vim special
65-```
66-
67-```vim
68-let @/ = '' " @ register (this clears last search pattern)
69-echo $PATH " $ env
70-```
71-
72-### Vim options
73-
74-```vim
75-echo 'tabstop is ' . &tabstop
76-if &insertmode
77-echo &g:option
78-echo &l:option
79-```
80-
81-Prefix Vim options with `&`
82-
83-### Operators
84-
85-```vim
86-a + b " numbers only!
87-'hello ' . name " concat
88-```
89-
90-```vim
91-let var -= 2
92-let var += 5
93-let var .= 'string' " concat
94-```
95-
96-## Strings
97-
98-### Strings
99-
100-```vim
101-let str = "String"
102-let str = "String with \n newline"
103-
104-let literal = 'literal, no \ escaping'
105-let literal = 'that''s enough' " double '' => '
106-
107-echo "result = " . re " concatenation
108-```
109-
110-Also see `:help literal-string` and `:help expr-quote`.
111-See: [Strings](http://learnvimscriptthehardway.stevelosh.com/chapters/26.html)
112-
113-### String functions
114-
115-```vim
116-strlen(str) " length
117-len(str) " same
118-strchars(str) " character length
119-
120-split("one two three") "=> ['one', 'two', 'three']
121-split("one.two.three", '.') "=> ['one', 'two', 'three']
122-
123-join(['a', 'b'], ',') "=> 'a,b'
124-
125-tolower('Hello')
126-toupper('Hello')
127-```
128-
129-Also see `:help functions`
130-See: [String functions](http://learnvimscriptthehardway.stevelosh.com/chapters/27.html)
131-
132-Functions
133----------
134-
135-### Functions
136-{: .-prime}
137-
138-```vim
139-" prefix with s: for local script-only functions
140-function! s:Initialize(cmd, args)
141- " a: prefix for arguments
142- echo "Command: " . a:cmd
143-
144- return 1
145-endfunction
146-```
147-
148-See: [Functions](http://learnvimscriptthehardway.stevelosh.com/chapters/23.html)
149-
150-### Namespacing
151-
152-```vim
153-function! myplugin#hello()
154-```
155-
156-### Calling functions
157-
158-```vim
159-call s:Initialize()
160-call s:Initialize("hello")
161-```
162-
163-### Consuming return values
164-
165-```vim
166-echo "Result: " . s:Initialize()
167-```
168-
169-### Abortable
170-
171-```vim
172-function! myfunction() abort
173-endfunction
174-```
175-
176-Aborts when an error occurs.
177-
178-### Var arguments
179-
180-```vim
181-function! infect(...)
182- echo a:0 "=> 2
183- echo a:1 "=> jake
184- echo a:2 "=> bella
185-
186- for s in a:000 " a list
187- echon ' ' . s
188- endfor
189-endfunction
190-
191-infect('jake', 'bella')
192-```
193-
194-See `:help function-argument`. See: [Var arguments](http://learnvimscriptthehardway.stevelosh.com/chapters/24.html)
195-
196-Loops
197------
198-
199-```vim
200-for s in list
201- echo s
202- continue " jump to start of loop
203- break " breaks out of a loop
204-endfor
205-```
206-
207-```vim
208-while x < 5
209-endwhile
210-```
211-
212-Custom commands
213----------------
214-
215-### Custom commands
216-{: .-prime}
217-
218-```vim
219-command! Save :set fo=want tw=80 nowrap
220-```
221-
222-Custom commands start with uppercase letters. The `!` redefines a command if it already exists.
223-
224-### Commands calling functions
225-
226-```vim
227-command! Save call <SID>foo()
228-```
229-{: .-setup}
230-
231-```vim
232-function! s:foo()
233- ...
234-endfunction
235-```
236-
237-### Commands with arguments
238-
239-```vim
240-command! -nargs=? Save call script#foo(<args>)
241-```
242-{: .-setup}
243-
244-| What | What |
245-| ---- | ---- |
246-| `-nargs=0` | 0 arguments, default |
247-| `-nargs=1` | 1 argument, includes spaces |
248-| `-nargs=?` | 0 or 1 argument |
249-| `-nargs=*` | 0+ arguments, space separated |
250-| `-nargs=+` | 1+ arguments, space reparated |
251-
252-Flow
253-----
254-
255-### Conditionals
256-
257-```vim
258-let char = getchar()
259-if char == "\<LeftMouse>"
260- " ...
261-elseif char == "\<RightMouse>"
262- " ...
263-else
264- " ...
265-endif
266-```
267-
268-### Truthiness
269-
270-```vim
271-if 1 | echo "true" | endif
272-if 0 | echo "false" | endif
273-```
274-
275-```vim
276-if 1 "=> 1 (true)
277-if 0 "=> 0 (false)
278-if "1" "=> 1 (true)
279-if "456" "=> 1 (true)
280-if "xfz" "=> 0 (false)
281-```
282-
283-No booleans. `0` is false, `1` is true.
284-See: [Truthiness](http://learnvimscriptthehardway.stevelosh.com/chapters/21.html)
285-
286-### Operators
287-
288-```vim
289-if 3 > 2
290-if a && b
291-if (a && b) || (c && d)
292-if !c
293-```
294-
295-See `:help expression-syntax`.
296-See: [Operators](http://learnvimscriptthehardway.stevelosh.com/chapters/22.html)
297-
298-### Strings
299-
300-```vim
301-if name ==# 'John' " case-sensitive
302-if name ==? 'John' " case-insensitive
303-if name == 'John' " depends on :set ignorecase
304-
305-" also: is#, is?, >=#, >=?, and so on
306-```
307-
308-### Identity operators
309-
310-```vim
311-a is b
312-a isnot b
313-```
314-
315-Checks if it's the same instance object.
316-
317-### Regexp matches
318-
319-```vim
320-"hello" =~ 'xx*'
321-"hello" !~ 'xx*'
322-"hello" =~ '\v<\d+>'
323-```
324-
325-`\v` enables "extended" regex mode which allows word boundary (`<>`), `+`, and more.
326-
327-### Single line
328-
329-```vim
330-if empty(a:path) | return [] | endif
331-a ? b : c
332-```
333-
334-Use `|` to join lines together.
335-
336-### Boolean logic
337-
338-```vim
339-if g:use_dispatch && s:has_dispatch
340- ···
341-endif
342-```
343-
344-Lists
345------
346-
347-### Lists
348-
349-```vim
350-let mylist = [1, two, 3, "four"]
351-
352-let first = mylist[0]
353-let last = mylist[-1]
354-
355-" Suppresses errors
356-let second = get(mylist, 1)
357-let second = get(mylist, 1, "NONE")
358-```
359-
360-### Functions
361-
362-```vim
363-len(mylist)
364-empty(mylist)
365-
366-sort(list)
367-let sortedlist = sort(copy(list))
368-
369-split('hello there world', ' ')
370-```
371-
372-### Concatenation
373-
374-```vim
375-let longlist = mylist + [5, 6]
376-let mylist += [7, 8]
377-```
378-
379-### Sublists
380-
381-```vim
382-let shortlist = mylist[2:-1]
383-let shortlist = mylist[2:] " same
384-
385-let shortlist = mylist[2:2] " one item
386-```
387-
388-### Push
389-
390-```vim
391-let alist = [1, 2, 3]
392-let alist = add(alist, 4)
393-```
394-
395-### Map
396-
397-```vim
398-call map(files, "bufname(v:val)") " use v:val for value
399-call filter(files, 'v:val != ""')
400-```
401-
402-Dictionaries
403-------------
404-
405-### Dictionaries
406-
407-```vim
408-let colors = {
409- \ "apple": "red",
410- \ "banana": "yellow"
411-}
412-
413-echo colors["a"]
414-echo get(colors, "apple") " suppress error
415-```
416-
417-See `:help dict`
418-
419-### Using dictionaries
420-
421-```vim
422-remove(colors, "apple")
423-```
424-
425-```vim
426-" :help E715
427-if has_key(dict, 'foo')
428-if empty(dict)
429-keys(dict)
430-len(dict)
431-```
432-
433-```vim
434-max(dict)
435-min(dict)
436-```
437-
438-```vim
439-count(dict, 'x')
440-string(dict)
441-```
442-
443-```vim
444-map(dict, '<>> " . v:val')
445-```
446-
447-### Iteration
448-
449-```vim
450-for key in keys(mydict)
451- echo key . ': ' . mydict(key)
452-endfor
453-```
454-
455-### Prefixes
456-
457-```vim
458-keys(s:)
459-```
460-
461-Prefixes (`s:`, `g:`, `l:`, etc) are actually dictionaries.
462-
463-### Extending
464-
465-```vim
466-" Extending with more
467-let extend(s:fruits, { ... })
468-```
469-
470-Casting
471--------
472-
473-```vim
474-str2float("2.3")
475-str2nr("3")
476-float2nr("3.14")
477-```
478-
479-Numbers
480--------
481-
482-### Numbers
483-{: .-prime}
484-
485-```vim
486-let int = 1000
487-let int = 0xff
488-let int = 0755 " octal
489-```
490-
491-See `:help Number`.
492-See: [Numbers](http://learnvimscriptthehardway.stevelosh.com/chapters/25.html)
493-
494-### Floats
495-
496-```vim
497-let fl = 100.1
498-let fl = 5.4e4
499-```
500-
501-See `:help Float`
502-
503-### Arithmetic
504-
505-```vim
506-3 / 2 "=> 1, integer division
507-3 / 2.0 "=> 1.5
508-3 * 2.0 "=> 6.0
509-```
510-
511-### Math functions
512-
513-```vim
514-sqrt(100)
515-floor(3.5)
516-ceil(3.3)
517-abs(-3.4)
518-
519-sin() cos() tan()
520-sinh() cosh() tanh()
521-asin() acos() atan()
522-```
523-
524-Vim-isms
525---------
526-
527-### Execute a command
528-
529-```vim
530-execute "vsplit"
531-execute "e " . fnameescape(filename)
532-```
533-
534-Runs an ex command you typically run with `:`. Also see `:help execute`.
535-See: [Execute a command](http://learnvimscriptthehardway.stevelosh.com/chapters/28.html)
536-
537-### Running keystrokes
538-
539-```vim
540-normal G
541-normal! G " skips key mappings
542-
543-execute "normal! gg/foo\<cr>dd"
544-```
545-
546-Use `:normal` to execute keystrokes as if you're typing them in normal mode. Combine with `:execute` for special keystrokes.
547-See: [Running keystrokes](http://learnvimscriptthehardway.stevelosh.com/chapters/29.html)
548-
549-### Getting filenames
550-
551-```vim
552-echo expand("%") " path/file.txt
553-echo expand("%:t") " file.txt
554-echo expand("%:p:h") " /home/you/path/file.txt
555-echo expand("%:r") " path/file
556-echo expand("%:e") " txt
557-```
558-
559-See `:help expand`
560-
561-### Silencing
562-
563-```vim
564-silent g/Aap/p
565-```
566-
567-Suppresses output. See `:help silent`
568-
569-### Echo
570-
571-```vim
572-echoerr 'oh it failed'
573-echomsg 'hello there'
574-echo 'hello'
575-
576-echohl WarningMsg | echomsg "=> " . a:msg | echohl None
577-```
578-
579-
580-### Settings
581-
582-```vim
583-set number
584-set nonumber
585-set number! " toggle
586-set numberwidth=5
587-set guioptions+=e
588-```
589-
590-### Prompts
591-
592-```vim
593-let result = confirm("Sure?")
594-execute "confirm q"
595-```
596-
597-### Built-ins
598-
599-```vim
600-has("feature") " :h feature-list
601-executable("python")
602-globpath(&rtp, "syntax/c.vim")
603-
604-exists("$ENV")
605-exists(":command")
606-exists("variable")
607-exists("+option")
608-exists("g:...")
609-```
610-
611-Mapping
612--------
613-{: .-three-column}
614-
615-### Mapping commands
616-
617-```vim
618-nmap
619-vmap
620-imap
621-xmap
622-nnoremap
623-vnoremap
624-inoremap
625-xnoremap
626-...
627-```
628-
629-### Explanation
630-
631-```vim
632-[nvixso](nore)map
633-```
634-
635-```
636- │ └ don't recurse
637- │
638- └ normal, visual, insert,
639- eX mode, select, operator-pending
640-```
641-{: .-setup}
642-
643-### Arguments
644-
645-| `<buffer>` | only in current buffer |
646-| `<silent>` | no echo |
647-| `<nowait>` | |
648-
649-Syntax
650-------
651-
652-### Highlights
653-
654-```vim
655-hi Comment
656- term=bold,underline
657- gui=bold
658- ctermfg=4
659- guifg=#80a0ff
660-```
661-
662-### Filetype detection
663-
664-```vim
665-augroup filetypedetect
666- au! BufNewFile,BufRead *.json setf javascript
667-augroup END
668-
669-au Filetype markdown setlocal spell
670-```
671-
672-### Conceal
673-
674-```vim
675-set conceallevel=2
676-syn match newLine "<br>" conceal cchar=}
677-hi newLine guifg=green
678-```
679-
680-### Region conceal
681-
682-```vim
683-syn region inBold concealends matchgroup=bTag start="<b>" end="</b>"
684-hi inBold gui=bold
685-hi bTag guifg=blue
686-```
687-
688-### Syntax
689-
690-```vim
691-syn match :name ":regex" :flags
692-
693-syn region Comment start="/\*" end="\*/"
694-syn region String start=+"+ end=+"+ skip=+\\"+
695-
696-syn cluster :name contains=:n1,:n2,:n3...
697-
698-flags:
699- keepend
700- oneline
701- nextgroup=
702- contains=
703- contained
704-
705-hi def link markdownH1 htmlH1
706-```
707-
708-### Include guards
709-
710-```vim
711-if exists('g:loaded_myplugin')
712- finish
713-endif
714-
715-" ...
716-
717-let g:loaded_myplugin = 1
718-```
719-
720-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
721-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,365 +0,0 @@
2----
3-title: Vue.js
4-category: JavaScript
5-layout: 2017/sheet
6-updated: 2019-12-26
7-weight: -10
8-intro: |
9- [Vue.js](https://vuejs.org/) is an open-source Model–view–viewmodel JavaScript framework for building user interfaces and single-page applications.
10----
11-
12-{%raw%}
13-
14-Expressions
15-----------
16-{: .-three-column}
17-
18-### Expressions
19-
20-```html
21-<div id="app">
22- <p>I have a {{ product }}</p>
23- <p>{{ product + 's' }}</p>
24- <p>{{ isWorking ? 'YES' : 'NO' }}</p>
25- <p>{{ product.getSalePrice() }}</p>
26-</div>
27-```
28-
29-See: [Delimiters](https://vuejs.org/v2/api/#delimiters)
30-
31-### Binding
32-
33-```html
34-<a v-bind:href="url">...</a>
35-```
36-
37-#### Shorthand syntax
38-```html
39-<a :href="url">...</a>
40-```
41-{: data-line="1"}
42-
43-#### True or false will add or remove attribute
44-```html
45-<button :disabled="isButtonDisabled">...
46-```
47-
48-#### If isActive is truthy, the class ‘active’ will appear
49-```html
50-<div :class="{ active: isActive }">...
51-```
52-
53-#### Style color set to value of activeColor
54-```html
55-<div :style="{ color: activeColor }">
56-```
57-
58-See: [v-bind](https://vuejs.org/v2/api/#v-bind)
59-
60-### Directives
61-
62-#### Element inserted/removed based on truthiness
63-```html
64-<p v-if="inStock">{{ product }}</p>
65-```
66-```html
67-<p v-else-if="onSale">...</p>
68-<p v-else>...</p>
69-```
70-
71-#### Toggles the display: none CSS property
72-```html
73-<p v-show="showProductDetails">...</p>
74-```
75-
76-#### Two-way data binding
77-```html
78-<input v-model="firstName" >
79-```
80-
81-| Method | Description |
82-| --- | --- |
83-| `v-model.lazy="..."` | Syncs input after change event |
84-| `v-model.number="..."` | Always returns a number |
85-| `v-model.trim="..."` | Strips whitespace |
86-
87-See: [Directives](https://vuejs.org/v2/api/#Directives)
88-
89-### Actions/Events
90-
91-#### Calls addToCart method on component
92-```html
93-<button v-on:click="addToCart">...
94-```
95-
96-#### Shorthand syntax
97-```html
98-<button @click="addToCart">...
99-```
100-{: data-line="1"}
101-
102-#### Arguments can be passed
103-```html
104-<button @click="addToCart(product)">...
105-```
106-
107-#### To prevent default behavior (e.g. page reload)
108-```html
109-<form @submit.prevent="addProduct">...
110-```
111-
112-#### Only trigger once
113-```html
114-<img @mouseover.once="showImage">...
115-```
116-
117-| Method | Description |
118-| --- | --- |
119-| `.stop` | Stop all event propagation |
120-| `.self ` | Only trigger if event.target is element itself |
121-
122-#### Keyboard entry example
123-```html
124-<input @keyup.enter="submit">
125-```
126-
127-#### Call onCopy when control-c is pressed
128-```html
129-<input @keyup.ctrl.c="onCopy">
130-```
131-
132-See: [Events](https://vuejs.org/v2/guide/events.html)
133-
134-### List rendering
135-
136-#### The `:key` is always recommended
137-```html
138-<li v-for="item in items"
139- :key="item.id">
140- {{ item }}
141-</li>
142-```
143-{: data-line="2"}
144-
145-#### To access the position in the array
146-```html
147-<li v-for="(item, index) in items">...
148-```
149-
150-#### To iterate through objects
151-```html
152-<li v-for="(value, key) in object">...
153-```
154-
155-#### Using `v-for` with a component
156-```html
157-<cart-product v-for="item in products"
158- :product="item"
159- :key="item.id">
160-```
161-
162-See: [List Rendering](https://vuejs.org/v2/guide/list.html)
163-
164-
165-Component
166---------
167-
168-### Component anatomy
169-
170-```js
171-Vue.component('my-component', {
172- components: {
173- // Components that can be used in the template
174- ProductComponent,
175- ReviewComponent
176- },
177- props: {
178- // The parameters the component accepts
179- message: String,
180- product: Object,
181- email: {
182- type: String,
183- required: true,
184- default: "none"
185- validator: function (value) {
186- // Should return true if value is valid
187- }
188- }
189- },
190- data: function() {
191- // `data` must be a function
192- return {
193- firstName: 'Vue',
194- lastName: 'Mastery'
195- }
196- },
197- computed: {
198- // Return cached values until dependencies change
199- fullName: function () {
200- return this.firstName + ' ' + this.lastName
201- }
202- },
203- watch: {
204- // Called when firstName changes value
205- firstName: function (value, oldValue) { ... }
206- },
207- methods: { ... },
208- template: '<span>{{ message }}</span>',
209- // Can also use backticks in `template` for multi-line
210-})
211-```
212-{: data-line="3, 8, 16, 21, 28, 34, 39"}
213-
214-See: [Components Basics](https://vuejs.org/v2/guide/components.html)
215-
216-### Lifecycle hooks
217-
218-| Method | Description |
219-| --- | --- |
220-| `beforeCreate` | After the instance has been initialized [#](https://vuejs.org/v2/api/#beforeCreate) |
221-| `created` | After the instance is created [#](https://vuejs.org/v2/api/#created) |
222-| `beforeMount` | Before the first render [#](https://vuejs.org/v2/api/#beforeMount) |
223-| `mounted` | After the instance has been mounted [#](https://vuejs.org/v2/api/#mounted) |
224-| `beforeUpdate` | When data changes, before the DOM is patched [#](https://vuejs.org/v2/api/#beforeUpdate) |
225-| `updated` | After a data change [#](https://vuejs.org/v2/api/#updated) |
226-| `beforeDestroy` | Before the instance is destroyed [#](https://vuejs.org/v2/api/#beforeDestroy) |
227-| `destroyed` | After a Vue instance has been destroyed [#](https://vuejs.org/v2/api/#destroyed) |
228-
229-See: [Lifecycle Hooks](https://vuejs.org/v2/api/#Options-Lifecycle-Hooks)
230-
231-### Custom events
232-
233-#### Set listener on component, within its parent
234-```html
235-<button-counter v-on:incrementBy="incWithVal">
236-```
237-
238-#### Inside parent component
239-```js
240-methods: {
241- incWithVal: function (toAdd) { ... }
242-}
243-```
244-
245-#### Inside button-counter template
246-```js
247-this.$emit(
248- 'incrementBy', // Custom event name
249- 5 // Data sent up to parent
250- )
251-```
252-
253-Use props to pass data into child components,
254-custom events to pass data to parent elements.
255-
256-See: [Custom Events](https://vuejs.org/v2/guide/components-custom-events.html)
257-
258-Single file components
259---------
260-
261-### Single file
262-```html
263-<template>
264- <p>{{ greeting }} World!</p>
265-</template>
266-
267-<script>
268-module.exports = {
269- data: function () {
270- return {
271- greeting: 'Hello'
272- }
273- }
274-}
275-</script>
276-
277-<style scoped>
278-p {
279- font-size: 2em;
280- text-align: center;
281-}
282-</style>
283-```
284-
285-See: [Single File Components](https://vuejs.org/v2/guide/single-file-components.html)
286-
287-### Separation
288-```html
289-<template>
290- <div>This will be pre-compiled</div>
291-</template>
292-<script src="./my-component.js"></script>
293-<style src="./my-component.css"></style>
294-```
295-
296-See: [What About Separation of Concerns?](https://vuejs.org/v2/guide/single-file-components.html#What-About-Separation-of-Concerns)
297-
298-Slots
299---------
300-
301-### Using a single slot
302-
303-#### Component template
304-```html
305-<div>
306- <h2>I'm a title</h2>
307- <slot>
308- Only displayed if no slot content
309- </slot>
310-</div>
311-```
312-{: data-line="3,4,5"}
313-
314-#### Use of component with data for slot
315-```html
316-<my-component>
317- <p>This will go in the slot</p>
318-</my-component>
319-```
320-{: data-line="2"}
321-
322-See: [Slots](https://vuejs.org/v2/guide/components-slots.html)
323-
324-### Multiple slots
325-
326-#### Component template
327-```html
328-<div class="container">
329- <header>
330- <slot name="header"></slot>
331- </header>
332- <main>
333- <slot>Default content</slot>
334- </main>
335- <footer>
336- <slot name="footer"></slot>
337- </footer>
338-</div>
339-```
340-{: data-line="3,6,9"}
341-
342-#### Use of component with data for slots
343-```html
344-<app-layout>
345- <h1 slot="header">Page title</h1>
346- <p>the main content.</p>
347- <p slot="footer">Contact info</p>
348-</app-layout>
349-```
350-{: data-line="2,3,4"}
351-
352-See: [Slots](https://vuejs.org/v2/guide/components-slots.html)
353-
354-Also see
355---------
356-
357-* [Vue CLI](https://cli.vuejs.org/) _(cli.vuejs.org)_
358-* [Vue Router](https://router.vuejs.org/) _(router.vuejs.org)_
359-* [Vue DevTools](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd?hl=en) _(chrome.google.com)_
360-* [Nuxt.js](https://nuxtjs.org/) _(nuxtjs.org)_
361-* [Vue.js v1.0.28 cheatsheet](vue@1.0.28/) _Legacy version_
362-
363-{%endraw%}
364-
365-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
366-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,40 +0,0 @@
2----
3-title: Yaml
4-category: Markup
5-layout: 2017/sheet
6-prism_languages: [yaml]
7----
8-
9-### Multiline strings
10-
11-```yaml
12-Multiline: |
13- hello
14- world
15-```
16-
17-### Inheritance
18-
19-```yaml
20-parent: &defaults
21- a: 2
22- b: 3
23-
24-child:
25- <<: *defaults
26- b: 4
27-```
28-
29-### Reference content
30-
31-```yaml
32-values: &ref
33- - These values
34- - will be reused below
35-
36-other_values:
37- <<: *ref
38-```
39-
40-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
41-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1,45 +0,0 @@
2----
3-title: zsh
4-category: CLI
5-layout: 2017/sheet
6----
7-
8-### Expressions
9-
10-| Expression | Example | Description
11-| --- | --- | ---
12-| `!!` | `sudo !!` | Last command (`sudo !!`)
13-| --- | --- | ---
14-| `!*` | `vim !*` | Last command's parameters (`vim !*`)
15-| `!^` | | Last command's first parameter
16-| `!$` | | Last command's last parameter
17-| --- | --- | ---
18-| `!?ls` `<tab>` | `sudo !?mv` `<tab>` | Command and params of last `ls` command
19-| `!?ls?:*` `<tab>` | | Params of last `ls` command
20-| --- | --- | ---
21-| `*(m0)` | `rm *(m0)` | Last modified today
22-| `*(m-4)` | | Last modified <4 days ago
23-{: .-headers}
24-
25-### Change default shell
26-
27-```bash
28-chsh -s `which zsh`
29-```
30-
31-### Process Substitution
32-
33-| Expression | Example | Description
34-| --- | --- | ---
35-| `<(COMMAND)` | `grep "needle" <(curl "https://haystack.io")` | Replace argument with _named pipe/FIFO_ (read-only) with command output
36-| `=(COMMAND)` | `vim =(curl "https://haystack.io")` | Replace argument with _file_ (writable) containing command output
37-{: .-headers}
38-
39-### Also see
40-
41-- [Bash cheatsheet](./bash)
42-
43-Zsh is mostly compatible with Bash, so most everything in Bash's cheatsheet also applies.
44-
45-https://devhints.io/ cheatsheets - Copyright (c) 2021 Rico Sta. Cruz and contributors - MIT license
46-micro-cheat plugin Copyright 2022 Tero Karvinen https://TeroKarvinen.com/micro - MIT license
1@@ -1 +0,0 @@
2-2024/12/29 01:44:02 Micro started
+0,
-40
1@@ -1,40 +0,0 @@
2--- micro-cheat copyright 2022 Tero Karvinen https://TeroKarvinen.com
3-
4--- Cheatsheets are copyrighted by their original authors
5-
6--- Cheatsheets from Devhints.io are copyright 2021
7--- Rico Sta. Cruz and contributors, received under the MIT license
8-
9-local micro = import("micro")
10-local config = import("micro/config")
11-
12-local cheatdir = config.ConfigDir.."/plug/cheat/cheatsheets/"
13-
14-function init()
15- -- runs once when micro starts
16- config.MakeCommand("cheat", cheatCommand, config.NoComplete)
17- config.TryBindKey("F1", "command:cheat", false)
18-end
19-
20-function cheatCommand(bp)
21- local filename = bp.Buf:GetName()
22- local filetype = bp.Buf:FileType()
23-
24- if "Vagrantfile" == filename or "Dockerfile" == filename then
25- filetype = filename:lower()
26- micro.InfoBar():Message("Cheatsheet by file name: "..filename)
27- elseif string.find(filename, "\.org$") then -- not detected by micro
28- filetype = "org"
29- micro.InfoBar():Message("Cheatsheet by file suffix: "..filename)
30- elseif "unknown" ~= filetype then
31- -- micro hopefully detected the filetype, the typical case
32- micro.InfoBar():Message("Cheatsheet by file type: "..filetype)
33- else
34- micro.InfoBar():Message("Cheatsheet not found for type '"..filetype.."', filename '"..filename.."'")
35- return
36- end
37-
38- local cmd = "tab " .. cheatdir .. filetype .. ".md"
39- bp:HandleCommand(cmd)
40-
41-end
+0,
-35
1@@ -1,35 +0,0 @@
2-[{
3- "Name": "cheat",
4- "Description": "F1 for cheatsheet related to the type of file you're editing: Lua, Go, Python...",
5- "Website": "https://terokarvinen.com/micro",
6- "Tags": ["cheatsheet", "help", "docs", "Lua", "Go", "Python", "reference"],
7- "Versions": [
8- {
9- "Version": "0.0.4",
10- "Url": "https://github.com/terokarvinen/micro-cheat/archive/v0.0.4.zip",
11- "Require": {
12- "micro": ">=2.0.0"
13- }
14- },
15- {
16- "Version": "0.0.3",
17- "Url": "https://github.com/terokarvinen/micro-cheat/archive/v0.0.3.zip",
18- "Require": {
19- "micro": ">=2.0.0"
20- }
21- },
22- {
23- "Version": "0.0.2",
24- "Url": "https://github.com/terokarvinen/micro-cheat/archive/v0.0.2.zip",
25- "Require": {
26- "micro": ">=2.0.0"
27- }
28- },
29- {
30- "Version": "0.0.1",
31- "Require": {
32- "micro": ">=2.0.0"
33- }
34- }
35- ]
36-}]
1@@ -1,6 +0,0 @@
2-Version 1.2.1
3-* Fixed utf8 character count
4-
5-Version 1.2.0
6-+ Now counts lines
7-+ Added Support for counting lines, words and characters in selection
+0,
-21
1@@ -1,21 +0,0 @@
2-MIT License
3-
4-Copyright (c) 2020 bananaapple
5-
6-Permission is hereby granted, free of charge, to any person obtaining a copy
7-of this software and associated documentation files (the "Software"), to deal
8-in the Software without restriction, including without limitation the rights
9-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-copies of the Software, and to permit persons to whom the Software is
11-furnished to do so, subject to the following conditions:
12-
13-The above copyright notice and this permission notice shall be included in all
14-copies or substantial portions of the Software.
15-
16-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-SOFTWARE.
+0,
-4
1@@ -1,4 +0,0 @@
2-# Micro Word Count Plugin
3-
4-Word, character and line counter for micro editor.
5-(forked from https://github.com/adamnpeace/micro-wc-plugin)
+0,
-25
1@@ -1,25 +0,0 @@
2-# WordCount (wc) Plugin #
3-
4-The wc plugin provides the user with the ability to count either
5-characters or strings in any text being edited with micro.
6-
7-A word is defined as a string of characters delimited by white
8-space characters. White space characters are the set of characters
9-for which the iswspace(3) function returns true.
10-
11-A line is defined as a string of characters delimited by \n
12-characters, or by the beginning or end of the file. \r\n line
13-endings will be counted correctly as well, since there is only
14-one \n per \r\n.
15-
16-Character count includes white space and newline characters.
17-
18-To initiate the function, you can either:
19-
20-Press "F5"
21-
22-Or run:
23-
24-```
25-> wc
26-```
+0,
-10
1@@ -1,10 +0,0 @@
2-{
3- "name": "wc",
4- "description": "Word count plugin",
5- "website": "",
6- "install": "",
7- "version": "1.2.1",
8- "require": [
9- "micro >= 2.0.0"
10- ]
11-}
+0,
-22
1@@ -1,22 +0,0 @@
2-[{
3- "Name": "wc",
4- "Description": "Plugin to count words/characters in micro",
5- "Tags": ["wc", "word", "character", "count"],
6- "Website": "https://github.com/adamnpeace/micro-wc-plugin",
7- "Versions": [
8- {
9- "Version": "1.1.0",
10- "Url": "https://github.com/adamnpeace/micro-wc-plugin/archive/v1.1.0.zip",
11- "Require": {
12- "micro": ">=2.0.0-1"
13- }
14- },
15- {
16- "Version": "1.0.1",
17- "Url": "https://github.com/adamnpeace/micro-wc-plugin/archive/v1.0.1.zip",
18- "Require": {
19- "micro": ">=1.1.0"
20- }
21- }
22- ]
23-}]
+0,
-37
1@@ -1,37 +0,0 @@
2-VERSION = "1.2.1"
3-
4-local micro = import("micro")
5-local config = import("micro/config")
6-local util = import("micro/util")
7-local utf8 = import("unicode/utf8")
8-
9-function init()
10- config.MakeCommand("wc", wordCount, config.NoComplete)
11- config.AddRuntimeFile("wc", config.RTHelp, "help/wc.md")
12- config.TryBindKey("F5", "lua:wc.wordCount", false)
13-end
14-
15-function wordCount(bp)
16- -- Buffer of selection/whole document
17- local buffer
18- --Get active cursor (to get selection)
19- local cursor = bp.Buf:GetActiveCursor()
20- --If cursor exists and there is selection, convert selection byte[] to string
21- if cursor and cursor:HasSelection() then
22- buffer = util.String(cursor:GetSelection())
23- else
24- --no selection, convert whole buffer byte[] to string
25- buffer = util.String(bp.Buf:Bytes())
26- end
27- --length of the buffer/selection (string), utf8 friendly
28- charCount = utf8.RuneCountInString(buffer)
29- --Get word/line count using gsub's number of substitutions
30- -- number of substitutions, pattern: %S+ (more than one non-whitespace characters)
31- local _ , wordCount = buffer:gsub("%S+","")
32- -- number of substitutions, pattern: \n (number of newline characters)
33- local _, lineCount = buffer:gsub("\n", "")
34- --add one to line count (since we're counting separators not lines above)
35- lineCount = lineCount + 1
36- --display the message
37- micro.InfoBar():Message("Lines:" .. lineCount .. " Words:"..wordCount.." Characters:"..charCount)
38-end
+0,
-111
1@@ -1,111 +0,0 @@
2-[General]
3-AskOnExit=false
4-BoldIntense=true
5-BookmarksFile=/home/kat/.config/qterminal.org/qterminal_bookmarks.xml
6-BookmarksVisible=true
7-Borderless=false
8-ChangeWindowIcon=true
9-ChangeWindowTitle=true
10-CloseTabOnMiddleClick=true
11-ConfirmMultilinePaste=true
12-DisableBracketedPasteMode=false
13-FixedTabWidth=true
14-FixedTabWidthValue=500
15-HandleHistory=
16-HideTabBarWithOneTab=false
17-HistoryLimited=true
18-HistoryLimitedTo=1000
19-KeyboardCursorShape=0
20-LastWindowMaximized=true
21-MenuVisible=true
22-MotionAfterPaste=2
23-NoMenubarAccel=true
24-OpenNewTabRightToActiveTab=false
25-PrefDialogSize=@Size(700 700)
26-SavePosOnExit=true
27-SaveSizeOnExit=true
28-ScrollbarPosition=2
29-ShowCloseTabButton=true
30-TabBarless=false
31-TabsPosition=0
32-Term=xterm-256color
33-TerminalBackgroundImage=
34-TerminalBackgroundMode=0
35-TerminalMargin=0
36-TerminalTransparency=0
37-TerminalsPreset=0
38-TrimPastedTrailingNewlines=false
39-UseBookmarks=false
40-UseCWD=false
41-UseFontBoxDrawingChars=false
42-colorScheme=DarkPastels
43-emulation=default
44-enabledBidiSupport=true
45-fontFamily=Ubuntu Mono
46-fontSize=14
47-guiStyle=
48-highlightCurrentTerminal=false
49-showTerminalSizeHint=true
50-version=0.17.0
51-
52-[DropMode]
53-Height=45
54-KeepOpen=false
55-ShortCut=F12
56-ShowOnStart=true
57-Width=70
58-
59-[MainWindow]
60-ApplicationTransparency=15
61-fixedSize=@Size(600 400)
62-pos=@Point(0 32)
63-size=@Size(1920 1020)
64-state=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\xfc\x2\0\0\0\x1\xfb\0\0\0&\0\x42\0o\0o\0k\0m\0\x61\0r\0k\0s\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\0\0\0\0\0\xff\xff\xff\xff\0\0\0\x9b\x1\0\0\x3\0\0\a\x80\0\0\x3\xdf\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\0)
65-
66-[Sessions]
67-size=0
68-
69-[Shortcuts]
70-Add%20Tab=Ctrl+Shift+T
71-Bottom%20Subterminal=Alt+Down
72-Clear%20Active%20Terminal=Ctrl+Shift+X
73-Close%20Tab=Ctrl+Shift+W
74-Collapse%20Subterminal=
75-Copy%20Selection=Ctrl+Shift+C
76-Find=Ctrl+Shift+F
77-Fullscreen=F11
78-Handle%20history=
79-Hide%20Window%20Borders=
80-Left%20Subterminal=Alt+Left
81-Move%20Tab%20Left=Alt+Shift+Left|Ctrl+Shift+PgUp
82-Move%20Tab%20Right=Alt+Shift+Right|Ctrl+Shift+PgDown
83-New%20Window=Ctrl+Shift+N
84-Next%20Tab=Ctrl+PgDown
85-Next%20Tab%20in%20History=Ctrl+Shift+Tab
86-Paste%20Clipboard=Ctrl+Shift+V
87-Paste%20Selection=Shift+Ins
88-Preferences...=
89-Previous%20Tab=Ctrl+PgUp
90-Previous%20Tab%20in%20History=Ctrl+Tab
91-Quit=
92-Rename%20Session=Alt+Shift+S
93-Right%20Subterminal=Alt+Right
94-Show%20Tab%20Bar=
95-Split%20Terminal%20Horizontally=
96-Split%20Terminal%20Vertically=
97-Tab%201=
98-Tab%2010=
99-Tab%202=
100-Tab%203=
101-Tab%204=
102-Tab%205=
103-Tab%206=
104-Tab%207=
105-Tab%208=
106-Tab%209=
107-Toggle%20Bookmarks=Ctrl+Shift+B
108-Toggle%20Menu=Ctrl+Shift+M
109-Top%20Subterminal=Alt+Up
110-Zoom%20in=Ctrl++
111-Zoom%20out=Ctrl+-
112-Zoom%20reset=Ctrl+0
+0,
-25
1@@ -1,25 +0,0 @@
2-[Base]
3-defDir=/media/kat/disk/Pictures/Screenshots
4-defImgFormat=png
5-defScreenshotType=Area
6-includeCursor=false
7-insDateTimeInFilename=false
8-noDecorations=false
9-templateDateTime=yyyy-MM-dd-hh-mm-ss
10-
11-[Display]
12-lastSelection=@Rect(392 178 1096 588)
13-zoomAroundMouse=false
14-
15-[GlobalShortcuts]
16-ActiveWindow=
17-AreaSelection=
18-FullScreen=
19-
20-[LocalShortcuts]
21-Close=Esc
22-CopyScreen=Ctrl+C
23-Help=F1
24-NewScreen=Ctrl+N
25-Options=Ctrl+P
26-SaveScreen=Ctrl+S
+0,
-431
1@@ -1,431 +0,0 @@
2-[Analyzer]
3-framerate=25
4-type=NyanCatAnalyzer
5-
6-[Appearance]
7-background_image_do_not_cut=true
8-background_image_keep_aspect_ratio=true
9-background_image_max_size=0
10-background_image_position=5
11-background_image_stretch=false
12-background_image_type=1
13-blur_radius=0
14-icon_size_configure_buttons=16
15-icon_size_left_panel_buttons=22
16-icon_size_play_control_buttons=32
17-icon_size_playlist_buttons=20
18-icon_size_tabbar_large_mode=40
19-icon_size_tabbar_small_mode=32
20-opacity_level=40
21-playlist_playing_song_color=@Variant(\0\0\0\x43\0\xff\xff\0\0\0\0\0\0\0\0)
22-style=default
23-system_icons=false
24-tab_color=@Variant(\0\0\0\x43\x2\xff\xffOL\x87\x87\x92+\0\0)
25-tab_gradient=true
26-tab_system_color=true
27-
28-[Backend]
29-AutoCrossfadeEnabled=false
30-CrossfadeEnabled=false
31-FadeoutDuration=2000
32-FadeoutEnabled=false
33-FadeoutPauseDuration=250
34-FadeoutPauseEnabled=false
35-NoCrossfadeSameAlbum=true
36-alsaplugin=3
37-bs2b=false
38-bufferduration=4000
39-bufferhighwatermark=0.99
40-bufferlowwatermark=0.33
41-channels=2
42-channels_enabled=false
43-device=@Invalid()
44-ebur128_loudness_normalization=false
45-ebur128_target_level_lufs=-23
46-engine=gstreamer
47-http2=false
48-output=autoaudiosink
49-rgcompression=true
50-rgenabled=false
51-rgfallbackgain=0
52-rgmode=0
53-rgpreamp=0
54-strict_ssl=false
55-volume_control=true
56-
57-[Behaviour]
58-doubleclick_addmode=1
59-doubleclick_playlist_addmode=1
60-doubleclick_playmode=1
61-keeprunning=false
62-language=
63-menu_playmode=1
64-menu_previousmode=1
65-playing_widget=true
66-resumeplayback=false
67-seek_step_sec=10
68-showtrayicon=true
69-startupbehaviour=1
70-taskbar_progress=true
71-trayicon_progress=false
72-volume_increment=5
73-
74-[Collection]
75-auto_open=true
76-cache_size=160
77-cache_size_unit=1
78-cover_art_patterns=front, cover
79-delete_files=false
80-disk_cache_enable=false
81-disk_cache_size=360
82-disk_cache_size_unit=1
83-expire_unavailable_songs=60
84-group_by1=12
85-group_by2=3
86-group_by3=0
87-group_by_version=1
88-last_path=/media/kat/disk/Music/Not Mine
89-mark_songs_unavailable=true
90-monitor=true
91-overwrite_playcount=false
92-overwrite_rating=false
93-pretty_covers=true
94-save_playcounts=false
95-save_ratings=false
96-separate_albums_by_grouping=false
97-show_dividers=true
98-song_ebur128_loudness_analysis=false
99-song_tracking=false
100-sort_skips_articles=true
101-startup_scan=true
102-various_artists=true
103-
104-[Context]
105-AlbumEnable=true
106-SearchCoverEnable=true
107-SearchLyricsEnable=true
108-SongLyricsEnable=true
109-SummaryFmt=%album%
110-TechnicalDataEnable=false
111-TitleFmt=%title% - %artist%
112-font_headline=Sans Serif
113-font_normal=Sans Serif
114-font_size_headline=11
115-font_size_normal=9
116-
117-[Covers]
118-providers=Last.fm, MusicBrainz, Deezer, Musixmatch, OpenTidal, Tidal, Spotify, Qobuz
119-save_filename=2
120-save_lowercase=true
121-save_overwrite=false
122-save_pattern=%albumartist-%album
123-save_replace_spaces=true
124-save_type=1
125-types=art_unset, art_manual, art_automatic, art_embedded
126-
127-[EditTagDialog]
128-current_tab=1
129-geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x2\x1e\0\0\0i\0\0\x5N\0\0\x3\x8e\0\0\x2 \0\0\0\x87\0\0\x5L\0\0\x3\x8c\0\0\0\0\0\0\0\0\a\x80\0\0\x2 \0\0\0\x87\0\0\x5L\0\0\x3\x8c)
130-
131-[Equalizer]
132-enable_stereo_balancer=false
133-enabled=false
134-presets\1\name=Classical
135-presets\1\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\xd8\xff\xff\xff\xd8\xff\xff\xff\xd8\xff\xff\xff\xce)
136-presets\10\name=Live
137-presets\10\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\xff\xff\xff\xe7\0\0\0\0\0\0\0\x14\0\0\0\x19\0\0\0\x1e\0\0\0\x1e\0\0\0\x14\0\0\0\xf\0\0\0\xf\0\0\0\n)
138-presets\11\name=Party
139-presets\11\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0#\0\0\0#\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0#\0\0\0#)
140-presets\12\name=Pop
141-presets\12\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\xff\xff\xff\xf6\0\0\0\x19\0\0\0#\0\0\0(\0\0\0\x19\xff\xff\xff\xfb\xff\xff\xff\xf1\xff\xff\xff\xf1\xff\xff\xff\xf6\xff\xff\xff\xf6)
142-presets\13\name=Reggae
143-presets\13\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\0\0\0\0\0\xff\xff\xff\xfb\xff\xff\xff\xe2\0\0\0\0\xff\xff\xff\xdd\xff\xff\xff\xdd\0\0\0\0\0\0\0\0\0\0\0\0)
144-presets\14\name=Rock
145-presets\14\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0(\0\0\0\x19\xff\xff\xff\xe2\xff\xff\xff\xd8\xff\xff\xff\xec\0\0\0\x14\0\0\0-\0\0\0\x37\0\0\0\x37\0\0\0\x37)
146-presets\15\name=Ska
147-presets\15\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\xff\xff\xff\xf1\xff\xff\xff\xe7\xff\xff\xff\xe7\xff\xff\xff\xfb\0\0\0\x14\0\0\0\x1e\0\0\0-\0\0\0\x32\0\0\0\x37\0\0\0\x32)
148-presets\16\name=Soft
149-presets\16\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\x19\0\0\0\n\xff\xff\xff\xfb\xff\xff\xff\xf1\xff\xff\xff\xfb\0\0\0\x14\0\0\0-\0\0\0\x32\0\0\0\x37\0\0\0<)
150-presets\17\name=Soft Rock
151-presets\17\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\x14\0\0\0\x14\0\0\0\n\xff\xff\xff\xfb\xff\xff\xff\xe7\xff\xff\xff\xe2\xff\xff\xff\xec\xff\xff\xff\xfb\0\0\0\xf\0\0\0-)
152-presets\18\name=Techno
153-presets\18\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0(\0\0\0\x1e\0\0\0\0\xff\xff\xff\xe2\xff\xff\xff\xe7\0\0\0\0\0\0\0(\0\0\0\x32\0\0\0\x32\0\0\0-)
154-presets\19\name=Zero
155-presets\19\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0)
156-presets\2\name=Club
157-presets\2\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x14\0\0\0\x1e\0\0\0\x1e\0\0\0\x1e\0\0\0\x14\0\0\0\0\0\0\0\0\0\0\0\0)
158-presets\3\name=Custom
159-presets\3\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0)
160-presets\4\name=Dance
161-presets\4\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\x32\0\0\0#\0\0\0\n\0\0\0\0\0\0\0\0\xff\xff\xff\xe2\xff\xff\xff\xd8\xff\xff\xff\xd8\0\0\0\0\0\0\0\0)
162-presets\5\name=Full Bass
163-presets\5\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\x46\0\0\0\x46\0\0\0\x46\0\0\0(\0\0\0\x14\xff\xff\xff\xd3\xff\xff\xff\xce\xff\xff\xff\xc9\xff\xff\xff\xc9\xff\xff\xff\xc9)
164-presets\6\name=Full Bass + Treble
165-presets\6\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0#\0\0\0\x1e\0\0\0\0\xff\xff\xff\xd8\xff\xff\xff\xe7\0\0\0\n\0\0\0-\0\0\0\x37\0\0\0<\0\0\0<)
166-presets\7\name=Full Treble
167-presets\7\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\xff\xff\xff\xce\xff\xff\xff\xce\xff\xff\xff\xce\xff\xff\xff\xe7\0\0\0\xf\0\0\0\x37\0\0\0P\0\0\0P\0\0\0P\0\0\0U)
168-presets\8\name=Laptop/Headphones
169-presets\8\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\x19\0\0\0\x32\0\0\0\x19\xff\xff\xff\xec\0\0\0\0\xff\xff\xff\xe2\xff\xff\xff\xd8\xff\xff\xff\xd8\0\0\0\0\0\0\0\0)
170-presets\9\name=Large Hall
171-presets\9\params=@Variant(\0\0\0\x7f\0\0\0\x12\x45qualizer::Params\0\0\0\0\0\0\0\0\x32\0\0\0\x32\0\0\0\x1e\0\0\0\x1e\0\0\0\0\xff\xff\xff\xe7\xff\xff\xff\xe7\xff\xff\xff\xe7\0\0\0\0\0\0\0\0)
172-presets\size=19
173-selected_preset=Custom
174-stereo_balance=0
175-
176-[GlobalShortcuts]
177-dec_volume=
178-inc_volume=
179-love=
180-mute=
181-next_track=Media Next
182-pause=
183-play=
184-play_pause=Media Play
185-prev_track=Media Previous
186-repeat_mode=
187-seek_backward=
188-seek_forward=
189-show_hide=
190-show_osd=
191-shuffle_mode=
192-stop=Media Stop
193-stop_after=
194-toggle_pretty_osd=
195-toggle_scrobbling=
196-use_gnome=false
197-use_kde=false
198-use_mate=false
199-use_x11=false
200-
201-[LastFM]
202-enabled=true
203-session_key=py5Cpj5PVXmR3mPxkaliet9HdIq4ufq0
204-subscriber=false
205-username=springpool
206-
207-[LibreFM]
208-enabled=false
209-
210-[ListenBrainz]
211-enabled=false
212-user_token=
213-
214-[Lyrics]
215-providers=Genius, Lyrics.ovh, LoloLyrics, Musixmatch, songlyrics.com, azlyrics.com, elyrics.net, letras.mus.br
216-
217-[MainWindow]
218-current_tab=2
219-do_not_show_sponsor_message=true
220-file_path=/home/kat
221-geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0 \0\0\a\x7f\0\0\x4\x37\0\0\0\0\0\0\0\x34\0\0\x4j\0\0\x2\xe0\0\0\0\0\x2\0\0\0\a\x80\0\0\0\0\0\0\0<\0\0\a\x7f\0\0\x4\x37)
222-hidden=false
223-maximized=true
224-minimized=false
225-search_for_cover_auto=true
226-show_sidebar=true
227-splitter_state=@ByteArray(\0\0\0\xff\0\0\0\x1\0\0\0\x2\0\0\x1Y\0\0\x6#\0\xff\xff\xff\xff\x1\0\0\0\x1\0)
228-tab_collection=1
229-tab_context=0
230-tab_devices=7
231-tab_files=5
232-tab_mode=1
233-tab_playlists=3
234-tab_queue=2
235-tab_radios=6
236-tab_smartplaylists=4
237-
238-[Moodbar]
239-enabled=false
240-save=false
241-show=false
242-style=0
243-
244-[NetworkProxy]
245-engine=true
246-hostname=
247-mode=0
248-password=
249-port=0
250-type=3
251-use_authentication=false
252-username=
253-
254-[OSD]
255-Behaviour=1
256-CustomText1=
257-CustomText2=
258-CustomTextEnabled=false
259-ShowArt=true
260-ShowOnPausePlayback=true
261-ShowOnPlayModeChange=true
262-ShowOnResumePlayback=false
263-ShowOnVolumeChange=false
264-Timeout=5000
265-
266-[OSDPretty]
267-background_color=4284913379
268-background_opacity=0.85
269-disable_duration=false
270-fading=false
271-font="Verdana,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1"
272-foreground_color=4278190080
273-popup_pos=@Point(1524 0)
274-popup_screen=HDMI-0
275-
276-[OpenTidal]
277-access_token=eyJraWQiOiJ2OU1GbFhqWSIsImFsZyI6IkVTMjU2In0.eyJ0eXBlIjoibzJfYWNjZXNzIiwic2NvcGUiOiIiLCJnVmVyIjowLCJzVmVyIjowLCJjaWQiOjk3MDYsImV4cCI6MTczNDM4NDI2MCwiaXNzIjoiaHR0cHM6Ly9hdXRoLnRpZGFsLmNvbS92MSJ9.8_vc5o1C0UhXeB6t4v5GYgXqfiY3X0Fg59D_UKJGfbXxKRluQ2Muf-aEjhINFHhZAvgtVRWRlgsHlxS_x0ZjrA
278-expires_in=86400
279-login_time=1734297860
280-token_type=Bearer
281-
282-[OrganizeDialog]
283-geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x2\x9d\0\0\0\x7f\0\0\x4\xe6\0\0\x3\xf8\0\0\x2\x9f\0\0\0\x9d\0\0\x4\xe4\0\0\x3\xf6\0\0\0\0\0\0\0\0\a\x80\0\0\x2\x9f\0\0\0\x9d\0\0\x4\xe4\0\0\x3\xf6)
284-
285-[Player]
286-playback_playlist=1
287-playback_position=299
288-playback_state=3
289-volume=100
290-
291-[Playlist]
292-alternating_row_colors=true
293-auto_sort=false
294-column_alignments=@Variant(\0\0\0\x7f\0\0\0\x13\x43olumnAlignmentMap\0\0\0\0\v\0\0\0\x6\0\0\0\x82\0\0\0\a\0\0\0\x82\0\0\0\b\0\0\0\x82\0\0\0\t\0\0\0\x82\0\0\0\n\0\0\0\x82\0\0\0\f\0\0\0\x82\0\0\0\r\0\0\0\x82\0\0\0\xe\0\0\0\x82\0\0\0\x11\0\0\0\x82\0\0\0\x15\0\0\0\x82\0\0\0\x16\0\0\0\x82)
295-continue_on_error=false
296-current_playlist=1
297-delete_files=false
298-editmetadatainline=true
299-glow_effect=true
300-greyout_songs_play=true
301-greyout_songs_startup=true
302-path_type=0
303-playlist_clear=true
304-rating_locked=false
305-select_track=false
306-show_bars=true
307-show_toolbar=true
308-state="@ByteArray(P,\x95\x10\0\0\0\0 \0\0\0\0\0\0\0\x1\0\0\0\x2\0\0\0\b\0\0\0\x3\0\0\0\x4\0\0\0\x5\0\0\0\x6\0\0\0\a\0\0\0\t\0\0\0\n\0\0\0\v\0\0\0\f\0\0\0\r\0\0\0\xe\0\0\0\xf\0\0\0\x10\0\0\0\x11\0\0\0\x12\0\0\0\x13\0\0\0\x14\0\0\0\x15\0\0\0\x16\0\0\0\x17\0\0\0\x18\0\0\0\x19\0\0\0\x1a\0\0\0\x1b\0\0\0\x1c\0\0\0\x1d\0\0\0\x1e\0\0\0\x1f\0\0\0 \0\0\x1\xe5\0\0\x1\xbb\0\0\x1\x81\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0,\0\0\0\0\0\0\0\x31\0\0\0\0\0\0\0\x41\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0L\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\a\0\0\0\0\0\0\0\x1\0\0\0\x2\0\0\0\x6\0\0\0\b\0\0\0\n\0\0\0\xe\0\0\0 ?\xd0\x36v.hH\f?\xd3*):\xbe \x5?\xd5\x8c\xa3RO\x11\x80\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0?\x93\xd8\x39\x63:\xdf\x83\0\0\0\0\0\0\0\0?\xb7T\xe6\xb9[a\xdd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1)"
309-state_version=1
310-warn_close_playlist=true
311-write_metadata=false
312-
313-[Qobuz]
314-albums_group_by1=1
315-albums_group_by2=4
316-albums_group_by3=0
317-albums_group_by_version=1
318-albums_separate_albums_by_grouping=false
319-artists_group_by1=1
320-artists_group_by2=4
321-artists_group_by3=0
322-artists_group_by_version=1
323-artists_separate_albums_by_grouping=false
324-search_group_by1=1
325-search_group_by2=4
326-search_group_by3=0
327-search_group_by_version=1
328-songs_group_by1=1
329-songs_group_by2=4
330-songs_group_by3=0
331-songs_group_by_version=1
332-songs_separate_albums_by_grouping=false
333-tab=artists
334-
335-[Scrobbler]
336-albumartist=false
337-enabled=true
338-love_button=true
339-offline=false
340-scrobble_button=true
341-show_error_dialog=true
342-sources=collection, file, cd, device, subsonic, tidal, qobuz, stream, somafm, radioparadise, unknown
343-strip_remastered=true
344-submit=0
345-
346-[SerializedSmartPlaylists]
347-songs\1\data=@ByteArray(\0\0\0\0\x2\x11\0\0\0\x14\x2\0)
348-songs\1\name=Newest tracks
349-songs\1\type=1
350-songs\10\data=@ByteArray(\0\0\0\0\0\x3\0\0\0\x14\x2\x1)
351-songs\10\name=Dynamic random mix
352-songs\10\type=1
353-songs\2\data=@ByteArray(\0\0\0\0\0\x3\0\0\0\x32\x2\0)
354-songs\2\name=50 random tracks
355-songs\2\type=1
356-songs\3\data=@ByteArray(\0\0\0\x1\x13\x4\0\0\0\x2\0\0\0\0\0\0\0\0\0\x1\0\0\x3\0\0\0\x14\0\0)
357-songs\3\name=Ever played
358-songs\3\type=1
359-songs\4\data=@ByteArray(\0\0\0\x1\x13\x6\0\0\0\x2\0\0\0\0\0\0\0\0\0\x1\0\0\x3\0\0\0\x14\0\0)
360-songs\4\name=Never played
361-songs\4\type=1
362-songs\5\data=@ByteArray(\0\0\0\0\x2\x15\0\0\0\x14\x2\0)
363-songs\5\name=Last played
364-songs\5\type=1
365-songs\6\data=@ByteArray(\0\0\0\0\x2\x13\0\0\0\x14\x2\0)
366-songs\6\name=Most played
367-songs\6\type=1
368-songs\7\data=@ByteArray(\0\0\0\0\x2\x16\0\0\0\x14\x2\0)
369-songs\7\name=Favourite tracks
370-songs\7\type=1
371-songs\8\data=@ByteArray(\0\0\0\x2\x16\x5\0\0\0\x6\0?\xe0\0\0\0\0\0\0\0\0\0\0\x1\0\x14\x4\0\0\0\x2\0\0\0\0\x4\0\0\0\0\x1\0\x2\x14\0\0\0\x14\x1\0)
372-songs\8\name=Least favourite tracks
373-songs\8\type=1
374-songs\9\data=@ByteArray(\0\0\0\0\x1\x1\xff\xff\xff\xff\x2\0)
375-songs\9\name=All tracks
376-songs\9\type=1
377-songs\size=10
378-songs_version=3
379-
380-[SettingsDialog]
381-geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x2 \0\0\0\x8e\0\0\x5^\0\0\x3\xad\0\0\x2\"\0\0\0\xac\0\0\x5\\\0\0\x3\xab\0\0\0\0\0\0\0\0\a\x80\0\0\x2\"\0\0\0\xac\0\0\x5\\\0\0\x3\xab)
382-
383-[Spotify]
384-albums_group_by1=1
385-albums_group_by2=4
386-albums_group_by3=0
387-albums_group_by_version=1
388-albums_separate_albums_by_grouping=false
389-artists_group_by1=1
390-artists_group_by2=4
391-artists_group_by3=0
392-artists_group_by_version=1
393-artists_separate_albums_by_grouping=false
394-search_group_by1=1
395-search_group_by2=4
396-search_group_by3=0
397-search_group_by_version=1
398-songs_group_by1=1
399-songs_group_by2=4
400-songs_group_by3=0
401-songs_group_by_version=1
402-songs_separate_albums_by_grouping=false
403-tab=artists
404-
405-[Subsonic]
406-group_by1=1
407-group_by2=4
408-group_by3=0
409-group_by_version=1
410-separate_albums_by_grouping=false
411-
412-[Tidal]
413-albums_group_by1=1
414-albums_group_by2=4
415-albums_group_by3=0
416-albums_group_by_version=1
417-albums_separate_albums_by_grouping=false
418-artists_group_by1=1
419-artists_group_by2=4
420-artists_group_by3=0
421-artists_group_by_version=1
422-artists_separate_albums_by_grouping=false
423-search_group_by1=1
424-search_group_by2=4
425-search_group_by3=0
426-search_group_by_version=1
427-songs_group_by1=1
428-songs_group_by2=4
429-songs_group_by3=0
430-songs_group_by_version=1
431-songs_separate_albums_by_grouping=false
432-tab=artists
R home/scripts/charmbracelet_vhs/nyancat.tape =>
scripts/Scripts/charmbracelet_vhs/nyancat.tape
+0,
-0
R home/scripts/charmbracelet_vhs/parrot.tape =>
scripts/Scripts/charmbracelet_vhs/parrot.tape
+0,
-0
R home/scripts/charmbracelet_vhs/pbtape2.tape =>
scripts/Scripts/charmbracelet_vhs/pbtape2.tape
+0,
-0
R home/scripts/charmbracelet_vhs/train.tape =>
scripts/Scripts/charmbracelet_vhs/train.tape
+0,
-0
R home/scripts/lastfm.py =>
scripts/Scripts/lastfm.py
+0,
-0
R home/scripts/phantomjs-wttr/Dockerfile =>
scripts/Scripts/phantomjs-wttr/Dockerfile
+0,
-0
R home/scripts/phantomjs-wttr/README.md =>
scripts/Scripts/phantomjs-wttr/README.md
+2,
-0
1@@ -1,3 +1,5 @@
2+### i don't use this anymore (i replaced it with a curl command piped to imagemagick. felt like a god doing that.) but keeping here just in case...
3+
4 ## for optiplex 9020 server
5
6 run with following cron job on the server:
R home/scripts/phantomjs-wttr/docker-compose.yml =>
scripts/Scripts/phantomjs-wttr/docker-compose.yml
+0,
-0
R home/scripts/phantomjs-wttr/entrypoint.sh =>
scripts/Scripts/phantomjs-wttr/entrypoint.sh
+0,
-0
R home/scripts/phantomjs-wttr/rasterize.js =>
scripts/Scripts/phantomjs-wttr/rasterize.js
+0,
-0
R home/scripts/phantomjs-wttr/rsync.sh =>
scripts/Scripts/phantomjs-wttr/rsync.sh
+0,
-0
A
stow.sh
+15,
-0
1@@ -0,0 +1,15 @@
2+#!/bin/bash
3+
4+echo "pulling from git..." | gum style --foreground "#f4b8e4" --border none
5+
6+git pull
7+
8+echo "stowing your shit..." | gum style --foreground "#f4b8e4" --border none
9+
10+stow --adopt -v -R -t ~ "config"
11+
12+stow --adopt -v -R -t ~ "git"
13+
14+stow --adopt -v -R -t ~ "scripts"
15+
16+echo "done ^_^" | gum style --foreground "#f4b8e4" --border none
R home/config/calibre/themes/frappe/catppuccin-frappe-lavender.calibre-palette =>
themes/calibre/themes/frappe/catppuccin-frappe-lavender.calibre-palette
+0,
-0
R home/config/lxqt/catppuccin-frappe/LICENSE =>
themes/lxqt/catppuccin-frappe/LICENSE
+0,
-0
R home/config/lxqt/catppuccin-frappe/arrow-left.svg =>
themes/lxqt/catppuccin-frappe/arrow-left.svg
+0,
-0
R home/config/lxqt/catppuccin-frappe/arrow-right.svg =>
themes/lxqt/catppuccin-frappe/arrow-right.svg
+0,
-0
R home/config/lxqt/catppuccin-frappe/ic_back.png =>
themes/lxqt/catppuccin-frappe/ic_back.png
+0,
-0
R home/config/lxqt/catppuccin-frappe/ic_next.png =>
themes/lxqt/catppuccin-frappe/ic_next.png
+0,
-0
R home/config/lxqt/catppuccin-frappe/lxqt-notificationd.qss =>
themes/lxqt/catppuccin-frappe/lxqt-notificationd.qss
+0,
-0
R home/config/lxqt/catppuccin-frappe/lxqt-notificationd/cancel.svg =>
themes/lxqt/catppuccin-frappe/lxqt-notificationd/cancel.svg
+0,
-0
R home/config/lxqt/catppuccin-frappe/lxqt-panel.qss =>
themes/lxqt/catppuccin-frappe/lxqt-panel.qss
+0,
-0
R home/config/lxqt/catppuccin-frappe/lxqt-runner.qss =>
themes/lxqt/catppuccin-frappe/lxqt-runner.qss
+0,
-0
R home/config/lxqt/catppuccin-frappe/lxqt-runner/clear.svg =>
themes/lxqt/catppuccin-frappe/lxqt-runner/clear.svg
+0,
-0
R home/config/lxqt/catppuccin-frappe/penguin.png =>
themes/lxqt/catppuccin-frappe/penguin.png
+0,
-0
R home/config/lxqt/catppuccin-frappe/preview.png =>
themes/lxqt/catppuccin-frappe/preview.png
+0,
-0
R home/config/lxqt/catppuccin-frappe/preview.png~ =>
themes/lxqt/catppuccin-frappe/preview.png~
+0,
-0
R home/config/lxqt/catppuccin-frappe/spacer-plugin/spacer-dots.png =>
themes/lxqt/catppuccin-frappe/spacer-plugin/spacer-dots.png
+0,
-0
R home/config/lxqt/catppuccin-frappe/spacer-plugin/spacer-line.png =>
themes/lxqt/catppuccin-frappe/spacer-plugin/spacer-line.png
+0,
-0
R home/config/lxqt/catppuccin-frappe/unknown.png =>
themes/lxqt/catppuccin-frappe/unknown.png
+0,
-0
R home/config/lxqt/catppuccin-frappe/wallpaper.cfg =>
themes/lxqt/catppuccin-frappe/wallpaper.cfg
+0,
-0
R home/config/lxqt/catppuccin-frappe/wallpaper.png =>
themes/lxqt/catppuccin-frappe/wallpaper.png
+0,
-0
R home/config/qbittorrent/legacy-4.3.8-qBittorrent-bluewave2-v1.18.qbtheme =>
themes/qbittorrent/legacy-4.3.8-qBittorrent-bluewave2-v1.18.qbtheme
+0,
-0
R home/config/qbittorrent/legacy-qBittorrent.qbtheme =>
themes/qbittorrent/legacy-qBittorrent.qbtheme
+0,
-0
R home/config/qtermwidget5/color-schemes/Catppuccin-Frappe.colorscheme =>
themes/qtermwidget5/color-schemes/Catppuccin-Frappe.colorscheme
+0,
-0
R home/config/thunderbird/themes/latte/frappe-lavender.xpi =>
themes/thunderbird/themes/latte/frappe-lavender.xpi
+0,
-0
R home/config/thunderbird/themes/latte/latte-lavender.xpi =>
themes/thunderbird/themes/latte/latte-lavender.xpi
+0,
-0