Skip to content

Instantly share code, notes, and snippets.

@hucancode
hucancode / README.md
Last active May 28, 2024 20:51
Flatten Strapi 4's response JSON

Update 29/11/2022

There is a plugin on Strapi Marketplace that do this response transforming stuffs in a more configurable way. Checkout this if you are interested.

@hjertnes
hjertnes / doom.txt
Created April 6, 2018 08:28
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@jh3y
jh3y / showPositionMarker.js
Last active November 29, 2022 07:16
show text cursor position marker
/**
* shows a position marker that highlights where the cursor is
* @param {object} e - the input or click event that has been fired
*/
const showPositionMarker = e => {
// grab the input element
const { currentTarget: input } = e
// create a function that will handle clicking off of the input and hide the marker
const processClick = evt => {
if (e !== evt && evt.target !== e.target) {
@jh3y
jh3y / getCursorXY.js
Last active February 26, 2023 23:44
get text cursor position
/**
* returns x, y coordinates for absolute positioning of a span within a given text input
* at a given selection point
* @param {object} input - the input element to obtain coordinates for
* @param {number} selectionPoint - the selection point for the input
*/
const getCursorXY = (input, selectionPoint) => {
const {
offsetLeft: inputX,
offsetTop: inputY,