Skip to content

Instantly share code, notes, and snippets.

View khasky's full-sized avatar
💭
Находи в себе силы делать то, на что другие просто не способны.

Khasky khasky

💭
Находи в себе силы делать то, на что другие просто не способны.
View GitHub Profile
@khasky
khasky / settings.local.json
Created May 16, 2026 07:13
Claude Code settings preset: acceptEdits mode with full Bash allowed, plus ask/deny guardrails for dangerous, network, Git, publish, and secrets-related actions
{
"permissions": {
"defaultMode": "acceptEdits",
"allow": [
"Read",
"Edit",
"Write",
"Bash"
],
"ask": [
@khasky
khasky / settings.local.json
Created May 16, 2026 07:12
Claude Code settings preset: acceptEdits mode, explicit dev-command allowlist, MCP whitelist, and guardrails for secrets and destructive Bash commands
{
"permissions": {
"defaultMode": "acceptEdits",
"allow": [
"Read",
"Edit",
"Write",
"Bash(git status)",
"Bash(git status *)",
@khasky
khasky / .cursorindexingignore
Created May 8, 2026 05:21
.cursorindexingignore
node_modules/
dist/
build/
coverage/
.next/
.nuxt/
.turbo/
.cache/
@khasky
khasky / .cursorignore
Created May 8, 2026 05:20
.cursorignore
# Secrets
.env
.env.*
*.pem
*.key
*.p12
*.pfx
secrets/
private/
certs/
@khasky
khasky / settings.json
Created May 8, 2026 05:15
%USERPROFILE%\.claude\settings.json
{
"env": {
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"DISABLE_TELEMETRY": "1",
"DISABLE_ERROR_REPORTING": "1",
"DISABLE_FEEDBACK_COMMAND": "1",
"CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY": "1",
"CLAUDE_CODE_SKIP_PROMPT_HISTORY": "1",
"CLAUDE_CODE_DISABLE_AUTO_MEMORY": "1",
@khasky
khasky / useScrollDirection.ts
Created April 8, 2026 06:41
useScrollDirection React Hook
// Subscribes to `scroll` (passive) and exposes whether the user is moving
// down the page, up, or still in the “top” band (y === 0 or within ~40px while settling).
import { useEffect, useState } from 'react';
export enum ScrollDirection {
Top = -1,
Initial = 0,
Bottom = 1,
}
@khasky
khasky / useHeadingAnchors.ts
Created April 8, 2026 06:40
useHeadingAnchors React Hook
// After mount, collects linked headings (`a > h2`–`h6`) into `{ id, text }` pairs
// from the parent anchors `id`; state updates only when there are at least two (for TOC-style UI).
import React from 'react';
export interface HeadingAnchor {
id: string;
text: string;
}
export const useHeadingAnchors = () => {
@khasky
khasky / useHashChange.ts
Created April 8, 2026 06:39
useHashChange React Hook
// Keeps React state in sync with `window.location.hash` (fragment without `#`)
// via `hashchange`, and seeds from the initial hash on mount.
import React from 'react';
export function useHashChange() {
const [activeItemId, setActiveItemId] = React.useState<string | null>(null);
React.useEffect(() => {
if (!activeItemId && window.location.hash) {
setActiveItemId(window.location.hash.substring(1));
@khasky
khasky / useDisableBodyScroll.ts
Created April 8, 2026 06:38
useDisableBodyScroll React Hook
// When `open` is true, sets `document.body.style.overflow` to `hidden` so
// the page behind modals/drawers does not scroll; restores `unset` when closed.
import { useEffect } from 'react';
export const useDisableBodyScroll = (open: boolean) => {
useEffect(() => {
if (open) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = 'unset';
@khasky
khasky / useDirectionTransform.ts
Created April 8, 2026 06:38
useDirectionTransform React Hook
// Builds Theme UI `sx` transforms so a sticky/floating bar slides in on scroll-up or near the top
// and slides away on scroll-down; optional burger-menu attrs keep it visible while the menu is open.
import React from 'react';
import { BoxProps } from 'theme-ui';
import { useScrollDirection, ScrollDirection } from '@/hooks/useScrollDirection';
const SCROLL_Y_OFFSET_PX = 500;
interface DirectionTransformProps {