Skip to content

Commit ed7ee4b

Browse files
update
1 parent af576a3 commit ed7ee4b

File tree

15 files changed

+562
-0
lines changed

15 files changed

+562
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: ZNC bouncer
3+
layout: 2017/sheet
4+
intro: |
5+
A quick reference to the [ZNC](https://znc.bg) IRC bouncer's common commands.
6+
---
7+
8+
## Start
9+
10+
```
11+
/msg *status addserver irc.undernet.org [6667]
12+
/msg *status connect
13+
14+
/msg *status loadmod webadmin
15+
/msg *status loadmod admin
16+
/msg *status loadmod away
17+
/msg *status loadmod awaynick
18+
/msg *status loadmod clientnotify # Notifies when another client logs
19+
/msg *status loadmod keepnick
20+
/msg *status loadmod kickrejoin
21+
```
22+
23+
## Away
24+
25+
```
26+
/msg *status loadmod away
27+
/msg *away away
28+
/msg *away back
29+
/msg *away show #=> Show messages
30+
/msg *away delete all
31+
```
32+
33+
## Watch
34+
35+
```
36+
/msg *status loadmod watch
37+
/msg *watch list
38+
/msg *watch add * *watch *rico*
39+
/msg *watch add * *watch *%nick%*
40+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
8+
<link rel="stylesheet" href="./prism.css">
9+
<script async defer src="./prism.js"></script>
10+
</head>
11+
<body>;
12+
<h2 id="zombie">Zombie</h2>
13+
<h3 id="examples">Examples</h3>
14+
<div class="sourceCode" id="cb1"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb1-1" title="1">browser</a>
15+
<a class="sourceLine" id="cb1-2" title="2"> .<span class="at">visit</span>(<span class="st">&quot;http://.../&quot;</span><span class="op">,</span> <span class="op">-&gt;</span>)</a>
16+
<a class="sourceLine" id="cb1-3" title="3"> .<span class="at">fill</span>(<span class="st">&quot;email&quot;</span><span class="op">,</span> <span class="st">&quot;zombie@underworld.dead&quot;</span>)</a>
17+
<a class="sourceLine" id="cb1-4" title="4"> .<span class="at">fill</span>(<span class="st">&quot;password&quot;</span><span class="op">,</span> <span class="st">&quot;eat-the-living&quot;</span>)</a>
18+
<a class="sourceLine" id="cb1-5" title="5"> .<span class="at">select</span>(<span class="st">&quot;Born&quot;</span><span class="op">,</span> <span class="st">&quot;1985&quot;</span>)</a>
19+
<a class="sourceLine" id="cb1-6" title="6"> .<span class="at">uncheck</span>(<span class="st">&quot;Send newsletter&quot;</span>)</a>
20+
<a class="sourceLine" id="cb1-7" title="7"> .<span class="at">clickLink</span>(<span class="st">&quot;Link name&quot;</span>)</a>
21+
<a class="sourceLine" id="cb1-8" title="8"> .<span class="at">pressButton</span>(<span class="st">&quot;Sign&quot;</span><span class="op">,</span> () <span class="kw">=&gt;</span> <span class="op">{</span> ... <span class="op">}</span>)</a>
22+
<a class="sourceLine" id="cb1-9" title="9"> .<span class="at">text</span>(<span class="st">&quot;H1&quot;</span>)</a></code></pre></div>
23+
<h3 id="expectations">Expectations</h3>
24+
<div class="sourceCode" id="cb2"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb2-1" title="1"><span class="at">expect</span>(<span class="va">browser</span>.<span class="at">query</span>(<span class="st">&quot;#brains&quot;</span>))</a>
25+
<a class="sourceLine" id="cb2-2" title="2"></a>
26+
<a class="sourceLine" id="cb2-3" title="3"><span class="at">expect</span>(<span class="va">browser</span>.<span class="va">body</span>.<span class="at">queryAll</span>(<span class="st">&quot;.hand&quot;</span>)).<span class="at">length</span> <span class="dv">2</span></a>
27+
<a class="sourceLine" id="cb2-4" title="4"></a>
28+
<a class="sourceLine" id="cb2-5" title="5"><span class="va">console</span>.<span class="at">log</span>(<span class="va">browser</span>.<span class="at">html</span>())</a>
29+
<a class="sourceLine" id="cb2-6" title="6"><span class="va">console</span>.<span class="at">log</span>(<span class="va">browser</span>.<span class="at">html</span>(<span class="st">&quot;table.parts&quot;</span>))</a>
30+
<a class="sourceLine" id="cb2-7" title="7"></a>
31+
<a class="sourceLine" id="cb2-8" title="8"><span class="at">expect</span>(<span class="va">Browser</span>.<span class="at">text</span>(<span class="st">&quot;.card-nopad small&quot;</span>)<span class="op">,</span> <span class="st">&quot;A better way to get around!&quot;</span>)</a></code></pre></div>
32+
</body></html>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Zombie
3+
category: JavaScript libraries
4+
layout: 2017/sheet
5+
intro: |
6+
[Zombie](http://zombie.js.org/) is a full-stack testing solution for Node.js.
7+
---
8+
9+
## Zombie
10+
11+
### Examples
12+
13+
```js
14+
browser
15+
.visit("http://.../", ->)
16+
.fill("email", "zombie@underworld.dead")
17+
.fill("password", "eat-the-living")
18+
.select("Born", "1985")
19+
.uncheck("Send newsletter")
20+
.clickLink("Link name")
21+
.pressButton("Sign", () => { ... })
22+
.text("H1")
23+
```
24+
25+
### Expectations
26+
27+
```js
28+
expect(browser.query("#brains"))
29+
30+
expect(browser.body.queryAll(".hand")).length 2
31+
32+
console.log(browser.html())
33+
console.log(browser.html("table.parts"))
34+
35+
expect(Browser.text(".card-nopad small"), "A better way to get around!")
36+
```
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
8+
<link rel="stylesheet" href="./prism.css">
9+
<script async defer src="./prism.js"></script>
10+
</head>
11+
<body>;
12+
<h3 id="expressions">Expressions</h3>
13+
<table>
14+
<thead>
15+
<tr class="header">
16+
<th>Expression</th>
17+
<th>Example</th>
18+
<th>Description</th>
19+
</tr>
20+
</thead>
21+
<tbody>
22+
<tr class="odd">
23+
<td><code>!!</code></td>
24+
<td><code>sudo !!</code></td>
25+
<td>Last command (<code>sudo !!</code>)</td>
26+
</tr>
27+
<tr class="even">
28+
<td></td>
29+
<td></td>
30+
<td></td>
31+
</tr>
32+
<tr class="odd">
33+
<td><code>!*</code></td>
34+
<td><code>vim !*</code></td>
35+
<td>Last command's parameters (<code>vim !*</code>)</td>
36+
</tr>
37+
<tr class="even">
38+
<td><code>!^</code></td>
39+
<td></td>
40+
<td>Last command's first parameter</td>
41+
</tr>
42+
<tr class="odd">
43+
<td><code>!$</code></td>
44+
<td></td>
45+
<td>Last command's last parameter</td>
46+
</tr>
47+
<tr class="even">
48+
<td></td>
49+
<td></td>
50+
<td></td>
51+
</tr>
52+
<tr class="odd">
53+
<td><code>!?ls</code> <code>&lt;tab&gt;</code></td>
54+
<td><code>sudo !?mv</code> <code>&lt;tab&gt;</code></td>
55+
<td>Command and params of last <code>ls</code> command</td>
56+
</tr>
57+
<tr class="even">
58+
<td><code>!?ls?:*</code> <code>&lt;tab&gt;</code></td>
59+
<td></td>
60+
<td>Params of last <code>ls</code> command</td>
61+
</tr>
62+
<tr class="odd">
63+
<td></td>
64+
<td></td>
65+
<td></td>
66+
</tr>
67+
<tr class="even">
68+
<td><code>*(m0)</code></td>
69+
<td><code>rm *(m0)</code></td>
70+
<td>Last modified today</td>
71+
</tr>
72+
<tr class="odd">
73+
<td><code>*(m-4)</code></td>
74+
<td></td>
75+
<td>Last modified &lt;4 days ago</td>
76+
</tr>
77+
</tbody>
78+
</table>
79+
<p>{: .-headers}</p>
80+
<h3 id="change-default-shell">Change default shell</h3>
81+
<div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><a class="sourceLine" id="cb1-1" title="1"><span class="fu">chsh</span> -s <span class="kw">`</span><span class="fu">which</span> zsh<span class="kw">`</span></a></code></pre></div>
82+
<h3 id="process-substitution">Process Substitution</h3>
83+
<table>
84+
<colgroup>
85+
<col style="width: 33%" />
86+
<col style="width: 33%" />
87+
<col style="width: 33%" />
88+
</colgroup>
89+
<thead>
90+
<tr class="header">
91+
<th>Expression</th>
92+
<th>Example</th>
93+
<th>Description</th>
94+
</tr>
95+
</thead>
96+
<tbody>
97+
<tr class="odd">
98+
<td><code>&lt;(COMMAND)</code></td>
99+
<td><code>grep "needle" &lt;(curl "https://haystack.io")</code></td>
100+
<td>Replace argument with <em>named pipe/FIFO</em> (read-only) with command output</td>
101+
</tr>
102+
<tr class="even">
103+
<td><code>=(COMMAND)</code></td>
104+
<td><code>vim =(curl "https://haystack.io")</code></td>
105+
<td>Replace argument with <em>file</em> (writable) containing command output</td>
106+
</tr>
107+
</tbody>
108+
</table>
109+
<p>{: .-headers}</p>
110+
<h3 id="also-see">Also see</h3>
111+
<ul>
112+
<li><a href="./bash">Bash cheatsheet</a></li>
113+
</ul>
114+
<p>Zsh is mostly compatible with Bash, so most everything in Bash's cheatsheet also applies.</p>
115+
</body></html>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: zsh
3+
category: CLI
4+
layout: 2017/sheet
5+
---
6+
7+
### Expressions
8+
9+
| Expression | Example | Description
10+
| --- | --- | ---
11+
| `!!` | `sudo !!` | Last command (`sudo !!`)
12+
| --- | --- | ---
13+
| `!*` | `vim !*` | Last command's parameters (`vim !*`)
14+
| `!^` | | Last command's first parameter
15+
| `!$` | | Last command's last parameter
16+
| --- | --- | ---
17+
| `!?ls` `<tab>` | `sudo !?mv` `<tab>` | Command and params of last `ls` command
18+
| `!?ls?:*` `<tab>` | | Params of last `ls` command
19+
| --- | --- | ---
20+
| `*(m0)` | `rm *(m0)` | Last modified today
21+
| `*(m-4)` | | Last modified <4 days ago
22+
{: .-headers}
23+
24+
### Change default shell
25+
26+
```bash
27+
chsh -s `which zsh`
28+
```
29+
30+
### Process Substitution
31+
32+
| Expression | Example | Description
33+
| --- | --- | ---
34+
| `<(COMMAND)` | `grep "needle" <(curl "https://haystack.io")` | Replace argument with _named pipe/FIFO_ (read-only) with command output
35+
| `=(COMMAND)` | `vim =(curl "https://haystack.io")` | Replace argument with _file_ (writable) containing command output
36+
{: .-headers}
37+
38+
### Also see
39+
40+
- [Bash cheatsheet](./bash)
41+
42+
Zsh is mostly compatible with Bash, so most everything in Bash's cheatsheet also applies.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<link rel="stylesheet" href="https://gist.githubusercontent.com/bgoonz/37bca66ce8441c688900b6f082f10560/raw/2e9a5966431d89b8ce6355e7b8039ba42554978b/CSS-Styling-for-Pandoc-generated-html.css">
8+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
9+
<link rel="stylesheet" href="https://raw.githubusercontent.com/bgoonz/styling-templates/master/bootstrap3/assets/css/bootstrap.min.css">
10+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/prism.min.js" integrity="sha512-YBk7HhgDZvBxmtOfUdvX0z8IH2d10Hp3aEygaMNhtF8fSOvBZ16D/1bXZTJV6ndk/L/DlXxYStP8jrF77v2MIg==" crossorigin="anonymous"></script>
11+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/components/prism-css.min.js" integrity="sha512-1qYok2x2Rsm2y+mrdyrp00iH7xYSgVyIQ1egDAoT7CBZ3kSzlaJK+NhWAh746NeL3gnH6dnP8FGS+3xOdwO7ig==" crossorigin="anonymous"></script>
12+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/themes/prism.min.css" integrity="sha512-tN7Ec6zAFaVSG3TpNAKtk4DOHNpSwKHxxrsiw4GHKESGPs5njn/0sMCUMl2svV4wo4BK/rCP7juYz+zx+l6oeQ==" crossorigin="anonymous" />
13+
14+
</head>
15+
<body>;
16+
<p>Flattens an object with the paths for keys.</p>
17+
<ul>
18+
<li>Use recursion.</li>
19+
<li>Use <code>Object.keys(obj)</code> combined with <code>Array.prototype.reduce()</code> to convert every leaf node to a flattened path node.</li>
20+
<li>If the value of a key is an object, the function calls itself with the appropriate <code>prefix</code> to create the path using <code>Object.assign()</code>.</li>
21+
<li>Otherwise, it adds the appropriate prefixed key-value pair to the accumulator object.</li>
22+
<li>You should always omit the second argument, <code>prefix</code>, unless you want every key to have a prefix.</li>
23+
</ul>
24+
<div class="sourceCode" id="cb1"><pre class="sourceCode js"><code class="language-js sourceCode javascript"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">const</span> flattenObject <span class="op">=</span> (obj<span class="op">,</span> prefix <span class="op">=</span> <span class="st">&#39;&#39;</span>) <span class="kw">=&gt;</span></a>
25+
<a class="sourceLine" id="cb1-2" title="2"> <span class="va">Object</span>.<span class="at">keys</span>(obj).<span class="at">reduce</span>((acc<span class="op">,</span> k) <span class="kw">=&gt;</span> <span class="op">{</span></a>
26+
<a class="sourceLine" id="cb1-3" title="3"> <span class="kw">const</span> pre <span class="op">=</span> <span class="va">prefix</span>.<span class="at">length</span> <span class="op">?</span> <span class="vs">`</span><span class="sc">${</span>prefix<span class="sc">}</span><span class="vs">.`</span> : <span class="st">&#39;&#39;</span><span class="op">;</span></a>
27+
<a class="sourceLine" id="cb1-4" title="4"> <span class="cf">if</span> (</a>
28+
<a class="sourceLine" id="cb1-5" title="5"> <span class="kw">typeof</span> obj[k] <span class="op">===</span> <span class="st">&#39;object&#39;</span> <span class="op">&amp;&amp;</span></a>
29+
<a class="sourceLine" id="cb1-6" title="6"> obj[k] <span class="op">!==</span> <span class="kw">null</span> <span class="op">&amp;&amp;</span></a>
30+
<a class="sourceLine" id="cb1-7" title="7"> <span class="va">Object</span>.<span class="at">keys</span>(obj[k]).<span class="at">length</span> <span class="op">&gt;</span> <span class="dv">0</span></a>
31+
<a class="sourceLine" id="cb1-8" title="8"> )</a>
32+
<a class="sourceLine" id="cb1-9" title="9"> <span class="va">Object</span>.<span class="at">assign</span>(acc<span class="op">,</span> <span class="at">flattenObject</span>(obj[k]<span class="op">,</span> pre <span class="op">+</span> k))<span class="op">;</span></a>
33+
<a class="sourceLine" id="cb1-10" title="10"> <span class="cf">else</span> acc[pre <span class="op">+</span> k] <span class="op">=</span> obj[k]<span class="op">;</span></a>
34+
<a class="sourceLine" id="cb1-11" title="11"> <span class="cf">return</span> acc<span class="op">;</span></a>
35+
<a class="sourceLine" id="cb1-12" title="12"> <span class="op">},</span> <span class="op">{}</span>)<span class="op">;</span></a></code></pre></div>
36+
<div class="sourceCode" id="cb2"><pre class="sourceCode js"><code class="language-js sourceCode javascript"><a class="sourceLine" id="cb2-1" title="1"><span class="at">flattenObject</span>(<span class="op">{</span> <span class="dt">a</span><span class="op">:</span> <span class="op">{</span> <span class="dt">b</span><span class="op">:</span> <span class="op">{</span> <span class="dt">c</span><span class="op">:</span> <span class="dv">1</span> <span class="op">}</span> <span class="op">},</span> <span class="dt">d</span><span class="op">:</span> <span class="dv">1</span> <span class="op">}</span>)<span class="op">;</span> <span class="co">// { &#39;a.b.c&#39;: 1, d: 1 }</span></a></code></pre></div>
37+
</body></html>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<link rel="stylesheet" href="https://gist.githubusercontent.com/bgoonz/37bca66ce8441c688900b6f082f10560/raw/2e9a5966431d89b8ce6355e7b8039ba42554978b/CSS-Styling-for-Pandoc-generated-html.css">
8+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
9+
<link rel="stylesheet" href="https://raw.githubusercontent.com/bgoonz/styling-templates/master/bootstrap3/assets/css/bootstrap.min.css">
10+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/prism.min.js" integrity="sha512-YBk7HhgDZvBxmtOfUdvX0z8IH2d10Hp3aEygaMNhtF8fSOvBZ16D/1bXZTJV6ndk/L/DlXxYStP8jrF77v2MIg==" crossorigin="anonymous"></script>
11+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/components/prism-css.min.js" integrity="sha512-1qYok2x2Rsm2y+mrdyrp00iH7xYSgVyIQ1egDAoT7CBZ3kSzlaJK+NhWAh746NeL3gnH6dnP8FGS+3xOdwO7ig==" crossorigin="anonymous"></script>
12+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/themes/prism.min.css" integrity="sha512-tN7Ec6zAFaVSG3TpNAKtk4DOHNpSwKHxxrsiw4GHKESGPs5njn/0sMCUMl2svV4wo4BK/rCP7juYz+zx+l6oeQ==" crossorigin="anonymous" />
13+
14+
</head>
15+
<body>;
16+
<p>Takes a function as an argument, then makes the first argument the last.</p>
17+
<ul>
18+
<li>Use argument destructuring and a closure with variadic arguments.</li>
19+
<li>Splice the first argument, using the spread operator (<code>...</code>), to make it the last before applying the rest.</li>
20+
</ul>
21+
<div class="sourceCode" id="cb1"><pre class="sourceCode js"><code class="language-js sourceCode javascript"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">const</span> flip <span class="op">=</span> fn <span class="kw">=&gt;</span> (first<span class="op">,</span> ...<span class="at">rest</span>) <span class="kw">=&gt;</span> <span class="at">fn</span>(...<span class="at">rest</span><span class="op">,</span> first)<span class="op">;</span></a></code></pre></div>
22+
<div class="sourceCode" id="cb2"><pre class="sourceCode js"><code class="language-js sourceCode javascript"><a class="sourceLine" id="cb2-1" title="1"><span class="kw">let</span> a <span class="op">=</span> <span class="op">{</span> <span class="dt">name</span><span class="op">:</span> <span class="st">&#39;John Smith&#39;</span> <span class="op">};</span></a>
23+
<a class="sourceLine" id="cb2-2" title="2"><span class="kw">let</span> b <span class="op">=</span> <span class="op">{};</span></a>
24+
<a class="sourceLine" id="cb2-3" title="3"><span class="kw">const</span> mergeFrom <span class="op">=</span> <span class="at">flip</span>(<span class="va">Object</span>.<span class="at">assign</span>)<span class="op">;</span></a>
25+
<a class="sourceLine" id="cb2-4" title="4"><span class="kw">let</span> mergePerson <span class="op">=</span> <span class="va">mergeFrom</span>.<span class="at">bind</span>(<span class="kw">null</span><span class="op">,</span> a)<span class="op">;</span></a>
26+
<a class="sourceLine" id="cb2-5" title="5"><span class="at">mergePerson</span>(b)<span class="op">;</span> <span class="co">// == b</span></a>
27+
<a class="sourceLine" id="cb2-6" title="6">b <span class="op">=</span> <span class="op">{};</span></a>
28+
<a class="sourceLine" id="cb2-7" title="7"><span class="va">Object</span>.<span class="at">assign</span>(b<span class="op">,</span> a)<span class="op">;</span> <span class="co">// == b</span></a></code></pre></div>
29+
</body></html>

0 commit comments

Comments
 (0)