Skip to content

Instantly share code, notes, and snippets.

View anubra266's full-sized avatar
💥
Playing vscode...

Abraham anubra266

💥
Playing vscode...
View GitHub Profile
@anubra266
anubra266 / fuzz-search.js
Created October 18, 2024 14:38
fuxxy search
class Search {
constructor(list, options = {}) {
this.list = list;
this.options = {
isCaseSensitive: options.isCaseSensitive || false,
includeScore: options.includeScore || false,
shouldSort: options.shouldSort || true,
includeMatches: options.includeMatches || false,
minMatchCharLength: options.minMatchCharLength || 1,
threshold: options.threshold || 0.6,
@anubra266
anubra266 / guide.md
Created May 29, 2024 04:53
Svelte toast with events
<!-- 1. Create the single toast -->
<script lang="ts">
  import { normalizeProps, useActor } from "@zag-js/svelte"
  import * as toast from "@zag-js/toast"

  interface Props {
    actor: toast.Service
  }
@anubra266
anubra266 / gist:2d40f3ede2bd9b8149458c9fec9dc990
Created February 22, 2022 00:24
Always open chakra UI drawer
https://github.com/chakra-ui/chakra-ui/issues/2893#issuecomment-780143150
@anubra266
anubra266 / favicon.md
Last active July 9, 2021 18:29
Themes svg favicons
<svg>
  <style>
    path { fill: black; }
    @media (prefers-color-scheme: dark) {
      path { fill: white; }
    }
  </style>

 
@anubra266
anubra266 / usage.md
Created June 15, 2021 08:41
tags input
function Usage() {
  const inputStyles = useMultiStyleConfig("Input", { size:'md', variant:'filled' }).field
  const tagStyles = useStyleConfig("InputGroup", { size: 'sm' })
  console.log(tagStyles)  
   
  return (
      <Wrap w="100%" tabIndex="1" __css={inputStyles} display="flex"  align="center" h="auto" py="2" >
      
         <Tag
@anubra266
anubra266 / Readme.md
Created June 2, 2021 00:26
Prevent Input loss of focus when clicking a menu item
$(document).on('mousedown', '#inputMenu li', function (e) {
    $('#input').val($(this).text());
    $('#inputMenu').removeClass('active');
    e.preventDefault();
    return false
});
  
$('#input').on('focusout',function(e) {
 $('#inputMenu').removeClass('active');

Get deps with

npx npm-remote-ls --flatten @chakra-ui/react -d false -o false

NB: Apostrophe must be double quotes

const deps = [
 "@chakra-ui/[email protected]",
https://codepen.io/denic/pen/GRoOxbM
@anubra266
anubra266 / app.tsx.md
Created May 26, 2021 11:27
Hauptrolle transitioning NextJs Pages
 import type { AppProps } from "next/app";
import { AnimatePresence, motion } from "framer-motion";
import { ChakraProvider, DarkMode, Box, BoxProps } from "@chakra-ui/react";
import Head from "next/head";

import { theme } from "../theme";
import { PageWrapper } from "../components/PageWrapper";
import { Header } from "../components/Header";
import { Footer } from "../components/Footer";
@anubra266
anubra266 / g.md
Created May 13, 2021 13:39
Generic answer
interface FormProps<T extends Record<string, any>> {
  initialValues: T;
  children: (fields: T) => any
}