Skip to content

Instantly share code, notes, and snippets.

import type { RequireOneOrNone } from "type-fest"
import { isArray } from "lodash-es"
import type { UserModel } from "@/db/users/types"
import type { ResourceModelMap } from "./interfaces"
import type { PermissionResource, PermissionScope } from "./types"
@CasperEngl
CasperEngl / ocm
Last active March 13, 2024 15:29
OCM (Ollama Commit Message)
#!/bin/bash
ollama_commit_message_prompt="Generate a concise git commit message written in present tense for the following code diff with the given specifications: 1: Commit message must be a maximum of 255 characters. 2: One line of text and no lists of changes. 3: Exclude anything unnecessary such as translation. Your entire response will be passed directly into git commit."
ollama_commit_message_model="mistral"
if [ -n "$OCM_COMMIT_MESSAGE_PROMPT" ]; then
ollama_commit_message_prompt="$OCM_COMMIT_PROMPT"
fi
import { debounce } from 'lodash-es'
import type { MaybeRef } from 'vue'
import { computed, reactive, unref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { z } from 'zod'
type PrimitiveZodTypes =
| z.ZodString
| z.ZodNumber
| z.ZodDate
// https://play.tailwindcss.com/mP9gHiRLWq
const plugin = require('tailwindcss/plugin')
/** @type {import('tailwindcss').Config} */
export default {
theme: {
extend: {
// ...
},
find: t\('(.+)'\).toString\(\)
replace: t('$1')
import type { MaybeRef } from 'vue'
import { ref, watchEffect } from 'vue'
type UseDialogOptions = {
isOpen: MaybeRef<boolean>
persistent: MaybeRef<boolean>
onClosing?: () => void
onClose?: () => void
animationOptions: MaybeRef<KeyframeAnimationOptions>
dialogKeyframes: MaybeRef<Keyframe[]>
# ===================
# Variables
# ===================
count = 0 # assign 0 to count
print(count) # prints 0
count = 1 # assign 1 to count
print(count) # prints 1
count = 2 # assign 2 to count
print(count) # prints 2
// https://codepen.io/codercatdev/pen/eYVjxjK
const rating = stars => `★★★★★☆☆☆☆☆`.slice(5 - stars, 10 - stars);
import React from 'react'
type StrictContextReturn<T, U = T> = [React.Context<T>, () => U, T]
export function createStrictContext<T>(options: {
errorMessage?: string
name?: string
defaultValue?: T
allowMissingProvider: true
}): StrictContextReturn<T, T | undefined>
var priceWidget = document.querySelector('.js-c-product-quick-form');
var financialInfo = document.querySelector(
'.p-product-page__product-financial-info'
);
priceWidget.style.position = 'static';
priceWidget.style.background = 'none';
priceWidget.style.border = 'none';
priceWidget.style.marginTop = '25px';