Skip to content

Instantly share code, notes, and snippets.

@jeiea
jeiea / open_in_notion.user.js
Last active November 28, 2022 02:58
Open web notion link in desktop app
// ==UserScript==
// @name Open notion in app
// @namespace https://gist.github.com/jeiea/514c8c0862710cc04aa9cbb5ac465c84
// @downloadURL https://gist.github.com/jeiea/514c8c0862710cc04aa9cbb5ac465c84/raw/open_in_notion.user.js
// @version 0.3
// @description Useful with slack integration.
// @author jeiea
// @match https://www.notion.so/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=notion.so
// @grant window.close
@jeiea
jeiea / a.log
Created February 8, 2022 10:36
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 3.34.0
Flutter extension: 3.34.0 (activated)
App: Visual Studio Code
Version: 1.64.0
Platform: win
Workspace type: Flutter
const makePageNavigator = ref => {
let currentPage;
let ratio;
let ignoreIntersection = false;
const resetAnchor = entries => {
const container = ref.current;
if (!container?.clientHeight || entries.length === 0) {
return;
@jeiea
jeiea / sql_format.ts
Last active December 14, 2021 05:06
deno sql formatter for dbeaver
// deno run sql_format.ts
import { format } from "http://esm.sh/[email protected]";
import { readAll, writeAll } from "https://deno.land/[email protected]/io/mod.ts";
const input = await readAll(Deno.stdin);
const unformatted = new TextDecoder().decode(input);
const formatted = format(unformatted, { language: "mysql" });
await writeAll(Deno.stdout, new TextEncoder().encode(formatted));
@jeiea
jeiea / debug-scroll.md
Last active October 28, 2021 23:05 — forked from cuth/debug-scroll.md
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/

Debug Horizontal Scroll

(() => {
  let { offsetWidth, offsetHeight } = document.documentElement;
  let walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT);
  while (walker.nextNode()) {
    let bound = walker.currentNode.getBoundingClientRect();
    let isWidthOverflow = bound.right > offsetWidth || bound.left < 0;
 let isHeightOverflow = bound.bottom &gt; offsetHeight || bound.top &lt; 0;
@jeiea
jeiea / proxy.js
Created January 16, 2021 22:45
tried monitoring object
{
const collapsedTrace = (message) => {
console.groupCollapsed(message);
console.trace();
console.groupEnd();
};
const isPrimitive = (x) => x !== Object(x);
const proxy = (target, path) => {
@jeiea
jeiea / replace-path.sh
Created September 28, 2020 04:16
Substitute string from all path
# You shouldn't execute this if you didn't read it.
# If not installed
brew install sd
# Not effective commands
find . -ipath '*apple*' -type f | tac > source.txt
cat source.txt | sd 'apple' 'banana' | sd 'Apple' 'Banana' > dest.txt
paste -d" " source.txt dest.txt > replace.txt
import React from 'react';
import PropTypes from 'prop-types';
import { useKeenSlider } from 'keen-slider/react';
import 'keen-slider/keen-slider.min.css';
KeenSlider.propTypes = {
children: PropTypes.node,
};
function KeenSlider({ children, ...props }) {
const [sliderRef] = useKeenSlider({
@jeiea
jeiea / jq-skeleton.sh
Last active December 7, 2019 16:36
It extracts json structure with parsing string json and picking first element of array
jq 'def r: walk(if type == "array" then if .[0] then [.[0]] else [] end else (fromjson? | r) // . end); r' a.json
# a.json
# {
# "array": [1,2,3],
# "nested_json": "{\"likes\": [1,2,3]}"
# }
#
# output
# {
@jeiea
jeiea / tasks.json
Created November 14, 2019 14:14
haskell stack windows vscode build task
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "chcp 65001; stack build --fast",
"group": {