Skip to content

Instantly share code, notes, and snippets.

View seungdols's full-sized avatar
๐Ÿ’ญ
๐Ÿ’ป working.

seungdols seungdols

๐Ÿ’ญ
๐Ÿ’ป working.
View GitHub Profile
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){
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@marwei
marwei / how_to_reset_kafka_consumer_group_offset.md
Created November 9, 2017 23:39
How to Reset Kafka Consumer Group Offset

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note 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.

  1. Reset the consumer offset for a topic (preview)
@BretFisher
BretFisher / pcat-install.sh
Last active October 22, 2025 09:55
On macOS: Install pygmentize and alias pcat for shell code syntax highlighting
# 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'
@elithrade
elithrade / vimfiler-shortcuts
Last active October 12, 2022 21:13
Common vimfiler keyboard shortcuts
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
@fgilio
fgilio / axios-catch-error.js
Last active December 3, 2025 15:46
Catch request errors with Axios
/*
* 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 ๐Ÿ˜จ
@augbog
augbog / Free O'Reilly Books.md
Last active November 23, 2025 23:36
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
@renaudtertrais
renaudtertrais / zip.js
Created July 5, 2016 13:59
A simple ES6 zip function
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];
@paulirish
paulirish / what-forces-layout.md
Last active December 8, 2025 09:19
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

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.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@e9t
e9t / README.md
Last active January 10, 2018 14:29
์„œ์šธ์‹œ ์Šค์‹œ์•ผ ๊ธฐํ–‰

๋‹ค์–‘ํ•œ ๊ฐ€๊ฒฉ๋Œ€์˜ ์„œ์šธ์‹œ๋‚ด ์Šค์‹œ์•ผ๋ฅผ ์‹œ๊ฐํ™”ํ•œ ์ง€๋„.

๋ง›์ง‘ ์ด๋ฆ„๋“ค์ด ๊ฒน์น˜์ง€ ์•Š๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด forced layout์„ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

  • ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘: ์ˆ˜์ž‘์—…
  • Author: Lucy Park
  • License: Apache v2