const groupBy = key => array =>
array.reduce((objectsByKeyValue, obj) => {
const value = obj[key];
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
return objectsByKeyValue;| package chela.kotlinJS.sql | |
| import chela.kotlinJS.sql.DBType.localStorage | |
| object ChSql{ | |
| private val queries = mutableMapOf<String, Query>() | |
| private val Dbs = mutableMapOf<String, DataBase>() | |
| val mode = localStorage | |
| fun getDb(k:String) = Dbs[k] ?: throw Throwable("invalid getDb $k") | |
| fun addDb(k:String, vararg create:String){ |
Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.
- List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describeNote the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.
- Reset the consumer offset for a topic (preview)
| # first install pygmentize to the mac OS X or macOS system with the built-in python | |
| sudo easy_install Pygments | |
| # then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc. | |
| alias pcat='pygmentize -f terminal256 -O style=native -g' |
| Toggle safe mode: gs | |
| Create new file: N | |
| Delete file: d | |
| Rename file: r | |
| New directory: K | |
| Open file: e | |
| Move file: m | |
| Open VimFilerExplorer: e | |
| Open current directory in a new buffer: dl | |
| Open current directory in a new split: ds |
| /* | |
| * Handling Errors using async/await | |
| * Has to be used inside an async function | |
| */ | |
| try { | |
| const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
| // Success ๐ | |
| console.log(response); | |
| } catch (error) { | |
| // Error ๐จ |
Free O'Reilly books and convenient script to just download them.
Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post
How to use:
- Take the
download.shfile and put it into a directory where you want the files to be saved. cdinto the directory and make sure that it has executable permissions (chmod +x download.shshould do it)- Run
./download.shand wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
| const zip = (arr, ...arrs) => { | |
| return arr.map((val, i) => arrs.reduce((a, arr) => [...a, arr[i]], [val])); | |
| } | |
| // example | |
| const a = [1, 2, 3]; | |
| const b = [4, 5, 6]; | |
| const c = [7, 8, 9]; |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft,elem.offsetTop,elem.offsetWidth,elem.offsetHeight,elem.offsetParent
๋ค์ํ ๊ฐ๊ฒฉ๋์ ์์ธ์๋ด ์ค์์ผ๋ฅผ ์๊ฐํํ ์ง๋.
๋ง์ง ์ด๋ฆ๋ค์ด ๊ฒน์น์ง ์๊ฒ ํ๊ธฐ ์ํด forced layout์ ์ ์ฉํ์ต๋๋ค.
- ๋ฐ์ดํฐ ์์ง: ์์์
- Author: Lucy Park
- License: Apache v2