Paste in insert mode?

While in insert mode hit CTRL-R {register} Examples: CTRL-R * will insert in the contents of the clipboard CTRL-R ” (the unnamed register) inserts the last delete or yank. To find this in vim’s help type :h i_ctrl-r

How to pass arguments to addEventListener listener function?

Why not just get the arguments from the target attribute of the event? Example: const someInput = document.querySelector(‘button’); someInput.addEventListener(‘click’, myFunc, false); someInput.myParam = ‘This is my parameter’; function myFunc(evt) { window.alert(evt.currentTarget.myParam); } <button class=”input”>Show parameter</button> JavaScript is a prototype-oriented language, remember!

How to convert JSON data into a Python object?

UPDATE With Python3, you can do it in one line, using SimpleNamespace and object_hook: import json from types import SimpleNamespace data=”{“name”: “John Smith”, “hometown”: {“name”: “New York”, “id”: 123}}” # Parse JSON into an object with attributes corresponding to dict keys. x = json.loads(data, object_hook=lambda d: SimpleNamespace(**d)) print(x.name, x.hometown.name, x.hometown.id) OLD ANSWER (Python2) In Python2, …

Read more

How to find and fix fragmented MySQL tables

the short answer: select ENGINE, TABLE_NAME,Round( DATA_LENGTH/1024/1024) as data_length , round(INDEX_LENGTH/1024/1024) as index_length, round(DATA_FREE/ 1024/1024) as data_free from information_schema.tables where DATA_FREE > 0; The “You must know” answer first at all you must understand that Mysql tables get fragmented when a row is updated, so it’s a normal situation. When a table is created, lets …

Read more