Svelte | Malina.js | Shortcut / Comment |
---|---|---|
Reference to element | ||
bind:this={ref} |
#ref |
|
1-way binding | ||
prop={prop} |
prop={prop} |
|
{prop} |
{prop} |
|
2-way binding | ||
bind:value={value} |
bind:value={value} |
:value={value} / :value:value |
bind:value |
bind:value |
:value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
$$htmlToFragment, $$removeItem, $$childNodes, $watch, $ChangeDetector, $$removeElements, | |
$digest, $$htmlBlock, $$compareDeep, $$compareArray, $watchReadOnly, $$ifBlock | |
} from 'malinajs/runtime.js'; | |
export default function App($element, $option) { | |
if ($option == null) $option = {}; | |
let name = ''; | |
let event = ''; | |
const click = e => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
let name = ''; | |
let todos = [{name: 'Linux'}, {name: 'Ubuntu', done: true}]; | |
let active; | |
function add() { | |
if(!name) return; | |
todos.push({name: name}); | |
name = ''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
let todos = []; | |
let duration = ''; | |
function timeit(fn) { | |
let start = Date.now(); | |
fn(); | |
setTimeout(() => { | |
duration += ' + ' + (Date.now() - start); | |
}, 10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# xkbcomp 2.xkb $DISPLAY | |
# xkbcomp $DISPLAY - > init.2 | |
# xmodmap | |
xkb_keymap { | |
xkb_keycodes { | |
include "evdev+aliases(qwerty)" | |
<LALT> = 108; | |
<RALT> = 64; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words = ['abc', 'ubuntu', 'linux', 'ubuntu 16 LTS', 'redhat', 'unix', 'windows', 'macos X'] | |
def tre(w): | |
w = w.lower() | |
r = {'__' + w[0], '_' + w[:2]} | |
for i in range(len(w)): | |
k = w[i:i+3] | |
while len(k) < 3: | |
k += '_' | |
r.add(k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// file /usr/share/X11/xkb/symbols/se | |
partial alphanumeric_keys | |
xkb_symbols "se" { | |
name[Group1]="Swedish"; | |
// tool: xev | |
// mapping key file: /usr/share/X11/xkb/keycodes/evdev | |
// reload conf: setxkbmap -layout se | |
// key <code> {[ default, +shift, +altGr, +shit +altgr ]}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.rabbitmq.client.AMQP; | |
import com.rabbitmq.client.Channel; | |
import com.rabbitmq.client.Connection; | |
import com.rabbitmq.client.ConnectionFactory; | |
import java.io.IOException; | |
import java.util.UUID; | |
import java.util.concurrent.ArrayBlockingQueue; | |
import java.util.concurrent.BlockingQueue; | |
import java.util.concurrent.TimeoutException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# client.py | |
import requests | |
print(requests.post('http://127.0.0.1:8001/test/command', json={'id': 1, 'params': 'Hello'}).json()) | |
# worker.py | |
import requests | |
while True: | |
req = requests.post('http://127.0.0.1:8001/test/command', headers={'Type': 'get'}).json() | |
response = { | |
'id': req['id'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load: 0.369427308000013 | |
find: 0.03731154500019329 | |
sample 1: ['6.19889798576753', '306.03317783754981', 'NCV'] | |
sample 2: ['6.19889798576753', '306.03317783754981', 'NCV'] |