# Welcome to Cacher
We're delighted you've chosen Cacher to be your snippet organizer! Whether you're a solo developer or a member of your team, Cacher is here to help you organize and use snippets more efficiently.
Our users create snippets to:
- Remember project-specific algorithms
- Create cheatsheets for useful libraries
- Share knowledge with colleagues
Take a few minutes to look over our **Getting Started** snippets. To view more detailed information on features, you can visit [Cacher /**
* @param {string} s
* @return {number}
*/
var minInsertions = function(s) {
let insertions = 0; // number of insertions we've made
let need = 0; // number of ')' still needed
for (const ch of s) {
if (ch === '(') {
// Every '(' needs two ')'
need += 2;
// If need is odd, we have a lone ')'
// that should be paired into '))'
if (need % 2 === 1) {
insertions++; // insert one ')'
-- 1. Zápis pomocí EXISTS
SELECT o.*
FROM `order` o
WHERE EXISTS (
SELECT 1
FROM `user` u
WHERE u.id = o.user_id
AND u.country_code = o.country_code -- Druhá podmínka
AND u.is_active = 1 -- Třetí podmínka
);
-- 2. Zápis pomocí IN
SELECT o.*
FROM `order` o
WHERE (o.user_id, o.country_code) IN (
SELECT u.id, u.country_code
FROM `user` u
WHERE u.is_active = 1
);## # Ducat Protocol
[Ducat Protocol](https://www.ducatprotocol.com/) is a bitcoin-native credit and stablecoin protocol built on Bitcoin L1. Users lock BTC in UTXO vaults via tapscript and borrow a dollar-pegged stablecoin without lenders or custodians.
Website: [https://www.ducatprotocol.com/](https://www.ducatprotocol.com/)
/**
* @param {string} s
* @return {string}
*/
var removeOuterParentheses = function(s) {
let result = [];
let depth = 0; // Tracks the current nesting level of parentheses
for (let i = 0; i < s.length; i++) {
let char = s[i];
if (char === '(') {
// If depth > 0, this '(' is inside the primitive string (not the outermost)
if (depth > 0) {
result.push(char);
}
depth++; // Increase depth aftimport { Component } from '@theme/component';
import { onAnimationEnd } from '@theme/utilities';
import { ThemeEvents, CartUpdateEvent } from '@theme/events';
/**
* A custom element that displays a cart icon.
*
* @typedef {object} Refs
* @property {HTMLElement} cartBubble - The cart bubble element.
* @property {HTMLElement} cartBubbleText - The cart bubble text element.
* @property {HTMLElement} cartBubbleCount - The cart bubble count element.
*
* @extends {Component<Refs>}
*/
class Ca# pre-commit — tutoriel synthétique et progressif
## Préambule
**Public visé.** Data engineer Python (dbt, Snowflake, DuckDB, AWS) sous Linux, shell zsh, qui connaît Git au quotidien (`add`, `commit`, `push`) et veut que les vérifications répétitives — espaces en fin de ligne, YAML invalide, lint Python, secrets, fichiers trop gros — se fassent toutes seules avant chaque commit, sur son poste comme en CI. Il s'agit de **pre-commit, le framework** (pre-commit.com), à ne pas confondre avec le ho# grep — tutoriel synthétique et progressif
## Préambule
**Public visé.** Data engineer Python (dbt, Snowflake, DuckDB, AWS) sous Linux, shell zsh, qui tape `grep -ri motif .` par réflexe et veut chercher vite et juste dans des journaux, des CSV et un dépôt de code, puis utiliser grep dans des scripts. Les expressions régulières de base sont supposées connues (tutoriels sed et awk de la série) : ce volet systématise ce qui change **d'un dialecte à l'autre** et **d'une implémentation à l'autre* <p>
[company_profile:node:field_company_address:address_line1]<br>
[company_profile:node:field_company_address:locality] [company_profile:node:field_company_address:administrative_area] [company_profile:node:field_company_address:postal_code]
</p>/**
* @param {string} s
* @return {string[]}
*/
var removeInvalidParentheses = function(s) {
const result = [];
const visited = new Set([s]);
const queue = [s];
// Checks whether a string has valid parentheses
function isValid(str) {
let balance = 0;
for (const ch of str) {
if (ch === '(') {
balance++;
} else if (ch === ')') {
// More closing than opening parentheses
if (balance === 0_const plugin = require('tailwindcss/plugin')
module.exports = {
plugins: [
plugin(({ matchUtilities }) => {
const bleedParent = {
DEFAULT: '50%', // rodič = container
'1/2': '100%',
'1/3': '150%',
'2/3': '75%',
'1/4': '200%',
'3/4': '66.6667%',
'1/5': '250%',
}
const out = (v) => `calc(${v} - 50vw)` // přetečení
const back = (v) => `calc(50vw - ${v})` // návrat obsahu
matchUtilities({
'bleed-<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bleed snippet (čisté HTML + CSS)</title>
<style>
/*
BLEED SNIPPET
-------------
Pravidlo: % v marginu/paddingu se počítá ze šířky OBSAHU RODIČE.
Půlka containeru = (kolikrát se rodič vejde do containeru) / 2 * 100 %
- rodič = container -> 50%
- rodič = sloupec 1/2 -> 100%
- rodič = sloupec 1/3 -> 150%
- r<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bleed slider</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css">
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script>
tailwind.config = {
theme: { container: { screens: { '2xl': '800<!--
https://play.tailwindcss.com/vibc7NWlcK
-->
<div class="max-w-2xl mx-auto bg-red-400 py-10 mb-20">
<div class="bg-green-400 py-5 ml-[calc(50%-50vw)]">Bleed to left </div>
</div>
<div class="max-w-2xl mx-auto bg-red-400 py-10 mb-20">
<div class="bg-green-400 py-5 mr-[calc(50%-50vw)]">Bleed to right </div>
</div>
<div class="max-w-2xl mx-auto bg-red-400 py-10 flex mb-20">
<div class="w-1/2">AAA</div>
<div class="w-1/2">
<div class="bg-green-400 py-5 mr-[cal<!--
https://play.tailwindcss.com/vibc7NWlcK
-->
<div class="max-w-2xl mx-auto bg-red-400 py-10 mb-20">
<div class="bg-green-400 py-5 ml-[calc(50%-50vw)]">Bleed to left </div>
</div>
<div class="max-w-2xl mx-auto bg-red-400 py-10 mb-20">
<div class="bg-green-400 py-5 mr-[calc(50%-50vw)]">Bleed to right </div>
</div>
<div class="max-w-2xl mx-auto bg-red-400 py-10 flex mb-20">
<div class="w-1/2">AAA</div>
<div class="w-1/2">
<div class="bg-green-400 py-5 mr-[cal